Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Audio output on headset & speakerphone simultaneously

Tags:

android

I'm trying to create a dual screen setup. The Android tablet (Nexus 10) is connected to another screen using HDMI.

When playing movies on the tablet (using VLC or other Apps), it will be displayed on both screens properly.
However, the Audio signal is only transferred via HDMI. Using the SOUNDAbout App we managed to have the Audio output on either headset or HDMI.

I cannot see a function to set the audio output for both devices at the same time. I tried setting it up with the Audio Manager, but it only works for one channel.

AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

am.setSpeakerphoneOn(true);
am.setWiredHeadsetOn(true);

Another thing I noticed is the setParameters API which then passes variables to the platforms Audio system. That might be ALSA, perhaps the solution is there?

like image 673
Sebastian Roth Avatar asked Dec 28 '12 04:12

Sebastian Roth


People also ask

What is headset output?

When headphones are connected to a computer (laptop, smartphone, etc.), they receive information outputted from the computer. This means headphones are output devices.

What is audio output mean?

What is an Audio Output? An audio output, or also known as audio out, drives a signal (digital or analog) into another device's audio input. They are found on audio-generating devices such as your TV or computers.


1 Answers

There's no way of doing this in a way that is guaranteed to work on all Android devices. The issue here is that the platforms generally lack any kind of HDMI+Speaker or HDMI+Headset combo device (i.e. an audio device that describes a low-level route for a single output stream to both HDMI and some other destination). Not that there necessarily are any hardware limitations, but it simply isn't a route that you'd typically want to use, and therefore it hasn't been added.

I've never come across a platform where both HDMI and wired headset would be selected for any stream type. HDMI + Speaker could be selected for the RING and ALARM stream types on some platforms, but if the platform lacks a combo device to realize that routing decision you'll still only get the audio in either HDMI or the Speaker.
Take a look at this code to see what I mean. This is what OEMs that use Qualcomm platforms heavily base their code on. And what this particular piece of code does is select a low-level output route for a particular stream. In your case it would see that HDMI (AUX_DIGITAL) is available, so it'd pick the HDMI "use case" (which corresponds to something like this) and return immediately.

like image 184
Michael Avatar answered Nov 10 '22 09:11

Michael