General Audio Question.

Monkey Forums/Monkey Programming/General Audio Question.

ElectricBoogaloo(Posted 2013) [#1]
OK, I WAS doing it this way
Method PlaySFX(sfx)
  channel=(channel+1) Mod 32
  PlaySound(sfx,channel,0)
  SetChannelRate(channel,pitch)
End

But after multiple pitchings, things went a bit weird on my Nexus7, and sounds started to play at the wrong pitch. It became especially noticable when flipping between pitch 0.5 and 2.

Today, I've switched it..
Method PlaySFX(sfx)
  channel=(channel+1) Mod 32
  SetChannelRate(channel,pitch)
  PlaySound(sfx,channel,0)
End


This fixes the pitching issue, but my head's going "No! No! You can't set the rate of a channel BEFORE playing the sound! What are you, crazy?"
Am I ok doing this?
Will anyone's phone explode?
What happens if it breaks?
Does it break?
Is it all going to be alright?
Where's my teddy?


AdamRedwoods(Posted 2013) [#2]
You can't set the rate of a channel BEFORE playing the sound!

I would suspect it is this way. Sets up the hardware before beginning the action.