#!/bin/bash { #//////////////////////////////////// # DietPi JustBoom # #//////////////////////////////////// # Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com # #//////////////////////////////////// # # Info: # - Tweak your high-end JustBoom soundcard # Usage: # - /DietPi/dietpi/misc/dietpi-justboom #//////////////////////////////////// #Import DietPi-Globals --------------------------------------------------------------- . /DietPi/dietpi/func/dietpi-globals G_CHECK_ROOT_USER G_CHECK_ROOTFS_RW export G_PROGRAM_NAME='DietPi-Justboom' #Import DietPi-Globals --------------------------------------------------------------- #///////////////////////////////////////////////////////////////////////////////////// #Globals #///////////////////////////////////////////////////////////////////////////////////// EQ_ENABLED=0 SOUNDCARD_CURRENT=0 SOUNDCARD_CARD_INDEX=0 if [ -f /etc/asound.conf ]; then SOUNDCARD_CARD_INDEX=$(cat /etc/asound.conf | grep -m1 'card ' | awk '{print $2}') fi # - MPD OUTPUT_FREQ_CURRENT=0 OUTPUT_FREQ_TARGET=0 OUTPUT_BITRATE_CURRENT=0 OUTPUT_BITRATE_TARGET=0 SOXR_ENABLED=0 SOXR_QUALITY=0 MPD_AUDIO_BUFFER_SIZE=0 FP_MPD_CONF='/etc/mpd.conf' MPD_INSTALLED=0 if [ -f "$FP_MPD_CONF" ]; then MPD_INSTALLED=1 fi # - CAVA CAVA_ENABLED=1 CAVA_FRAMERATE=0 CAVA_COLOUR_FG=0 CAVA_COLOUR_BG=0 CAVA_BAR_GRAVITY=0 CAVA_BAR_WIDTH=0 CAVA_MAINSCREENINUSE_DISPLAYED=0 FP_CAVA_CONF="$HOME/.config/cava/config" CAVA_INSTALLED=0 if [ -f "$FP_CAVA_CONF" ]; then CAVA_INSTALLED=1 fi Reset_Globals(){ #ALSA EQ levels rm "$HOME"/.alsaequal.bin &> /dev/null #MPD OUTPUT_FREQ_TARGET=44100 OUTPUT_BITRATE_TARGET=16 SOXR_ENABLED=0 SOXR_QUALITY='very high' EQ_ENABLED=0 MPD_AUDIO_BUFFER_SIZE=2048 # - Reset CAVA config cp /DietPi/dietpi/conf/cava.conf "$HOME"/.config/cava/config CAVA_ENABLED=1 CAVA_FRAMERATE=30 CAVA_COLOUR_FG='green' CAVA_COLOUR_BG='black' CAVA_BAR_GRAVITY='1.75' CAVA_BAR_WIDTH=2 # - Save changes Write_Apply_Globals } Read_Globals(){ SOUNDCARD_CURRENT=$(cat /DietPi/dietpi.txt | grep -m1 'CONFIG_SOUNDCARD=' | sed 's/.*=//') EQ_ENABLED=$(cat /etc/asound.conf | grep -ci -m1 '^pcm.plugequal') #MPD specific if (( $MPD_INSTALLED )); then OUTPUT_FREQ_CURRENT=$(cat $FP_MPD_CONF | grep -m1 '^format' | sed 's/\"//g' | sed 's/:/ /g' | awk '{print $2}') OUTPUT_FREQ_TARGET=$OUTPUT_FREQ_CURRENT OUTPUT_BITRATE_CURRENT=$(cat $FP_MPD_CONF | grep -m1 '^format' | sed 's/\"//g' | sed 's/:/ /g' | awk '{print $3}') OUTPUT_BITRATE_TARGET=$OUTPUT_BITRATE_CURRENT SOXR_ENABLED=$(cat $FP_MPD_CONF | grep -ci -m1 '^samplerate_converter \"soxr') SOXR_QUALITY=$(cat $FP_MPD_CONF | grep -m1 'samplerate_converter \"soxr' | sed 's/\"//g' | awk '{for(i=3;i<=NF;i++){printf "%s ", $i}; printf "\n"}' | sed 's/ *$//') MPD_AUDIO_BUFFER_SIZE=$(cat $FP_MPD_CONF | grep -m1 '^audio_buffer_size' | awk '{print $2}' | sed 's/\"//g') fi #CAVA specific if (( $CAVA_INSTALLED )); then CAVA_FRAMERATE=$(cat "$FP_CAVA_CONF" | grep -m1 '^framerate =' | awk '{print $3}') CAVA_COLOUR_BG=$(cat "$FP_CAVA_CONF" | grep -m1 '^background =' | awk '{print $3}') CAVA_COLOUR_FG=$(cat "$FP_CAVA_CONF" | grep -m1 '^foreground =' | awk '{print $3}') CAVA_BAR_GRAVITY=$(cat "$FP_CAVA_CONF" | grep -m1 '^gravity =' | awk '{print $3}') CAVA_BAR_WIDTH=$(cat "$FP_CAVA_CONF" | grep -m1 '^bar_width =' | awk '{print $3}') fi } Write_Apply_Globals(){ if (( $EQ_ENABLED )); then /DietPi/dietpi/func/dietpi-set_hardware soundcard "$SOUNDCARD_CURRENT"-eq else /DietPi/dietpi/func/dietpi-set_hardware soundcard "$SOUNDCARD_CURRENT" fi #MPD specific if (( $MPD_INSTALLED )); then # - Output freq/bit sed -i "/^format \"/c\format \"$OUTPUT_FREQ_TARGET:$OUTPUT_BITRATE_TARGET:2\"" "$FP_MPD_CONF" if (( $SOXR_ENABLED )); then sed -i "/samplerate_converter \"/c\samplerate_converter \"soxr $SOXR_QUALITY\"" "$FP_MPD_CONF" sed -i "/audio_output_format \"/c\audio_output_format \"$OUTPUT_FREQ_TARGET:$OUTPUT_BITRATE_TARGET:2\"" "$FP_MPD_CONF" else sed -i "/samplerate_converter \"/c\#samplerate_converter \"soxr $SOXR_QUALITY\"" "$FP_MPD_CONF" sed -i "/audio_output_format \"/c\#audio_output_format \"$OUTPUT_FREQ_TARGET:$OUTPUT_BITRATE_TARGET:2\"" "$FP_MPD_CONF" fi # - Buffer sed -i "/^audio_buffer_size \"/c\audio_buffer_size \"$MPD_AUDIO_BUFFER_SIZE\"" "$FP_MPD_CONF" systemctl restart mpd fi #CAVA specific if (( $CAVA_INSTALLED )); then sed -i "/^framerate =/c\framerate = $CAVA_FRAMERATE" "$FP_CAVA_CONF" sed -i "/^background =/c\background = $CAVA_COLOUR_BG" "$FP_CAVA_CONF" sed -i "/^foreground =/c\foreground = $CAVA_COLOUR_FG" "$FP_CAVA_CONF" sed -i "/^gravity =/c\gravity = $CAVA_BAR_GRAVITY" "$FP_CAVA_CONF" sed -i "/^bar_width =/c\bar_width = $CAVA_BAR_WIDTH" "$FP_CAVA_CONF" Cava_Start fi Read_Globals } Cava_Start(){ killall -w cava &> /dev/null # - Running on current screen if (( $CAVA_ENABLED )); then if [ "$(tty)" = "/dev/tty1" ]; then # - display this warning once only if (( ! $CAVA_MAINSCREENINUSE_DISPLAYED )); then whiptail --title "Main screen in use" --msgbox "To launch CAVA on the main screen, please exit $PROGRAM_NAME and run the following command:\n - cava\n\nNB: Press CTRL+C to exit cava." 12 60 CAVA_MAINSCREENINUSE_DISPLAYED=1 fi else setterm -blank 0 -powersave off <> /dev/fb2 >&0 2>&1 #Odroid 3.5 inch cava <> /dev/console >&0 2>&1 & fi fi } #///////////////////////////////////////////////////////////////////////////////////// # Whip #///////////////////////////////////////////////////////////////////////////////////// PROGRAM_NAME="DietPi-JustBoom" WHIP_QUESTION=0 WHIP_TITLE=0 CHOICE=0 TARGETMENUID=0 LAST_SELECTED_NAME=0 Menu_Exit(){ whiptail --title "Exit $PROGRAM_NAME?" --yesno "Exit $PROGRAM_NAME?" --backtitle "$PROGRAM_NAME" --yes-button "Ok" --no-button "Back" --defaultno 9 55 CHOICE=$? if (( $CHOICE == 0 )); then #exit TARGETMENUID=-1 else #Return to Main Menu TARGETMENUID=0 fi } #TARGETMENUID=0 Menu_Main(){ Read_Globals local eq_enabled_text='Disabled' if (( $EQ_ENABLED )); then eq_enabled_text='Enabled' fi local soxr_enabled_text='Disabled' if (( $SOXR_ENABLED )); then soxr_enabled_text='Enabled' fi local whiptail_menu_array=() whiptail_menu_array+=("" "──── Global Options ──────────────────────────") whiptail_menu_array+=("ALSA Mixer" ": Launches ALSA Mixer, tweak sound card settings") whiptail_menu_array+=("ALSA Output Info" ": View info on current ALSA playback stream") whiptail_menu_array+=("EQ Enable" ": $eq_enabled_text | Select to toggle EQ") if (( $EQ_ENABLED )); then whiptail_menu_array+=("EQ Configure" ": Launches AlsaMixer to configure EQ settings") fi whiptail_menu_array+=("Reset" ": Reset all options to defaults") #Allo Piano 2.1 specials if (( $(echo -e "$SOUNDCARD_CURRENT" | grep -ci -m1 'piano-dac-plus') )); then whiptail_menu_array+=("" "──── Allo Piano 2.1 ──────────────────────────") local dsp_filter=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'DSP Program'" | grep 'Item0:' | sed 's/.*Item0: //') whiptail_menu_array+=("DSP Filter" ": $dsp_filter") local digital_volume_int=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'Digital'" | grep 'Front Left:' | awk '{print $4}') local digital_volume_db=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'Digital'" | grep 'Front Left:' | awk '{print $6}' | tr -d '\[\]') local subwoofer_mode=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'Subwoofer mode'" | grep 'Item0:' | sed 's/.*Item0: //') local subwoofer_volume_int=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'Subwoofer'" | grep 'Front Left:' | awk '{print $4}') local subwoofer_volume_db=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'Subwoofer'" | grep 'Front Left:' | awk '{print $6}' | tr -d '\[\]') local subwoofer_crossover_frequency=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'Lowpass'" | grep 'Item0:' | sed 's/.*Item0: //') local dualoutput_mode=$(amixer -c $SOUNDCARD_CARD_INDEX sget "'Dual Mode'" | grep 'Item0:' | sed 's/.*Item0: //') whiptail_menu_array+=("Master Volume" ": $digital_volume_int ($digital_volume_db)") whiptail_menu_array+=("Dual Output Mode" ": $dualoutput_mode") whiptail_menu_array+=("Subwoofer Mode" ": $subwoofer_mode") whiptail_menu_array+=("Subwoofer Volume" ": $subwoofer_volume_int ($subwoofer_volume_db)") # - only active with subwoofer 2.1+ modes if [ "$subwoofer_mode" != '2.0' ]; then whiptail_menu_array+=("Subwoofer Crossover" ": $subwoofer_crossover_frequency Hz") fi fi #MPD specific if (( $MPD_INSTALLED )); then whiptail_menu_array+=("" "──── MPD Specific ────────────────────────────") whiptail_menu_array+=("Output Frequency" ": $OUTPUT_FREQ_CURRENT Hz | Select to change") whiptail_menu_array+=("Output BitRate" ": $OUTPUT_BITRATE_CURRENT Bit | Select to change") whiptail_menu_array+=("Audio Buffer" ": $MPD_AUDIO_BUFFER_SIZE Bytes | Select to change") whiptail_menu_array+=("SOXR Enable" ": $soxr_enabled_text | Select to toggle SOXR resampling") if (( $SOXR_ENABLED )); then whiptail_menu_array+=("SOXR Quality" ": $SOXR_QUALITY | Select SOXR quality level") fi fi #CAVA specific if (( $CAVA_INSTALLED )); then whiptail_menu_array+=("" "──── CAVA Specific ───────────────────────────") whiptail_menu_array+=("Cava Start/Restart" ": Launch Cava on main screen") if (( $(ps aux | grep -ci -m1 '[c]ava') )); then whiptail_menu_array+=("Cava Stop" ": Stop Cava") fi whiptail_menu_array+=("Cava Framerate" ": $CAVA_FRAMERATE fps | Select to change") whiptail_menu_array+=("Cava FG Colour" ": $CAVA_COLOUR_FG | Select to change") whiptail_menu_array+=("Cava BG Colour" ": $CAVA_COLOUR_BG | Select to change") whiptail_menu_array+=("Cava Bar Width" ": $CAVA_BAR_WIDTH | Select to change") whiptail_menu_array+=("Cava Bar Gravity" ": $CAVA_BAR_GRAVITY | Select to change") fi WHIP_QUESTION='Tweak your High-End Audiophile JustBoom (and others) sound card:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$LAST_SELECTED_NAME" 20 75 12 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then LAST_SELECTED_NAME="$OPTION" if [ "$OPTION" = "ALSA Output Info" ]; then G_DIETPI-NOTIFY 3 DietPi-JustBoom "ALSA Output Info" local stream_result=$(cat /proc/asound/card*/pcm0p/sub0/hw_params) echo -e "$stream_result" echo -e "" if [ "$stream_result" = "closed" ]; then G_DIETPI-NOTIFY 1 "Detailed info is only available when audio is being played, play some music first!" fi G_DIETPI-NOTIFY 0 "Completed, press any key to exit...\n" read -p "Press any key to exit..." elif [ "$OPTION" = "Subwoofer Mode" ]; then local whiptail_menu_array=() whiptail_menu_array+=('2.0' ': Disables Subwoofer output') whiptail_menu_array+=('2.1' ': Enables Subwoofer output (mono)') whiptail_menu_array+=('2.2' ': Enables Subwoofer output (stereo)') WHIP_QUESTION='Please select a channel mode for Subwoofer output:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$subwoofer_mode" 13 65 3 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then amixer -c $SOUNDCARD_CARD_INDEX sset 'Subwoofer mode' $OPTION fi elif [ "$OPTION" = "Dual Output Mode" ]; then local whiptail_menu_array=() whiptail_menu_array+=('Dual-Mono' ': Enables Dual output (mono)') whiptail_menu_array+=('Dual-Stereo' ': Enables Dual output (stereo)') WHIP_QUESTION='Please select a channel mode for Subwoofer output:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$dualoutput_mode" 13 65 3 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then amixer -c $SOUNDCARD_CARD_INDEX sset 'Dual Mode' $OPTION fi elif [ "$OPTION" = "Master Volume" ]; then local whiptail_menu_array=() for ((i=206; i>=0; i--)) do if (( $i == 0 )); then whiptail_menu_array+=("$i" 'Mute') elif (( $i == 206 )); then whiptail_menu_array+=("$i" ': Max (-0.50dB)') else whiptail_menu_array+=("$i" '') fi done WHIP_QUESTION='Please select a volume level for Master output:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$digital_volume_int" 17 65 9 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then amixer -c $SOUNDCARD_CARD_INDEX sset 'Digital' ''$OPTION'' fi elif [ "$OPTION" = "Subwoofer Volume" ]; then local whiptail_menu_array=() for ((i=206; i>=0; i--)) do if (( $i == 0 )); then whiptail_menu_array+=("$i" 'Mute') elif (( $i == 206 )); then whiptail_menu_array+=("$i" ': Max (-0.50dB)') else whiptail_menu_array+=("$i" '') fi done WHIP_QUESTION='Please select a volume level for Subwoofer output:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$subwoofer_volume_int" 17 65 9 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then amixer -c $SOUNDCARD_CARD_INDEX sset 'Subwoofer' ''$OPTION'' fi elif [ "$OPTION" = "Subwoofer Crossover" ]; then local whiptail_menu_array=() whiptail_menu_array+=('60' 'Hz') whiptail_menu_array+=('70' 'Hz') whiptail_menu_array+=('80' 'Hz') whiptail_menu_array+=('90' 'Hz (Default)') whiptail_menu_array+=('100' 'Hz') whiptail_menu_array+=('110' 'Hz') whiptail_menu_array+=('120' 'Hz') whiptail_menu_array+=('130' 'Hz') whiptail_menu_array+=('140' 'Hz') whiptail_menu_array+=('150' 'Hz') whiptail_menu_array+=('160' 'Hz') whiptail_menu_array+=('170' 'Hz') whiptail_menu_array+=('180' 'Hz') whiptail_menu_array+=('190' 'Hz') whiptail_menu_array+=('200' 'Hz') WHIP_QUESTION='Please select the lowpass crossover frequency for Subwoofer:\n\nEverything below the selected freq will be output through subwoofer out, when subwoofer mode 2.1/2.2 is selected.' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$subwoofer_crossover_frequency" 19 65 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then amixer -c $SOUNDCARD_CARD_INDEX sset 'Lowpass' $OPTION fi elif [ "$OPTION" = "DSP Filter" ]; then local whiptail_menu_array=() whiptail_menu_array+=('FIR interpolation with de-emphasis' '(Default)') whiptail_menu_array+=('Low latency IIR with de-emphasis' '') whiptail_menu_array+=('High attenuation with de-emphasis' '') whiptail_menu_array+=('Fixed process flow' '') whiptail_menu_array+=('Ringing-less low latency FIR' '') WHIP_QUESTION='Please select a DSP Filter:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$dsp_filter" 14 65 5 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then amixer -c $SOUNDCARD_CARD_INDEX sset 'DSP Program' "$OPTION" fi elif [ "$OPTION" = "Cava Start/Restart" ]; then Cava_Start elif [ "$OPTION" = "Cava Stop" ]; then killall -w cava elif [ "$OPTION" = "Cava Framerate" ]; then local whiptail_menu_array=() whiptail_menu_array+=("10" ": Lowest CPU usage") whiptail_menu_array+=("20" "") whiptail_menu_array+=("30" ": Default") whiptail_menu_array+=("40" "") whiptail_menu_array+=("50" "") whiptail_menu_array+=("60" "") whiptail_menu_array+=("80" "") whiptail_menu_array+=("100" "") whiptail_menu_array+=("120" ": Highest CPU usage") WHIP_QUESTION='Please select a framerate:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$CAVA_FRAMERATE" 17 65 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then CAVA_FRAMERATE=$OPTION Write_Apply_Globals fi elif [ "$OPTION" = "Cava Bar Width" ]; then local whiptail_menu_array=() whiptail_menu_array+=("1" ": Thin (Increases total bar count)") whiptail_menu_array+=("2" ": Default") whiptail_menu_array+=("3" "") whiptail_menu_array+=("4" "") whiptail_menu_array+=("5" "") whiptail_menu_array+=("6" "") whiptail_menu_array+=("8" ": Thick (Lowers total bar count)") WHIP_QUESTION='Please select a bar width:\n - The size of the bars affects how many are displayed' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$CAVA_BAR_WIDTH" 17 65 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then CAVA_BAR_WIDTH=$OPTION Write_Apply_Globals fi elif [ "$OPTION" = "Cava FG Colour" ] || [ "$OPTION" = "Cava BG Colour" ] ; then local apply_fg_colour=0 local default_item="$CAVA_COLOUR_BG" if [ "$OPTION" = "Cava FG Colour" ]; then apply_fg_colour=1 default_item="$CAVA_COLOUR_FG" fi local whiptail_menu_array=() whiptail_menu_array+=("green" "") whiptail_menu_array+=("red" "") whiptail_menu_array+=("yellow" "") whiptail_menu_array+=("magenta" "") whiptail_menu_array+=("cyan" "") whiptail_menu_array+=("white" "") whiptail_menu_array+=("blue" "") whiptail_menu_array+=("black" "") WHIP_QUESTION='Please select a colour:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$default_item" 17 65 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then if (( $apply_fg_colour )); then CAVA_COLOUR_FG="$OPTION" else CAVA_COLOUR_BG="$OPTION" fi Write_Apply_Globals fi elif [ "$OPTION" = "Cava Bar Gravity" ]; then local whiptail_menu_array=() whiptail_menu_array+=("0.1" ": Slow drop off speed") whiptail_menu_array+=("0.25" "") whiptail_menu_array+=("0.5" "") whiptail_menu_array+=("0.75" "") whiptail_menu_array+=("1" "") whiptail_menu_array+=("1.25" "") whiptail_menu_array+=("1.5" "") whiptail_menu_array+=("1.75" ": Default") whiptail_menu_array+=("2" ": High drop off speed") WHIP_QUESTION='Please select a gravity level (drop off speed) for the bars:\n - Higher values means bars will drop faster.' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$CAVA_BAR_GRAVITY" 17 65 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then CAVA_BAR_GRAVITY=$OPTION Write_Apply_Globals fi elif [ "$OPTION" = "EQ Configure" ]; then if (( $EQ_ENABLED == 1 )); then whiptail --title "ALSA EQ" --msgbox "The ALSA EQ mixer will now be launched, when finished, press F10 or ESC to exit." 8 60 alsamixer -D eq fi elif [ "$OPTION" = "ALSA Mixer" ]; then whiptail --title "ALSA Mixer" --msgbox "ALSA Mixer will now be launched, when finished, press F10 or ESC to exit." 8 60 alsamixer elif [ "$OPTION" = "EQ Enable" ]; then ((EQ_ENABLED++)) if (( $EQ_ENABLED > 1 )); then EQ_ENABLED=0 fi Write_Apply_Globals elif [ "$OPTION" = "SOXR Enable" ]; then ((SOXR_ENABLED++)) if (( $SOXR_ENABLED > 1 )); then SOXR_ENABLED=0 fi Write_Apply_Globals elif [ "$OPTION" = "SOXR Quality" ]; then local whiptail_menu_array=() whiptail_menu_array+=("very high" ": Highest quality, highest CPU usage") whiptail_menu_array+=("high" ": Default quality, medium CPU usage") whiptail_menu_array+=("low" ": Lowest quality, minimal CPU usage") WHIP_QUESTION='Select a SOXR Quality level:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$SOXR_QUALITY" 11 70 3 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then SOXR_QUALITY=$OPTION Write_Apply_Globals fi elif [ "$OPTION" = "Audio Buffer" ]; then local whiptail_menu_array=() whiptail_menu_array+=("128" ": Lowest latency (may cause buffer under/overruns)") whiptail_menu_array+=("192" ":") whiptail_menu_array+=("256" ":") whiptail_menu_array+=("384" ":") whiptail_menu_array+=("512" ":") whiptail_menu_array+=("1024" ":") whiptail_menu_array+=("2048" ": Default") whiptail_menu_array+=("4096" ": Highest latency") WHIP_QUESTION='Select an Audio buffer size (bytes):' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$MPD_AUDIO_BUFFER_SIZE" 16 70 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then MPD_AUDIO_BUFFER_SIZE=$OPTION Write_Apply_Globals fi elif [ "$OPTION" = "Output Frequency" ]; then local whiptail_menu_array=() whiptail_menu_array+=("384000" ": 384kHz (highest quality)") whiptail_menu_array+=("352800" ": 352kHz") whiptail_menu_array+=("192000" ": 192kHz") whiptail_menu_array+=("96000" ": 96kHz") whiptail_menu_array+=("88200" ": 88.2kHz") whiptail_menu_array+=("64000" ": 64kHz") whiptail_menu_array+=("48000" ": 48kHz (HDMI standard)") whiptail_menu_array+=("44100" ": 44.1kHz (music standard)") WHIP_QUESTION='Select an Output Frequency:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$OUTPUT_FREQ_CURRENT" 16 70 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then OUTPUT_FREQ_TARGET=$OPTION Write_Apply_Globals fi elif [ "$OPTION" = "Output BitRate" ]; then local whiptail_menu_array=() whiptail_menu_array+=("32" ": (highest quality, recommended)") whiptail_menu_array+=("24" ": ") whiptail_menu_array+=("16" ": (CD audio quality)") WHIP_QUESTION='Select an Output BitRate:' OPTION=$(whiptail --title "$PROGRAM_NAME" --backtitle "$PROGRAM_NAME" --menu "$WHIP_QUESTION" --cancel-button "Exit" --default-item "$OUTPUT_BITRATE_CURRENT" 11 70 3 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? unset whiptail_menu_array if (( $CHOICE == 0 )); then OUTPUT_BITRATE_TARGET=$OPTION Write_Apply_Globals fi elif [ "$OPTION" = "Reset" ]; then Reset_Globals fi else Menu_Exit fi } #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// #----------------------------------------------------------------------------------- Read_Globals #----------------------------------------------------------------------------------- while (( $TARGETMENUID >= 0 )) do if (( $TARGETMENUID == 0 )); then Menu_Main fi done #----------------------------------------------------------------------------------- exit #----------------------------------------------------------------------------------- }