# Will end of the sound cause channel to be reused by priority system?

**URL:** <https://qa.fmod.com/t/will-end-of-the-sound-cause-channel-to-be-reused-by-priority-system/11669>\
**Category:** FMOD Engine\
**Created:** [October 12, 2014, 3:57pm UTC](https://qa.fmod.com/t/will-end-of-the-sound-cause-channel-to-be-reused-by-priority-system/11669 "2014-10-12T15:57:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vavius](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@vavius](https://qa.fmod.com/u/vavius)\
**Post date:** [October 12, 2014, 3:57pm UTC](https://qa.fmod.com/t/will-end-of-the-sound-cause-channel-to-be-reused-by-priority-system/11669/1 "2014-10-12T15:57:09Z")

</div>

I’m integrating fmod low-level API for our very simple use case and binding some functionality to Lua. I have a wrapper object for Channel with some control API (like pause, resume, volume, position), that keeps reference to channel returned by System::playSound call. Here is list of questions that will make things more clear (I’m using C API):

1. Is channel reused automatically if sound is over (i.e played all loops to the end)?
2. Is FMOD\_CHANNEL reference gets invalidated once underlying channel is reused?
3. If I keep reference to the stopped channel, will it remain invalid even if another sound is started at the same channel ID?

---

<div class="post-metadata">

**Author:** ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)\
**Post date:** [October 12, 2014, 10:47pm UTC](https://qa.fmod.com/t/will-end-of-the-sound-cause-channel-to-be-reused-by-priority-system/11669/2 "2014-10-12T22:47:38Z")

</div>

Hi,  
If a channel plays a sound to the end, the channel will go invalid after this point, so if you keep trying to update it, it will give you FMOD\_ERR\_INVALID\_HANDLE. Same as if you stopped it manually.  
The call to System::update transforms the channel from valid to invalid if this end of sound case happens.

Yes, if you keep a handle to the stopped channel, it will still be invalid if another sound is played on the same channel. It follows the process as described above.  
Channel handles are reference counted so an old handle can’t be used to update a new instance of the same channel.

---

<div class="post-metadata">

**Author:** ![vavius](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@vavius](https://qa.fmod.com/u/vavius)\
**Post date:** [October 14, 2014, 8:23am UTC](https://qa.fmod.com/t/will-end-of-the-sound-cause-channel-to-be-reused-by-priority-system/11669/3 "2014-10-14T08:23:38Z")

</div>

> [@](#):
>
> Hi,  
> If a channel plays a sound to the end, the channel will go invalid after this point, so if you keep trying to update it, it will give you FMOD\_ERR\_INVALID\_HANDLE. Same as if you stopped it manually.  
> The call to System::update transforms the channel from valid to invalid if this end of sound case happens.
> 
> Yes, if you keep a handle to the stopped channel, it will still be invalid if another sound is played on the same channel. It follows the process as described above.  
> Channel handles are reference counted so an old handle can’t be used to update a new instance of the same channel.

Thanks, it works just as expected.
