adjust device volume when launching xbmc
#1
Pivos has a commit that sets the device volume to max when launching XBMC. Mainly designed for set-top-boxes where something sets the android device low and since XBMC's volume is based off the device volume, you can't hear anything and as a side effect, ac3/dts passthough would break Smile

See https://github.com/Pivosgroup/xbmc/commi...dc40e55d8d

Is this something we want in mainline ?

Reply
#2
I've received a number of requests to do something like this in the XAF builds. Is there a way to get the current volume level? If so, maybe do some magic in onPause / onResume / exit to re-set to the original value to avoid the max volume sticking outside of the XBMC environment.
Reply
#3
int volume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);

I think Smile
Reply
#4
As asked on IRC once, can't we just simply bypass volume changes in XBMC to Android? So always max XBMC and change Androids media volume instead?
Reply
#5
(2013-01-16, 16:45)da-anda Wrote: As asked on IRC once, can't we just simply bypass volume changes in XBMC to Android? So always max XBMC and change Androids media volume instead?

That would be rude and require exposing more jni in audiotrack sink. Those few line of java code expand by a factor of 10 or so. Seems to me that it is far better to keep android work arounds in the java activity where it's much easier to deal with it.
Reply
#6
(2013-01-16, 17:57)davilla Wrote:
(2013-01-16, 16:45)da-anda Wrote: As asked on IRC once, can't we just simply bypass volume changes in XBMC to Android? So always max XBMC and change Androids media volume instead?

That would be rude and require exposing more jni in audiotrack sink. Those few line of java code expand by a factor of 10 or so. Seems to me that it is far better to keep android work arounds in the java activity where it's much easier to deal with it.

Couldn't some JNI be done in XBMCApp.cpp to max / unmax the system volume levels in onPause / onActivate methods. That way the internal audio sink code isn't affected and the volume levels will be sane inside or outside of XBMC?

The only time I can see it being an issue is if XBMC crashes, it will likely leave the volume in a maximal state upon crash.
Reply
#7
(2013-01-16, 18:04)kemonine96 Wrote:
(2013-01-16, 17:57)davilla Wrote:
(2013-01-16, 16:45)da-anda Wrote: As asked on IRC once, can't we just simply bypass volume changes in XBMC to Android? So always max XBMC and change Androids media volume instead?

That would be rude and require exposing more jni in audiotrack sink. Those few line of java code expand by a factor of 10 or so. Seems to me that it is far better to keep android work arounds in the java activity where it's much easier to deal with it.
The only time I can see it being an issue is if XBMC crashes, it will likely leave the volume in a maximal state upon crash.

The same thing would be present if xbmc internally altered the device volume rather than the audiotrack volume so that issue is sort of a push Smile

Reply
#8
as long as we only change the media volume this shoudln't be an issue.
Reply
#9
(2013-01-15, 22:38)davilla Wrote: Pivos has a commit that sets the device volume to max when launching XBMC. Mainly designed for set-top-boxes where something sets the android device low and since XBMC's volume is based off the device volume, you can't hear anything and as a side effect, ac3/dts passthough would break Smile

See https://github.com/Pivosgroup/xbmc/commi...dc40e55d8d

Is this something we want in mainline ?

'Set volume to max so passthrough works' ?? I've never got passthrough to work. Wish so much it did, a mediacenter without ac3/DTS is a real shortcoming... Sad
Reply
#10
works on Pivos boxes, both ac3/dts with HD audio coming later.
Reply
#11
(2013-01-15, 22:38)davilla Wrote: Pivos has a commit that sets the device volume to max when launching XBMC. Mainly designed for set-top-boxes where something sets the android device low and since XBMC's volume is based off the device volume, you can't hear anything and as a side effect, ac3/dts passthough would break Smile

Is this something we want in mainline ?

I managed to get this working in an improved form in the mainline code. When XBMC activates it will now automatically max out the volume and when it de-activates it will restore the original value.

Pull Request: https://github.com/xbmc/xbmc/pull/2098
Feature Branch: https://github.com/mcrosson/xbmc/tree/an...ust-volume
Changelog: https://github.com/mcrosson/xbmc/compare...7781c0ec9e

Test Build: xbmcapp-armeabi-v7a-debug-auto-volume.apk

Edit 1: Updated APK with latest code that was pushed after initial build
Reply
#12
For those looking for the current state of this: there are a number of comments on the Pull Request regarding the changes and what is being done to get them accepted into upstream.
Reply
#13
Test Build 2: http://dl.dropbox.com/u/23765633/xbmcapp...volume.apk

Code used for build is in PR / branch in my previous post: http://forum.xbmc.org/showthread.php?tid...pid1306660


@Davilla: Can you try this on one of your STB's? I want to make sure STB's won't see the android volume slider.
Reply
#14
@kemonine96, works fine and I get xbmc's volume control with android steps.
Reply
#15
(2013-01-23, 20:12)davilla Wrote: @kemonine96, works fine and I get xbmc's volume control with android steps.

Perfect, if you use the same build on a touch screen device you should see the native volume slider instead of the internal XBMC one.
Reply

Logout Mark Read Team Forum Stats Members Help
adjust device volume when launching xbmc0