FreeAudio bug?

BlitzMax Forums/BlitzMax Programming/FreeAudio bug?

Johnsprogram(Posted 2011) [#1]
I found something wrong when playing sounds and stopping channels on most audio drivers. Here's the code...

SuperStrict

SetupAudioDriver(0)

Local channel:TChannel = AllocChannel()
Local sound_one:TSound 
Local sound_two:TSound 

'----------------------------------------------------

Function SetupAudioDriver(index:Int = 0)
	If index < 0 Or index => AudioDrivers().length Then RuntimeError("index out of bounds")

	For Local i:Int = index To AudioDrivers().length-1
		If SetAudioDriver(AudioDrivers()[i]) Then 
			Print "installed: " + AudioDrivers()[i]
			Return
		EndIf
	Next

	Notify("Cannot load audio driver.",True)
EndFunction

'----------------------------------------------------

sound_one = LoadSound("world4I.ogg")
sound_two = LoadSound("world4I.ogg")

PlaySound(sound_one,channel)

Repeat;Until Not channel.playing()
If Not channel.playing() Then Print "#1 not playing"

StopChannel(channel)

Delay(1000)

PlaySound(sound_two,channel)

Delay(1000)

Repeat;Until Not channel.playing()
If Not channel.playing() Then Print "#2 not playing"

Delay(1000)
If Not channel.playing() Then Print "#2 still not playing"


Here's the scenario:
I had one channel set up after setting up an audio driver. Then, I had played one song on that channel.
After the first PlaySound(), there's a loop that will keep on looping until the channel stops playing. (You'll get a output message upon exiting the loop.) After StopChannel() and the 1 second delay, another sound was played on the same channel.

Here's the problem:
When approaching the second repeat;until loop, it sometimes work, but it doesn't always work; but it suppose to work. What I have found out is when I set the audio driver to anything that is "FreeAudio", channel.playing() or channelplaying(channel) will keep on returning false. On the flip side, setting the driver to "DirectSound" works as it should when playing the first sound.

I don't know if it's just me, but I'm hinting that using stopchannel() while set to "FreeAudio" will keep the channel's status set to "not playing" regardless of using playsound() shortly.

The delays were there to try if the problem is time-sensitive.

So, are any of you folks getting this sort of problem as well?