getChannel() always returns invalid handle


(Daniel Branicki) #1

I’m using FMOD.System.getChannelsPlaying to see how many playing channels there are, and the value is correct, with channels increasing as I play new sfx.

When I use FMOD.System.getChannel() I get result OK, but when I try to set channel’s volume, pan or whatever else, it returns ERR_INVALID_HANDLE. That is so for every channel I get this way.

Please, anybody, help!


(Nicholas Wilcox) #2

Don’t assume that if you have N channels playing that getChannel(x) where 0 <= x < N will return a playing channel.

getChannel() indexes the channel pool that is initialized based on the parameter passed into System::init(). The channel that your sound plays could be any member of this pool.

Just use the channel handle that you get back from playSound().