huskies Posted March 16, 2009 Posted March 16, 2009 (edited) I understand that the soundplay command allows autoit to play a music file from a hard drive. However what if I want to play a midi file that isn't available in every computer and I want it to be a part of my midi, in a "include" fashion so that the midi is apart of the exe? Edited March 18, 2009 by huskies <It Shall Be Done>
MattyGibbard Posted March 16, 2009 Posted March 16, 2009 I understand that the soundplay command allows autoit to play a music file from a hard drive. However what if I want to play a midi file that isn't available in every computer and I want it to be a part of my midi, in a "include" fashion so that the midi is apart of the exe? Like this: $Install = FileInstall ( "file.midi" , "C:\File.midi" ) FileOpen ( "C:\File.midi ............
huskies Posted March 16, 2009 Author Posted March 16, 2009 Like this: $Install = FileInstall ( "file.midi" , "C:\File.midi" ) FileOpen ( "C:\File.midi ............ thanks, I have a second small problem, I need my midi to loop and it is not doing that. here is my code, I got it from this thread that http://www.autoitscript.com/forum/index.ph...p;hl=play+music (post#5) if you use a simple while loop it will loop the midi infinitely while letting you do other stuff with autoit this is the midi that I used http://www.mediafire.com/?sharekey=850a7e3...04e75f6e8ebb871 expandcollapse popup#include <Sound.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Date.au3> FileInstall("C:\Desktop\mp3\snow bros floors-41-49.mid", @ScriptDir& "\test.midi") $sound = _SoundOpen(@ScriptDir& "\test.midi", "loop") _SoundPlay($sound, 0) While 1 If _SoundPos($sound, 2) = _SoundLength($sound, 2) Then _SoundPlay($sound) Calendar() ;do stuff WEnd Func Calendar() Local $Date, $msg, $Button_1 GUICreate("Please select the Date", 400, 400,110,-1 ) $Date = GUICtrlCreateMonthCal(@YEAR & "/" & @Mon & "/" & @mday,110, 10) $Button_1 = GUICtrlCreateButton("OK", 150, 300, 100) GUISetState() ; Run the GUI until the dialog is closed or timeout $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() If $msg = $Button_1 Then MsgBox(0, $msg, GUICtrlRead($Date), 2) GUIDelete() exit EndIf wend GUIDelete() EndFunc ;==>Example <It Shall Be Done>
Skruge Posted March 16, 2009 Posted March 16, 2009 Nice, Bubble Bobble Snow Brothers is one of my favorites. For testing purposes, I used a much shorter song. VictoryCreate an Adlib function and start it after the song begins.Func _LoopSound() if _SoundStatus($sound) = "stopped" then _SoundPlay($sound) EndFuncAlso note, I don't think the _SoundPos/_SoundLength functions work on MIDI files, at least they didn't work for me. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]
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