2

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");
Jarrod Dixon
  • 15,727
  • 9
  • 60
  • 72
  • If you have not done so already, you might want to ask this on a Kindle Fire development support forum: https://forums.developer.amazon.com/forums/forum.jspa?forumID=12 – CommonsWare Apr 12 '13 at 13:48
  • i've already did this, but thanks https://forums.developer.amazon.com/forums/thread.jspa?messageID=3339ഋ – Luis Rodrigues Apr 12 '13 at 18:29
  • FYI, use the [tag:kindle-fire] tag for future Kindle Fire-specific questions, as fine folk like @Offbeatmammal (who has a strangely non-mammalian avatar...) from Amazon monitor that tag and will be more likely to see your question. – CommonsWare Apr 12 '13 at 18:40
  • 1
    Thanks, i tried to use this tag but i dont have enough points :( – Luis Rodrigues Apr 12 '13 at 21:05

2 Answers2

5

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

Offbeatmammal
  • 7,970
  • 2
  • 33
  • 52
  • THANK YOU! With this solution I could find out if the option is enabled or not, but I did not understand how I can change it, there is a way to do this? – Luis Rodrigues Apr 12 '13 at 17:40
  • sorry, the question only asked about detecting it. I've not found a way to control it - I've not seen anything in the properties that corresponds to the users chosen setting that could be used to control this (the dolby.ds.state just reflects what the current state is if it's been triggered by playback). Asking the user to turn it off is probably a bad experience for them, can you use a different codec for audio you don't want processed this way? – Offbeatmammal Apr 12 '13 at 18:04
  • Sorry, I really didn't ask how to change the option, but it would help me. ;p I'm looking for a way to do this, but I will probably warn the user and ask it to disable the option, thank you again, you saved my life :) – Luis Rodrigues Apr 12 '13 at 18:13
  • This way is too hacky :) The answer below seems to be the right way to go. – avepr Nov 17 '13 at 23:09
2

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.

Eric Ang
  • 21
  • 1