John81 Posted August 8, 2011 Posted August 8, 2011 Does sombody know a way to load wav files into memory for faster playing with Autoit, because soundplay need 1 sec to read the wav from HDD.
UEZ Posted August 8, 2011 Posted August 8, 2011 This might help you: Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Yashied Posted August 8, 2011 Posted August 8, 2011 #Include <WinAPIEx.au3> Global $sWave = @ScriptDir & '\MySound.wav' Global $iByte $iSize = FileGetSize($sWave) $tWave = DllStructCreate('byte[' & $iSize & ']') $pWave = DllStructGetPtr($tWave) $hFile = _WinAPI_CreateFile($sWave, 2, 2) _WinAPI_ReadFile($hFile, $pWave, $iSize, $iByte) _WinAPI_CloseHandle($hFile) _WinAPI_PlaySound($pWave, BitOR($SND_ASYNC, $SND_MEMORY, $SND_NOWAIT)) While 1 Sleep(1000) WEnd My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
UEZ Posted August 8, 2011 Posted August 8, 2011 (edited) It seems to be that I mixed up the link in my previous post! Look here: or here: http://pastebin.com/KCpSRWs2 It is more or less the code which Yashied has posted in #3. Br, UEZ Edited August 8, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
John81 Posted August 8, 2011 Author Posted August 8, 2011 (edited) Thx u both for ur quick answers.I think i want to use the because i have to add 30 wav files and its for me more comfortable to put it in my script, like this#AutoIt3Wrapper_Res_File_Add=C:\mysoundfile_1.wav, sound, mysoundfile_1 #AutoIt3Wrapper_Res_File_Add=C:\mysoundfile_2.wav, sound, mysoundfile_2 #AutoIt3Wrapper_Res_File_Add=C:\mysoundfile_3.wav, sound, mysoundfile_3 ;soon on soon to 30 #include "resources.au3" If $Action1 = True Then _ResourcePlaySound("mysoundfile_1", $SND_ASYNC) ;soon on soon to $Action 30and i did compile the script, but it will not play the recource sound at the moment Edited August 8, 2011 by John81
Moderators Melba23 Posted August 8, 2011 Moderators Posted August 8, 2011 John81,Your code seems fine and I can play wav files as resources without problem using very similar commands. What does AutoIt3Wrapper tell you when you try and load the files as resources? Could you post the output that you get in the SciTE console when compiling?Have you checked with ResHacker that the resources are indeed loaded? Do not forget that you need to prevent upx from compressing the file or ResHacker will not display them, so you need a #AutoIt3Wrapper_UseUpx=n line in there as well. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
John81 Posted August 8, 2011 Author Posted August 8, 2011 (edited) Hi Melba23, At First i put now this in the line #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_File_Add=C:\mysoundfile_1.wav, sound, mysoundfile_1 #AutoIt3Wrapper_Res_File_Add=C:\mysoundfile_2.wav, sound, mysoundfile_2 #AutoIt3Wrapper_Res_File_Add=C:\mysoundfile_3.wav, sound, mysoundfile_3 ;soon on soon to 30 #include "resources.au3" If $Action1 = True Then _ResourcePlaySound("mysoundfile_1", $SND_ASYNC) ;soon on soon to $Action 30 but still not work And the Infos i get after compiling are this >"C:\Programme\AutoIt3\SciTE\..\aut2exe\aut2exe.exe" /in "C:\myscript.au3" Ultimate Packer for eXecutables Copyright (C) 1996 - 2008 UPX 3.03w Markus Oberhumer, Laszlo Molnar & John Reiser Apr 27th 2008 File size Ratio Format Name -------------------- ------ ----------- ----------- 646144 -> 300544 46.51% win32/pe myscript.exe Packed 1 file. >Exit code: 0 Time: 2.933 And when i use Recource Hacker there are still something compressed ? P.S. i decompressed with upx the file manualy,and then i started the exe but no sound and in the recource now i can´t find any wav file there. Edited August 8, 2011 by John81
AdmiralAlkex Posted August 8, 2011 Posted August 8, 2011 (edited) You are missing SciTE4AutoIt3, it brings multiple tools giving bucket-loads of improvements of the AutoIt experience, for example the AutoIt3Wrapper that you are trying to use here even though you don't have it... Which is weird.The Resources UDF page you linked to even mentions SciTE4AutoIt3 multiple times, can't see how you missed that Edited August 8, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
John81 Posted August 8, 2011 Author Posted August 8, 2011 (edited) I thought i have the SciTE4AutoIt3 already, thx man now it does work P.S. What is the different between ... _ResourcePlaySound("mysoundfile_1", $SND_ASYNC) <-- with it or without this ? Edited August 8, 2011 by John81
Zedna Posted August 8, 2011 Posted August 8, 2011 P.S. What is the different between ..._ResourcePlaySound("mysoundfile_1", $SND_ASYNC) <-- with it or without this ?As far as I know ASYNC mode will start playing sound and goes directly to another AU3 commandwhile SYNC (default) mode waits until sound finishes. Resources UDF ResourcesEx UDF AutoIt Forum Search
John81 Posted August 8, 2011 Author Posted August 8, 2011 As far as I know ASYNC mode will start playing sound and goes directly to another AU3 commandwhile SYNC (default) mode waits until sound finishes.Thx Zeda, and very good usefully release
UEZ Posted August 8, 2011 Posted August 8, 2011 This link might help you: http://msdn.microsoft.com/en-us/library/dd743680%28VS.85%29.aspx Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Mich9874 Posted November 29, 2011 Posted November 29, 2011 #Include <WinAPIEx.au3> #Include <APIConstants.au3> Global $sWave = @ScriptDir & 'MySound.wav' Global $iByte $iSize = FileGetSize($sWave) $tWave = DllStructCreate('byte[' & $iSize & ']') $pWave = DllStructGetPtr($tWave) $hFile = _WinAPI_CreateFile($sWave, 2, 2) _WinAPI_ReadFile($hFile, $pWave, $iSize, $iByte) _WinAPI_CloseHandle($hFile) _WinAPI_PlaySound($pWave, BitOR($SND_ASYNC, $SND_MEMORY, $SND_NOWAIT)) While 1 Sleep(1000) WEnd Thanks for this! There was a missing #include that's necessary to make this run, I've included it in the quoted code. Mich.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now