Skip to content

opendingux: rg350m: Volume control tweaks #46

@michaelshmitty

Description

@michaelshmitty

I've seen #19.

I'd like to propose some additional fixes regarding volume control because I ran into this problem and perhaps others have too:
The PCM volume control starts at 32 in alsamixer. Everything below that mutes sound. However the lowest setting here is still too loud for me when I'm using headphones. I managed to reduce the "master" volume control (called 'Headphones') and that gives me a satisfying volume. However this setting is not retained during reboot.
Using a custom build I changed the S90volume.sh to also save the state of the 'Headphones' control during reboot:

#!/bin/sh
#
# Simple script to load/store ALSA parameters (volume...)
#

VOLUME_STATEFILE=/usr/local/etc/volume.state
CONTROL=PCM
VOLUME_STATEFILE_HEADPHONES=/usr/local/etc/volume.headphones.state
CONTROL_HEADPHONES=Headphones

case "$1" in
  start)
    echo "Loading sound volume..."
    if [ -f $VOLUME_STATEFILE ]; then
      /usr/bin/amixer set $CONTROL `cat $VOLUME_STATEFILE`
    fi
    if [ -f $VOLUME_STATEFILE_HEADPHONES ]; then
      /usr/bin/amixer set $CONTROL_HEADPHONES `cat $VOLUME_STATEFILE_HEADPHONES`
    fi
    ;;
  stop)
    echo "Storing sound volume..."
    amixer get $CONTROL | sed -n 's/.*Front .*: Playback \([0-9]*\).*$/\1/p' | paste -d "," - - > $VOLUME_STATEFILE
    amixer get $CONTROL_HEADPHONES | sed -n 's/.*Front .*: Playback \([0-9]*\).*$/\1/p' | paste -d "," - - > $VOLUME_STATEFILE_HEADPHONES
    ;;
  *)
    echo "Usage: $0 {start|stop}"
    exit 1
esac

exit $?

This is just an ugly proof of concept hack to test if it worked and it did. I would propose changing the volume.state file to use a line for each control's volume settings and loop over them in the init script. Something like this:

PCM:1,1
Headphones:15,15

I would also like to add the sound mixer back into the gmenu2x settings section as it appears to be missing in the current opendingux build. It was present in my stock firmware. I have tested adding it back and it works:
I added 40_alsamixer with contents:

title=Sound Mixer
description=Configure sound settings
icon=skin:icons/alsamixer.png
exec=/usr/bin/alsamixer
consoleapp=true
editable=false

in board/opendingux/target_skeleton/usr/share/gmenu2x/sections/settings

Let me know what you think. I'll gladly open a pull request if you approve of this approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions