Sign in to follow this  
Followers 0
Morteza

How to play a MIDI file at background with winmm.dll?

7 posts in this topic

It will be very nice if every time a script is executed, a MIDI file be played at background. I want use windows winmm.dll for this aim. Is this possible with AutoIT3?

Thanks beforehand

Share this post


Link to post
Share on other sites



There is DLLCall function, try using it.


I can do signature me.

Share this post


Link to post
Share on other sites

There is DLLCall function, try using it.

Thanks for answer. I used it, but MIDI files are not played to the end! No problem with other music files, just with MIDI files. Another problems is that I didn't know how to repeat the playing. My sample code was:

$MIDFile = "a.mid"
DllCall( "winmm.dll", "int", "mciExecute", "str", "play " & $MIDFile)
Sleep(5700)

any help?

Share this post


Link to post
Share on other sites

Search on forum about MidiUDF.au3


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks for answer. I used it, but MIDI files are not played to the end! No problem with other music files, just with MIDI files. Another problems is that I didn't know how to repeat the playing. My sample code was:

$MIDFile = "a.mid"
DllCall( "winmm.dll", "int", "mciExecute", "str", "play " & $MIDFile)
Sleep(5700)

any help?

:/ Wasn't playing with the dll... but... I guess the script ends as the time music ends? :P

HotKeySet("{ESC}", "_Exit")
$MIDFile = "a.mid"
DllCall( "winmm.dll", "int", "mciExecute", "str", "play " & $MIDFile)
While 1
Sleep(1)
WEnd

Function _Exit()
Exit
EndFunc

<Not tested, press ESC to exit>

Edited by i542

I can do signature me.

Share this post


Link to post
Share on other sites

Search on forum about MidiUDF.au3

I was searched the forum before my post for three days :P The MidiUDF.au3 is for working with MIDI Devices & MIDI notes, not for playing MIDI files. BTW, thanks for your answer.

Share this post


Link to post
Share on other sites

(...) I guess the script ends as the time music ends? :P (...)

No, the script will be executed even after the music time is ended. Execution will be ends just after pressing ESC hotkey.

And there is another important problem too. I will the music be played at beckground repeatedly, but with the code, the MIDI file is played once and script is not executed during music playing.

Regards

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0