Question

I have a problem with my android app, when I run on a kindle fire 7" with Dolby active there is a flaw in the sound, but when this option is disabled the problem disappears.

I'm using MediaPlayer to play long audio files, i cannot use AudioPool because these are background sounds, i'm already using SoundPool to play effects.

There is a way to programmatically detect if Dolby system is active or not on Android application?

There is a way to make MediaPlayer accept multichannel?

Sorry for my bad english :p


I found a way to set the property "dolby.ds.state" programmatically, but this caused a BIG problem, so DON'T DO THAT!

This way is:

System.setProperty("dolby.ds.state", "off");

When I did that, the property was applied but only when rebooted the device, after it done I changed the menu option usually by the device still kept getting the value set programmatically.

If you've done the same stupid thing, I've found a way to resolve it, run the following code and reset the device:

Properties sysProps = System.getProperties();
sysProps.remove("dolby.ds.state");
System.clearProperty("dolby.ds.state");
Was it helpful?

Solution

if you do a adb shell getprop | grep dolby you'll see there is a system property dolby.ds.state that toggles between On and Off when it's active (playing audio)

To query the active status from your application this lets you query a System property (note that you'll probably have to wrap try/catch blocks round it to keep Java happy)

Class getSysProp = null;
getSysProp = Class.forName("android.os.SystemProperties");
Method method = null;
method = getSysProp.getDeclaredMethod("get", String.class);
String prop = null;
prop = (String)method.invoke(null, "dolby.ds.state");

It looks like different sorts of audio trigger the Dolby status - if you watch logcat with something like iHeartRadio playing you'll see the the Dolby setting gets bypassed for orbis so you might simply be able to change the codec you are using when you don't want it turned on.

** Edit: Update with new official Dolby API **

See http://developer.dolby.com/ for a more complete (and less hacky!) solution

OTHER TIPS

Dolby now has an official API available which I am sure will meet your needs. Make sure to check out http://developer.dolby.com

As an app developer, you can now access Dolby technologies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top