0
0

I’ve just started learning the API, so pardon my newbie-ness.

I created a simple win32 app to stop and start an mp3 file. The following is a stop procedure:

[code:dpv1c2h7]
void StopSound()
{
bool playing = false;

if (channel == NULL)
    return;

result = channel->isPlaying(&playing);
ERRCHECK(result);

if (playing)
{
    result = channel->stop();
    ERRCHECK(result);
}

}
[/code:dpv1c2h7]

My question is this: why does isPlaying return an error stating "An invalid object handle was used" when the channel is not currently playing a sound? The &playing return value is false, which it should be, but shouldn’t the function return value be FMOD_OK instead of FMOD_ERR_INVALID_HANDLE?

  • You must to post comments
0
0

I would guess that the channel has been released internally. I get that error every now and then in the designer api when by mistake working with released events. In my case the most common reason is that the parent (eventgroup) has been released or that the event has been stolen.

  • You must to post comments
0
0

Correct. The channel has finished playing or been stolen. This is normal behaviour, you should just consider the sound has stopped normally.

  • You must to post comments
0
0

[quote="andrew":11ir1oax]Correct. The channel has finished playing or been stolen. This is normal behaviour, you should just consider the sound has stopped normally.[/quote:11ir1oax]

Hi, what does mean? If the sound stop normally (for example in no-loop mode) is not possible to stop the channel? How must I perform this check?
Regards,
Franco

  • You must to post comments
0
0

If the sound is already stopped why would you want to stop it again? You don’t need to check anything, just call Channel::stop and if it returns FMOD_ERR_INVALID_HANDLE just ignore it.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.