Page 1 of 1
How to get volume-settings stored.
Posted: Thu 14 Dec 2017, 16:46
by Spielmops
Create a new file
with this content:
Code: Select all
#!/bin/sh
case "$1" in
start|restart)
alsactl -f /etc/asound.state restore #from /etc/asound.state.
;;
stop)
alsactl -f /etc/asound.state store #saves to /etc/asound.state.
esac
###END###
The script "10-alsa" should to this, but it seems buggy.
Spielmops
Posted: Fri 15 Dec 2017, 00:38
by april
Perhaps a note might explain how this works or should
The scripts in /etc/init.d are executed at bootup and shutdown to start and stop services.
At bootup, the /etc/rc.d/rc.services script will run all executable scripts
found in /etc/init.d, with the commandline parameter 'start'.
At shutdown, the /etc/rc.d/rc.shutdown script will run all executable scriptsfound in /etc/init.d, with the commandline parameter 'stop'.
Posted: Fri 15 Dec 2017, 06:48
by rufwoof
Another option could be to simply read or set the volume level in your own scripts
For getting and setting sound level rather than a panel volume control I create a yad (gtk look) volume slider window ... for instance in OpenBSD :
Code: Select all
#!/bin/sh
GEO="--geometry 40x204-0+64"
# retrieve current volume level
VALUE=`mixerctl outputs.master | awk 'BEGIN { FS = "," } ; { print $2 }'`
# adjust 0 to 255 scaled to 0 to 100 and rounded
VALUE=`echo $VALUE/2.55 | bc`
VALUE=`printf "%.0f\n" "$VALUE"`
yad --scale --vertical --title="Vol " $GEO --value=$VALUE --no-buttons --print-partial | while read x ; do x=`echo $x*2.55 | bc`; x=`printf "%.0f\n" "$x"`;mixerctl -q outputs.master=$x ; done
For amixer (my Debian install) that is alsa based instead of mixerctl I use
amixer get Master ... and amixer set Master .... (which IIRC uses 0% to 100% values so I revise the above script to not bother with the 0..255 ranging that mixterctl uses)
In OpenBSD when using twm window manager and in cases where I don't have yad installed I create a twm sub menu
Code: Select all
menu "Volume"
{
"Volume" f.title
" 0%" ( "#00B6FF" : "black" ) !"mixerctl -q outputs.master=0"
" 5%" ( "#00B6FF" : "black" ) !"mixerctl -q outputs.master=13"
" 10%" ( "#00B6FF" : "black" ) !"mixerctl -q outputs.master=26"
" 15%" ( "#00B6FF" : "black" ) !"mixerctl -q outputs.master=38"
" 20%" ( "#00B6FF" : "black" ) !"mixerctl -q outputs.master=51"
" 25%" ( "#00B6FF" : "black" ) !"mixerctl -q outputs.master=64"
" 30%" ( "#00B6FF" : "black" ) !"mixerctl -q outputs.master=77"
" 35%" ( "green" : "black" ) !"mixerctl -q outputs.master=89"
" 40%" ( "green" : "black" ) !"mixerctl -q outputs.master=102"
" 45%" ( "green" : "black" ) !"mixerctl -q outputs.master=115"
" 50%" ( "green" : "black" ) !"mixerctl -q outputs.master=128"
" 55%" ( "green" : "black" ) !"mixerctl -q outputs.master=140"
" 60%" ( "green" : "black" ) !"mixerctl -q outputs.master=153"
" 65%" ( "green" : "black" ) !"mixerctl -q outputs.master=166"
" 70%" ( "red" : "black" ) !"mixerctl -q outputs.master=179"
" 75%" ( "red" : "black" ) !"mixerctl -q outputs.master=191"
" 80%" ( "red" : "black" ) !"mixerctl -q outputs.master=204"
" 85%" ( "red" : "black" ) !"mixerctl -q outputs.master=217"
" 90%" ( "red" : "black" ) !"mixerctl -q outputs.master=230"
" 95%" ( "red" : "black" ) !"mixerctl -q outputs.master=242"
" 100%" ( "red" : "black" ) !"mixerctl -q outputs.master=255"
}
.... just a couple of example of how amixer or mixerctl can be used within your own script instead of having to rely upon a system script.
Posted: Fri 15 Dec 2017, 09:27
by Spielmops
@rufwoof: yes, very good: Why should I do this easy, if there is a much more complicated solution ....
Spielmops
Posted: Fri 15 Dec 2017, 12:02
by nic007
Depends how you run Puppy. If frugal with savefile/folder, it will be saved automatically. Anyways the command:
should do the necessary.
BTW - The default builtin remaster program does not save your customised volume settings so if you are going to use that, run the abovementioned command first before doing a remaster (I've included it in my remaster suite which has been published here:
http://www.murga-linux.com/puppy/viewto ... 779#958779)