# Fmod isPlaying Question!!!Please Help!!!

**URL:** <https://qa.fmod.com/t/fmod-isplaying-question-please-help/11481>\
**Category:** FMOD Studio\
**Created:** [May 23, 2014, 5:40am UTC](https://qa.fmod.com/t/fmod-isplaying-question-please-help/11481 "2014-05-23T05:40:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthony091527](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@anthony091527](https://qa.fmod.com/u/anthony091527)\
**Post date:** [May 23, 2014, 5:40am UTC](https://qa.fmod.com/t/fmod-isplaying-question-please-help/11481/1 "2014-05-23T05:40:17Z")

</div>

Hello everyone！I use Fmod in the Ogre. And I want to judge the sound file is finished playing! So i use the function named ‘isPlaying’ in the Fmod Library.But the function always return ‘FMOD\_ERR\_INVALID\_HANDLE’.Please help me! Thank you! I have the following code in step:

```auto
int channelIndexTemp;
bool isPlaying;
FMOD_RESULT result;
FMOD::Channel *channel;
if (Channelndex)
    channelIndexTemp = *Channelndex;
float tempTime = GetSoundLength(channelIndexTemp);
result = system->getChannel(channelIndexTemp, &channel);
if (result == FMOD_OK)
    result = channel->isPlaying(&isPlaying);
```

The value of ‘isPlaying’ is always ‘false’.

---

<div class="post-metadata">

**Author:** ![dnishimura](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/dnishimura/32/25_2.png) [@dnishimura](https://qa.fmod.com/u/dnishimura)\
**Post date:** [June 10, 2014, 7:18pm UTC](https://qa.fmod.com/t/fmod-isplaying-question-please-help/11481/2 "2014-06-10T19:18:41Z")

</div>

Hi anthony,

I don’t have experience with Ogre, but I believe you’ll have to check if the sound is playing every update call.

---

<div class="post-metadata">

**Author:** ![Guest1](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@Guest1](https://qa.fmod.com/u/Guest1)\
**Post date:** [June 12, 2014, 1:56am UTC](https://qa.fmod.com/t/fmod-isplaying-question-please-help/11481/3 "2014-06-12T01:56:35Z")

</div>

Hi Anthony,

I have moved your question out of the Unity integration subforum, into the main Studio forum.

In response to your question, it is common for isPlaying to return INVALID\_HANDLE, once the channel stops playing it will go invalid quite shortly after. Just treat that error as the same as isPlaying returning false.

-Pete

---

<div class="post-metadata">

**Author:** ![wills](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/wills/32/2641_2.png) [@wills](https://qa.fmod.com/u/wills)\
**Post date:** [September 21, 2021, 6:44pm UTC](https://qa.fmod.com/t/fmod-isplaying-question-please-help/11481/4 "2021-09-21T18:44:16Z")

</div>

If you’re using FMOD studio you can listen for [FMOD\_STUDIO\_EVENT\_CALLBACK\_SOUND\_STOPPED](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventinstance.html#fmod_studio_event_callback_sound_stopped)

If you’re using low level FMOD setup a callback for [FMOD\_CHANNELCONTROL\_CALLBACK\_END](https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-channelcontrol.html)
