Jump to content

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


Morteza
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...