SetChannelVolume not working on WP8?

Monkey Targets Forums/Windows 8/SetChannelVolume not working on WP8?

SLotman(Posted 2014) [#1]
I have a small function in my libs to change the sound volume globally in my games:

Function setAudioVol(vol:Float)
   Config.audioVol = vol
	For Local f:Int=0 To MAX_CHANNELS
		SetChannelVolume f, vol
	Next
End Function


It is working pretty well on most targets - but on WP8 it does nothing!
Tested both on emulator as in a Nokia 620 - it gets more noticeable on Nokia at the max volume.

I set the volume in the 0...1 interval - and no change is made to it, unless its zero (then no sound is played, but that could be my library, that skips the sound playing altogether when volume=0)

Setting music volume works, which makes me wonder what could be going on.

I just found out something else: if music played is set to loop, and app looses focus (I kept holding the back key until the game is 'minimized') and regain it - calling "ResumeMusic" on OnResume resumes the music... but it won't loop, and when reaching the end, the music stops. (Only on WP8, other targets works) - music volume also appears to reset.


GfK(Posted 2014) [#2]
I'm not very conversant with Monkey (though, I do like cheeky banana). But, should you not be iterating with a TChannel object, through a linked list of TChannels? Because it looks to me like you're trying to set the volume of an Integer. I might be losing the plot but I cannot even begin to fathom how that's working on "most targets".


therevills(Posted 2014) [#3]
@Slotman, thats very similar to what I do in Diddy:
Method SoundSetVolume:Void(volume:Int)
	If volume < 0 Then volume = 0
	If volume > 100 Then volume = 100
	Self.soundVolume = volume
	For Local i% = 0 To SoundPlayer.MAX_CHANNELS
		SetChannelVolume(i, diddyGame.soundVolume / 100.0)
	Next
End

I can't remember if I have tested it on Win8 though...

@Dave(Gfk), in Mojo the channels are preset and are accessed via an integer ID value:
It uses a simple 'fixed' 32 channel model which allows you to play sounds through any of 32 preset audio channels. Audio channels are identified by the use of integer ids in the range 0 to 31.

http://www.monkeycoder.co.nz/docs/html/Modules_mojo.audio.html#description


GfK(Posted 2014) [#4]
Well, I said I was a little out of touch with it - Think I last used Monkey about 30 versions ago! Thanks for the info, tho.


SLotman(Posted 2014) [#5]
Apparently it is a bug then... I can't get it to work on my Lumia 620 :(