Jump to content
Sign in to follow this  

Help with Loops

Recommended Posts

Hi, I'm trying to make my program have a background music loop. The program has a GUI and the main loop is the GUI loop, where the buttons are checked, like this:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $ExitBtn
        Case $AboutBtn
        Case Else

Right now, I am using the SoundPlay command to play the music. However, I want this music to loop continuously forever throughout the program. I tried to insert SoundPlay("music.mp3", 0) into the main loop (0 = play the music and return to program, 1 = play the music and wait for it to end, then return to program). But when I do this, it just keeps restarting the music so it sounds like static.

Next, I tried to use it with AdlibEnable and call a function to play the music with SoundPlay("music.mp3", 1). This time, the program GUI just froze (but at least the music played normally) so both of the methods failed.

Is there any way that I can make the program play music continuously in the background if I already have one main loop?

Share this post

Link to post
Share on other sites

Ok, now I tried something the works a little bit.

Now I stick in

AdLibEnable("_BGM",112000) ;The music is 1:52, which is 112 seconds long
_BGM() ;This is needed to start the music playing for the 1st timeoÝ÷ Ú)í¢Ø^mè"x§Ê"¶+Åç.µçhÇ¢é]ÖÞÞy÷âqéí¶¬xK±'i¹^¢¸§²×vËbrH­{azf¢Z(¤(ºWi­çÞ®ØZ¶+n±ë.¦V¬°#Ô!ø­È§¶¦j)å¢b·¥Z(Ê&zØb   bëaÆ®¶­seô$tÒµÆ×W60¢b33c´$tÕFÖW"ÒFÖW$æBµ7F'FærFÖW  ¥vÆR¢b33c¶ä×6rÒuTvWD×6r¢7vF6b33c¶ä×6p¢66Rb33c´uTôUdTåEô4Äõ4P¢ôWB¢66Rb33c´WD'Fà¢ôWB¢66Rb33c´&÷WD'Fà¢ô&÷WB¢66RVÇ6P¢6ÆVWS¢VæE7vF6 ¢bFÖW$Ffbb33c´$tÕFÖW"fwC²#FVâ´b£S"2FöæRFVâ&RÆ×W60¢ô$tÒ¢b33c´$tÕFÖW"ÒFÖW$æBµ&W6WBFÖW ¢VæD`¥tVæ@

Which one is better to use (less CPU load)? And this way isn't the best way to do it, because there is a small break in the music where it ends and starts, so is there an even better way to do this?

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...