Sound issue with Blitzmax 1.35

Archives Forums/BlitzMax Bug Reports/Sound issue with Blitzmax 1.35

zambani(Posted 2009) [#1]
Can anyone help me figure out why this code crashes after pressing the space bar 16 times in Multithread?

Works fine in non-Multihread.
Also works fine in multithread for 1.34.




TaskMaster(Posted 2009) [#2]
Dies on me at 28. Probably running out of Channels on the sound card.


zambani(Posted 2009) [#3]
@TaskMaster
Strange, does it happen in non-thread mode also?

I think in my other test I tried clearing the channel with stopChannel and it still crashed.

Thanks for checking it out.


plash(Posted 2009) [#4]
Well... You probably shouldn't be loading the load everytime (not to say nothing is messed up though).


zambani(Posted 2009) [#5]
@Plash
Actually in real life it a different sound file from a list of about a 100 and I don't think they should all be preloaded.
Something about 1.35 and threads. Worked fine with 1.34 with/without threads.


TaskMaster(Posted 2009) [#6]
That was non-thread mode for me.

Dies at 16 in threaded mode.

Moving the loadsound outside of the loop solves the problem. So, it has something to do with the loading.


zambani(Posted 2009) [#7]
@TaskMaster
Yeah, it sucks cause I'm trying to load multiple sounds over time. Can't do much with 16. Definitely a blitzmax 1.35 issue.


TaskMaster(Posted 2009) [#8]
I wonder if there is a way you can wait and make sure it is finished loading before you play it?

I did notice that if I put GCCollect() at the end of the loop, then it crashed after just 2 presses of the space key. :)

I am guessing you have race condition.


skidracer(Posted 2009) [#9]
My machine crashes after 10 plays, multithreaded on XP with following change:

Global base:String = "c:\windows\media\ding.wav"


zambani(Posted 2009) [#10]
@TaskMaster
race condition with what?
I also did a test and hit the space bar at a slower pace like once every 2sec. This should be enough to load and play the sound(click is less than 1sec). But it still crashed after 16 hits.


ziggy(Posted 2009) [#11]
I think, on windows, default sound driver was FreeAudio on 1.34 (still) and it's now DirectSound. You could try using different sound drivers to see if it helps finding where the issue comes from.


marksibly(Posted 2009) [#12]
Hi,

Actually, it's a threaded garbage collection problem, quite an interesting one too!

Looks like it only affects the DirectSound audio driver though, try switching to another for now.


_Skully(Posted 2009) [#13]
Is there no reference remaining within the thread after the sound start is given?


zambani(Posted 2009) [#14]
@marksibly & ziggy
Thanks
The FreesAudio driver works fine.


hub(Posted 2009) [#15]
Hi !

i've just recompiled my project with bmax 1.35
i've a menu to choose the sound driver
		For Local t$=EachIn AudioDrivers()
		   AddGadgetItem cobComboBox2, t$
		Next


freeaudio, freeaudio multimedia, freeaudio direct sound, direct sound and 'null' are listed

My game crash with all the drivers listed ! (also 'null')
No problem with 1.34. My os is XP PRO


Nigel Brown(Posted 2009) [#16]
Similar problems here when building a multi threaded program, crash when I try to playSound()
tried all drivers as mentioned in hub's post and all crashed, if I remove my call to SetAudioDriver() The sound plays correctly without error.


marksibly(Posted 2009) [#17]
Hi,

Can someone post some runnable code?

Just tried rockout with both "OpenAL" and "FreeAudio" drivers and it worked OK.


marksibly(Posted 2009) [#18]
Hi,

Ok, there is a similar issue to do with OpenAL.

Will fix...good to see people actually using threaded mode too!