# Last sound is muted/destroyed when new sound is triggered, happens only on Android

**URL:** <https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992>\
**Category:** FMOD Engine\
**Tags:** android\
**Created:** [July 22, 2020, 2:26am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992 "2020-07-22T02:26:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [July 22, 2020, 2:26am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/1 "2020-07-22T02:26:22Z")

</div>

I was able to use the very same FMod code in our game engine to work on Android, but after a while playing the sounds, the old playing sounds are muted, and the new sound mutes/destroys the previous one.  
It happens only when the engine is build with build-ndk and the game runs on android, either emulator or phone. It does not happen when using same engine and code on Windows build.  
Seems like there is no pool for new sounds, then old sounds are killed, but I still can’t find the problem.  
During file loading, logcat reports strange errors I could not find in this forum or documentation. This happens before the killing of old playing sounds happens.

 ![2020-07-21_22-23-10](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/0/0ac88925149e7137f05b394aee921fd2257208c5.png)

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [July 28, 2020, 4:28am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/2 "2020-07-28T04:28:45Z")

</div>

What version of FMOD are you using?  
Would you be able to share the entire output log while using [`FMOD_DEBUG_LEVEL_LOG`](https://fmod.com/resources/documentation-api?version=2.1&page=core-api-common.html#fmod_debug_flags) and the logging library.

---

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [August 1, 2020, 1:02am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/3 "2020-08-01T01:02:55Z")

</div>

Sorry for long delay, I struggled to generate log file from android. (fmod newbie here).  
I’m using version 2.0.10 now.  
In Windows, there are no issues with muting old sounds, it just happens on Android.  
The messages on both logs looks quite similar. I guess it is trying five formats for each sample, before find that it is mp3.[fmod\_android.log](https://qa.fmod.com/uploads/short-url/5YA7Fkss6UunOi4g54WQqLCnBiN.log) (69.1 KB) [fmod\_windows.log](https://qa.fmod.com/uploads/short-url/20O77pxAOos3iT8Ze7OsRQD8Htl.log) (78.1 KB)

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [August 2, 2020, 11:02pm UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/4 "2020-08-02T23:02:21Z")

</div>

Thanks for that, what type of file are you trying to use?

---

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [August 3, 2020, 12:44am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/5 "2020-08-03T00:44:13Z")

</div>

We use mp3 files, but through our Filesystem abstraction, they are loaded into memory, then fmod loads it from memory.  
I believe it is plausible to be the reason for the log messages, but the main concern is the muting that happens only on Android.

---

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [August 3, 2020, 11:47pm UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/6 "2020-08-03T23:47:09Z")

</div>

Update: I used  
`	audioInfo.suggestedsoundtype = FMOD_SOUND_TYPE_MPEG;`

Log shows better messages (attached), as expected. But the muting last sounds problem continues on android.  
[android fmod log.txt](https://qa.fmod.com/uploads/short-url/8Y1fasw9gCoQBRchWFJ1hWfywuF.txt) (50.8 KB)

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [August 4, 2020, 6:01am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/7 "2020-08-04T06:01:12Z")

</div>

It looks like you are setting the maximum channels, in [System::init](https://fmod.com/resources/documentation-api?version=2.0&page=core-api-system.html#system_init), to 32.

> If the virtual voice limit is hit then Channels will be stolen and start returning [FMOD\_ERR\_INVALID\_HANDLE](https://fmod.com/resources/documentation-api?version=2.0&page=core-api-common.html#fmod_err_invalid_handle). Channels which have had their handle stolen in this way are permanently stopped and will never return.

[https://fmod.com/resources/documentation-api?version=2.0&page=white-papers-virtual-voices.html#software-voices-vs-virtual-voices](https://fmod.com/resources/documentation-api?version=2.0&page=white-papers-virtual-voices.html#software-voices-vs-virtual-voices)

---

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [August 4, 2020, 3:58pm UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/8 "2020-08-04T15:58:39Z")

</div>

32 channels should not be the problem, the effects are short and rarely there are more than 32 samples being played. In fact, at android, when the issue happens, only 1 sound is played.  
I believe it is stolen, or going into virtual mistakenly.  
Also, that issue never happens on Windows, same code, same channels.

---

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [August 4, 2020, 7:48pm UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/10 "2020-08-04T19:48:30Z")

</div>

I changed the code, for loading sounds direct from file (using file:///android\_asset/), resulted no difference in behavior, then I changed the maximum channels to 128 while keeping software channels to 32:  
result = m\_system-\>init(128, FMOD\_INIT\_NORMAL, 0);  
if (FMOD\_ERRCHECK(result, m\_logger))  
return false;  
result = m\_system-\>setSoftwareChannels(32);  
FMOD\_ERRCHECK(result, m\_logger);

The difference was that after some time (like when all 32 channels are used), all sounds were muted, and no new sound was played.  
Like it is not freeing channels from already played samples.  
I could not find information about that on log.  
May be something with bad sorting or going virtual? some bug or odd default on android platform?

---

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [August 4, 2020, 7:56pm UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/11 "2020-08-04T19:56:00Z")

</div>

Short clip trying to illustrate the issue

[![](https://img.youtube.com/vi/vaoDc9bl4GI/maxresdefault.jpg "2020 08 04 13 34 07") ](https://www.youtube.com/watch?v=vaoDc9bl4GI)

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [August 5, 2020, 5:53am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/12 "2020-08-05T05:53:04Z")

</div>

If it runs out to the point sounds stop playing then that’s an update issue. Are the update loops for Windows and Android different?

---

<div class="post-metadata">

**Author:** ![robertomurta](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/robertomurta/32/1338_2.png) [@robertomurta](https://qa.fmod.com/u/robertomurta)\
**Post date:** [August 6, 2020, 1:26am UTC](https://qa.fmod.com/t/last-sound-is-muted-destroyed-when-new-sound-is-triggered-happens-only-on-android/15992/13 "2020-08-06T01:26:32Z")

</div>

Thank you Cameron, main loop for Android was a different code and update was not being called.  
I did not expect for fmod to work so far without it.
