0
0

Hi
After playing a sound in my scene, and after stopping the sound channel, i want release the channel, But how can i do that?
if (channel)
channel->stop();

Is the above code enough?

Thanks.

  • You must to post comments
0
0

If you read in the documentation, there is no needs to ‘release’ or ‘free’ a channel. After the sound playing in it is stopped, the channel will automatically be usable to play an other sound.

Maybe what you want to do is to ‘release’ the sound of this channel after stopping the channel. I think the channel will be re-usable after.

  • You must to post comments
0
0

[quote="kavenb":2mnnv1o6]If you read in the documentation, there is no needs to ‘release’ or ‘free’ a channel. After the sound playing in it is stopped, the channel will automatically be usable to play an other sound.

Maybe what you want to do is to ‘release’ the sound of this channel after stopping the channel. I think the channel will be re-usable after.[/quote:2mnnv1o6]
Ok, I know it but in my scene i have "The specified channel has been reused to play another sound. " error and some times "An invalid object handle was used. " error when i want set set3DAttributes of a channel.

However i have following errors from the FMOD in my game logs:
[code:2mnnv1o6]
17:01:56: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:56: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:56: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:56: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:56: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: Loading sound(filename=’\release\Sounds\glassbreak_01.wav’)...
17:01:56: Loading sound(filename=’\release\Sounds\glassbreak_01.wav’)...
17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:56: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:57: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:57: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:57: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:57: ATError(FMOD)!, (36) An invalid object handle was used.

17:01:57: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:57: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.

17:01:57: ATError(FMOD)!, (11) The specified channel has been reused to play another sound.
[/code:2mnnv1o6]

  • You must to post comments
0
0

Are you using FMOD_CHANNEL_FREE or FMOD_CHANNEL_REUSE in your playSound calls?

For the error when you try to use the channel to set 3d settings, it’s because the channel is invalid when the sound is stopped. I tried to use the IsPlaying() function but it returns the same error.

If you release the sound yourself, maybe try to set your channel pointer to NULL and check before trying to use the channel.

  • You must to post comments
0
0

[quote="kavenb":2gddkauf]Are you using FMOD_CHANNEL_FREE or FMOD_CHANNEL_REUSE in your playSound calls?[/quote:2gddkauf]

Yes , Im using FMOD_CHANNEL_FREE , Here is my play function:
(Maybe i must change FMOD_CHANNEL_FREE to somethings else?)

bool ATSound::play(bool loop/=false/,bool fDestroyItSelfAfterPlaying/=false/)
{
destroyItSelfAfterPlaying=fDestroyItSelfAfterPlaying;
FMOD_RESULT result;
if (ATSoundSystem::getSystem())
{
if (!loop)
{
result = sound->setMode(FMOD_LOOP_OFF);
ATSoundSystem::errcheck(this,"Play,setMode",result);
}
result = ATSoundSystem::getSystem()->playSound(FMOD_CHANNEL_FREE, sound, true, &channel);
if (ATSoundSystem::errcheck(this,"ATSound,play,playSound",result))
{
channel=0;
return false;
}
else
{
result = channel->setPaused(false);
ATSoundSystem::errcheck(this,"Play,setPaused",result);
update(0.1);
}
updateEffects();
return true;
}
return false;
}

[quote="kavenb":2gddkauf]
If you release the sound yourself, maybe try to set your channel pointer to NULL and check before trying to use the channel.[/quote:2gddkauf]

Im doing it, but seems that the errors is not relative to this !

  • You must to post comments
0
0

I think you have to stop the channel before setting it to 0.

But what is the problem exactly with this code? I know you wanted to release a channel at first.

  • You must to post comments
0
0

As i understand, channel is a build-in handle that is only valid after playing a sound to end of playing, but how can i detect end of playing!?
My problem is here that i can not understand when playing a sound will finish, to i set my channel variable to NULL or somethings else!
I need a end playing callback when a sound playing finish.

  • You must to post comments
0
0

Have a look at Channel::setCallback(). You get a callback for a number of different events, including when your sound has finished playing.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.