Re: AHK Piano
Posted: 22 Jan 2022, 19:02
Hi guys - I'm having fun with this. But why does each media file have to be loaded again after the MCI_Play()? Isn't there a way to re-use it from memory?
I'm not sure why that is. If I remember correctly, reloading the file after playing it was the only way I could find to get it to work. It is the same way in the Drum script. Have you tried removing the extra "MCI_Open" lines and see if it works on your system?
Code: Select all
load:
FileSelectFile, selectedtrack, 3, , Select an Audio File, Audio (*.wav; *.mp3)
If ErrorLevel
Return
hMedia:=MCI_Open(selectedtrack)
MCI_Play(hMedia,"from 0 to 500")
mcidevice := MCI_DeviceType(hMedia)
GuiControl, , type, %mcidevice%
Sleep 1000
MCI_Play(hMedia,"from 0 to 500")
Sleep 1000
MCI_Play(hMedia,"from 0 to 500")
Return