The power of Android HDMI audio
My ADT-1 does not play audio over HDMI when connected to a TV.
On this particular TV, I had to force HDMI audio on a PI raspberry, so I am also trying to get it to use ADT-1.
I tried to create an application with permission
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
And using an instance of AudioManager to change settings
AudioManager manager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
Log.d(TAG, "ATTACHED: " + manager.getParameters("attached_output_devices"));
Log.d(TAG, "DEFAULT: " + manager.getParameters("default_output_device"));
Log.d(TAG, "PRE: " + manager.getParameters("audio_devices_out_active"));
manager.setParameters("audio_devices_out_active=AUDIO_DEVICE_OUT_AUX_DIGITAL");
Log.d(TAG, "POST: " + manager.getParameters("audio_devices_out_active"));
but all logs are returned empty and no sound change occurs.
ATTACHED: attached_output_devices=
DEFAULT: default_output_device=
PRE: audio_devices_out_active=
POST: audio_devices_out_active=
I've read about TV Audio from TIF (TV Input Framework) and the ability to install audio patches, but I don't think this case seems to be more due to the TV only being viewed as an HDMI monitor without audio.
the file / etc / audio_policy.conf shows:
global_configuration{
attached_output_devices AUDIO_DEVICE_OUT_SPEAKER
default_output_device AUDIO_DEVICE_OUT_SPEAKER
...
}
audio_hw_modules {
outputs{
primary{
...
devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
}
Where AUDIO_DEVICE_OUT_AUX_DIGITAL is HDMI.
Any idea on how to get the ADT-1 to output audio to HDMI?
+3
source to share
1 answer
Use
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
in your manifest and
audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
audioManager.setParameters("audio_devices_out_active=AUDIO_CODEC");
// or
audioManager.setParameters("audio_devices_out_active=AUDIO_HDMI");
// or
audioManager.setParameters("audio_devices_out_active=AUDIO_HDMI,AUDIO_CODEC");
in your code to set active audio output
+1
source to share