Sign in to follow this  
Followers 0
AetherMaster

Looping sound

6 posts in this topic

Hello everyone, I have a quick question for you. A while back, I found a function for looping a WAV sound:

Func _SoundLoop($sSoundFile, $bLoop = True)
    Local Const $SND_ALIAS = 0x10000
    Local Const $SND_ALIAS_ID = 0x110000
    Local Const $SND_APPLICATION = 0x80
    Local Const $SND_ASYNC = 0x1
    Local Const $SND_FILENAME = 0x20000
    Local Const $SND_LOOP = 0x8
    Local Const $SND_MEMORY = 0x4
    Local Const $SND_NODEFAULT = 0x2
    Local Const $SND_NOSTOP = 0x10
    Local Const $SND_NOWAIT = 0x2000
    Local Const $SND_PURGE = 0x40
    Local Const $SND_RESOURCE = 0x40004
    Local Const $SND_SYNC = 0x0
    
    If $bLoop Then
        DllCall('winmm.dll', 'int', 'PlaySoundA', 'str', $sSoundFile, 'int', 0, 'int', BitOR($SND_ASYNC, $SND_FILENAME, $SND_LOOP))
    Else
        DllCall('winmm.dll', 'int', 'PlaySoundA', 'str', $sSoundFile, 'int', 0, 'int', $SND_FILENAME)
    EndIf
EndFunc

However, I'm looking to loop an MP3. Yes, I know that MP3s have a 'pause' that prevents stemless looping, but that doesn't matter to me. I'm willing to work with an audio glitch, since saving as an MP3 shaves off so much file size.

Is there any way to loop an MP3? Thanks!

Share this post


Link to post
Share on other sites



Manadar: Wow, that's complex... Sure there's no easier way?

AdmiralAlkex: Which help file do you mean? Autoit's? I know that Autoit can play MP3s, but it can't loop them.

Share this post


Link to post
Share on other sites

AdmiralAlkex: Which help file do you mean? Autoit's? I know that Autoit can play MP3s, but it can't loop them.

Think. You just need to play the file again if it ended, so do a "if _SoundStatus = "stopped" then playagain()" . BASS would work the same way if you use that.

Share this post


Link to post
Share on other sites

Think. You just need to play the file again if it ended, so do a "if _SoundStatus = "stopped" then playagain()" . BASS would work the same way if you use that.

Wow. Now I feel stupid. Thanks for your help! :(

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