v76d / glfw: PlaySound() fails if channel > 21

Monkey Forums/Monkey Bug Reports/v76d / glfw: PlaySound() fails if channel > 21

Nobuyuki(Posted 2014) [#1]
This one seems to happen whether the compiler is msbuild or gcc, and happens with 3 different test samples I used (two ogg, and one short wav). Code to reproduce:



Replace "Go.wav" with anything. Docs state the sound machine has 32 channels, I'm only able to get PlaySound to work on 22. (Interestingly: 22 is 16 in Hex. Perhaps there is an implicit type conversion going on somewhere?)

(Oh, and if this helps, my build system is Windows XP 32-bit)


marksibly(Posted 2014) [#2]
Have you tried the latest version of Monkey?

It works fine here on Xp/Windows 7 with shoot.wav and tinkle.wav samples from the mak/audiotest banana.


Nobuyuki(Posted 2014) [#3]
I'm experiencing the same problem on v76f on mak/audiotest (I altered line 119 to allow it to go up to 32 channels). Hmm, I wonder what's wrong.


marksibly(Posted 2014) [#4]
Can you try starting chan at '10' or something?

Anyone else having this problem?


Nobuyuki(Posted 2014) [#5]
Okay here it gets weirder. On line 121 I changed what was there to this:
If shoot_chan = 31 shoot_chan = 10


and adjusted the variables on line 13 to look like this:
	Field shoot:Sound, shoot_chan = 10, shoot_loop


and the problem "went away". However, when I changed line 121 to set shoot_chan back to 0 again, the problem came back! Only this time, the channels where the samples weren't playing were 1-9! The localized code block which told me this was:

			PlaySound shoot, shoot_chan
			Print "shoot_chan: " + shoot_chan
			shoot_chan+=1
			If shoot_chan = 31 shoot_chan = 0


that's extremely weird! Even weirder, the ChannelState for the silent channels appears to always be 1 after the failed attempt to play on them! (maybe a clue?)
This occurs regardless of msbuild or gcc again, maybe it's related to how channels are allocated for playback somehow?


marksibly(Posted 2014) [#6]
Looks like your audio 'hardware' only has 22 channels - please try the version I just pushed to github.


Nobuyuki(Posted 2014) [#7]
Fixed in 78a. Thanks!