View Single Post
  #3   (View Single Post)  
Old 2nd December 2022
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,503
Default

Thanks. When I stepped through it last night, awk would pull the value but I'm not sure the numeric manipulations were working fully. x11/yad would display a volume level and the slider would be set to "0" even though music was audible. Using the slider would adjust volume.

Code:
#!/bin/sh
sndio_value=$(sndioctl output.level | awk -F'=' '{print $2}')
sndio_value=`printf "%.2f\n" $sndio_value`
# adjust VALUE to 0 to 100 with rounded values
yad_value=$(echo $sndio_value*100 | bc)
yad_value=$(printf "%.2f\n" "$yad_value")
# Feed yad_value to yad scale and output to sndioctl
yad --scale --page=2 --window-icon=audio-volume-medium --title="Volume" \
--vertical --on-top --width=32 --height=200 --posx=-174 \
--posy=49 --value=$yad_value \
--no-buttons --close-on-unfocus --undecorated \
--print-partial | while read x ; \
do x=$(echo "scale=2 ; $x/100" | bc)
sndioctl output.level=$x 1>/dev/null ; \
done
The above works. Would using expr(1) in lieu of "| bc" be cleaner?

Last edited by shep; 4th December 2022 at 10:52 PM. Reason: Lower case for script variables to distinguish from SYSTEM_VARIABLES
Reply With Quote