Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 14 Aug 2018, 21:53
All times are UTC - 4
 Forum index » Advanced Topics » Hardware » Audio
How to get volume-settings stored.
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
Spielmops

Joined: 12 Dec 2017
Posts: 27

PostPosted: Thu 14 Dec 2017, 12:46    Post subject:  How to get volume-settings stored.
Subject description: If your volume-setting are gone with the nest startup: read this
 

Create a new file
Code:
/etc/init.d/rc.local

with this content:
Code:
#!/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
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 1231
Location: Green Island baby!

PostPosted: Thu 14 Dec 2017, 20:38    Post subject:  

Perhaps a note might explain how this works or should

Quote:
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'.
Back to top
View user's profile Send private message Yahoo Messenger 
rufwoof

Joined: 24 Feb 2014
Posts: 2431

PostPosted: Fri 15 Dec 2017, 02:48    Post subject:  

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:
#!/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:
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.
Back to top
View user's profile Send private message 
Spielmops

Joined: 12 Dec 2017
Posts: 27

PostPosted: Fri 15 Dec 2017, 05:27    Post subject:  

@rufwoof: yes, very good: Why should I do this easy, if there is a much more complicated solution ....

Spielmops
Back to top
View user's profile Send private message 
nic007


Joined: 13 Nov 2011
Posts: 2550
Location: Cradle of Humankind

PostPosted: Fri 15 Dec 2017, 08:02    Post subject:  

Depends how you run Puppy. If frugal with savefile/folder, it will be saved automatically. Anyways the command:
Code:
alsactl store
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/viewtopic.php?p=958779#958779)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Hardware » Audio
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0401s ][ Queries: 13 (0.0054s) ][ GZIP on ]