# Audio interface support on Android

**URL:** <https://qa.fmod.com/t/audio-interface-support-on-android/17711>\
**Category:** FMOD Engine\
**Tags:** android, cpp\
**Created:** [September 24, 2021, 5:40am UTC](https://qa.fmod.com/t/audio-interface-support-on-android/17711 "2021-09-24T05:40:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [September 24, 2021, 5:40am UTC](https://qa.fmod.com/t/audio-interface-support-on-android/17711/1 "2021-09-24T05:40:52Z")

</div>

One of our customers asked if our app would have Audio Interface support.  
Didn’t know what it meant at that time, and now I think they want something like these.  
[Vid1](https://www.youtube.com/watch?v=5zjXMyS78ho)  
[Vid2](https://www.youtube.com/watch?v=GwJOesnNB4E)  
[Vid3](https://www.youtube.com/watch?v=eUc6sr0suX8)

We don’t have any USB Audio Interface and all our sounds in the app go through FMOD API, so had to ask here.

Does FMOD API on Android support USB Audio Interface?  
If so, does the API detect it automatically?  
If we need to do something manually, then what is it?  
Currently, our app has an option to switch between OpenSL and AAudio, and that’s it.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [September 27, 2021, 12:59am UTC](https://qa.fmod.com/t/audio-interface-support-on-android/17711/2 "2021-09-27T00:59:19Z")

</div>

FMOD always outputs to the default device so if the attached device assumes the role of default (i.e. system sounds come out of it) then it will work with FMOD. We have not implemented device enumeration and selection on Android, so you cannot see a list of attached device and choose the desired one like you can on Desktop platforms.

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [September 27, 2021, 3:51am UTC](https://qa.fmod.com/t/audio-interface-support-on-android/17711/4 "2021-09-27T03:51:01Z")

</div>

So what you mean is, as long as their Audio Interface is class-compliant and their Android device can see and support it, is it safe to say any apps using the FMOD Core API always support it?

Also, I wonder what would happen when a user pulls out their Audio Interface at runtime (while the FMOD API is working).  
No issue at all just like when a user plugs in/out their headphone?

PS. Sorry but I’m a bit confused now.  
Our app manually selects FMOD\_OUTPUTTYPE\_AAUDIO  
or FMOD\_OUTPUTTYPE\_OPENSL according to the user settings instead of the default FMOD\_OUTPUTTYPE\_AUTODETECT.  
Will this prevent Audio Interfaces from working?

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [September 27, 2021, 4:19am UTC](https://qa.fmod.com/t/audio-interface-support-on-android/17711/5 "2021-09-27T04:19:28Z")

</div>

By the way, the first video wasn’t it.  
You should watch the third one.  
The first one, I think, is about adding another input/output to the device just like plugging a USB-C type headphone.

Update:  
I just learned about USB Mixer from [here](https://www.youtube.com/watch?v=PwK3Ydi-8FA) which I didn’t know existed.  
I don’t know what our customers exactly wanted, but my question is, do the FMOD support both on Android?

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [September 27, 2021, 5:59am UTC](https://qa.fmod.com/t/audio-interface-support-on-android/17711/6 "2021-09-27T05:59:05Z")

</div>

Firstly, to clarify there are two categories of thing we are discussing, output plugins (Audio Track, OpenSL, AAudio) and output devices (on Windows this would be speakers, headset, built-in, hdmi, etc). For Android we support three different output plugins, representing the evolution of Android audio APIs, each has different requirements, the auto detect mode tries to select the best for your device. For all three of our output plugins on Android, FMOD will always output to the default virtual device. For Android, this is something the system usually manages, so usually output to speaker, headphone (when you plug them in), bluetooth speaker (when you pair it). These route changes to different devices is an Android system feature, we still output to “default”, the system routes as needed. So provided the system recognizes the attached audio device and re-routes audio accordingly, FMOD will output to that device.

Specifically, we haven’t tested the devices you have listed, so we cannot confirm what their behavior will be. Also, considering this is Android, different manufacturers of phone may have different behavior.

Regarding your question about what happens when unplugged, FMOD will detect a device failure (due to disconnect) and it will reset the audio automatically. So if the system re-routes audio from the now unplugged device to the system speakers, FMOD audio should follow to the speakers.

---

<div class="post-metadata">

**Author:** ![jiyongman](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jiyongman](https://qa.fmod.com/u/jiyongman)\
**Post date:** [September 27, 2021, 10:13am UTC](https://qa.fmod.com/t/audio-interface-support-on-android/17711/7 "2021-09-27T10:13:04Z")

</div>

This is really informative and helpful. Thank you very much!
