14
0
Alexei Sorokin
2021-11-08 15:53:15 +00:00
committed by Git OBS Bridge
parent bb57b1088e
commit 7ffc266600
5 changed files with 138 additions and 93 deletions

View File

@@ -1,11 +0,0 @@
--- a/bin/pulseaudio-equalizer.in
+++ b/bin/pulseaudio-equalizer.in
@@ -403,7 +403,7 @@ if [ "$1" = 'enable' ]; then
# Load LADSPA sink module
echo 'Loading module-ladspa-sink...'
- echo >>/tmp/eqcommands.sh "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS"
+ echo >>/tmp/eqcommands.sh "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK sink_master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS"
# Transfer current sink mute/volume to LADSPA sink
echo "Transferring current mute ($PA_CURRENT_MUTE) & volume ($PA_CURRENT_VOLUME%) to LADSPA sink ($PA_LADSPA_SINK)..."

View File

@@ -4,80 +4,7 @@
PA_PREAMP='1.0'
PA_CURRENT_PRESET=''
+LC_MESSAGES=C
+export LC_MESSAGES=C
if [ -z "$XDG_CONFIG_HOME" ]; then
CONFIG_DIR="$HOME"/.config/pulse
else
@@ -110,20 +111,20 @@ fi
# Get sink names and volumes
PA_LADSPA_SINK="ladspa_output.$PA_LADSPA_PLUGIN.$PA_LADSPA_LABEL"
-PA_CURRENT_SINK=$(pacmd stat | grep --color=never 'Default sink name' | sed 's/Default sink name: //g')
-PA_CURRENT_VOLUME=$(pacmd list | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'volume: ' | grep --color=never -Po '(\d+)%' | awk 'NR==1{sub(/%/,"",$1); print $1}')
+PA_CURRENT_SINK="$(pacmd stat | sed -e '/Default sink name/!d;s/Default sink name: //g')"
+PA_CURRENT_VOLUME="$(pacmd list | iconv -c -t ascii | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'volume: ' | grep --color=never -Po '(\d+)%' | awk 'NR==1{sub(/%/,"",$1); print $1}')"
PA_REAL_VOLUME=$((PA_CURRENT_VOLUME*65536/100))
PA_REAL_PREAMP_FLOAT=$(echo "$PA_PREAMP*65536" | bc)
PA_REAL_PREAMP=${PA_REAL_PREAMP_FLOAT/\.*}
-PA_CURRENT_MUTE=$(pacmd list-sinks | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep -m1 'muted: ' | sed 's/[\t]muted: no/0/g' | sed 's/[\t]muted: yes/1/g')
+PA_CURRENT_MUTE="$(pacmd list-sinks | iconv -c -t ascii | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep -m1 'muted: ' | sed -e 's/[\t]muted: no/0/g;s/[\t]muted: yes/1/g')"
# Check if equalizer is running and get accurate master sink name
if [ "$PA_CURRENT_SINK" = "$PA_LADSPA_SINK" ]; then
PA_EQUALIZER_STATUS=1
- PA_MASTER_SINK=$(pacmd info | grep --color=never -A30 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'device.master_device = ' | sed 's/device.master_device = //g' | sed 's/"//g' | sed 's/^[ \t]*//')
+ PA_MASTER_SINK="$(pacmd info | iconv -c -t ascii | grep --color=never -A30 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'device.master_device = ' | sed -e 's/device.master_device = //g;s/"//g;s/^[ \t]*//')"
else
PA_EQUALIZER_STATUS=0
- PA_MASTER_SINK=$(pacmd stat | grep --color=never 'Default sink name' | sed 's/Default sink name: //g')
+ PA_MASTER_SINK="$(pacmd stat | sed -e '/Default sink name/!d;s/Default sink name: //g')"
fi
# Check if equalizer is set as persistent
@@ -368,16 +369,16 @@ if [ "$1" = 'disable' ] || [ "$1" = 'ena
# Unload & reload stream-restore module
echo 'Unloading & reloading stream-restore module...'
- echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: <module-stream-restore>' | grep ' index: ' | sed 's/ index: //g')"
+ echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | iconv -c -t ascii | grep -B1 -m1 'name: <module-stream-restore>' | sed -e '/ index: /!d;s/ index: //g')"
echo >>/tmp/eqcommands.sh 'load-module module-stream-restore'
# Unload LADSPA sink module (if it is already loaded)
echo 'Unloading module-ladspa-sink...'
- echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: <module-ladspa-sink>' | grep ' index: ' | sed 's/ index: //g')"
+ echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | iconv -c -t ascii | grep -B1 -m1 'name: <module-ladspa-sink>' | sed -e '/ index: /!d;s/ index: //g')"
# Move active client sinks to ALSA sink
echo "Moving active PulseAudio clients to ALSA sink ($PA_MASTER_SINK)..."
- echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | grep 'index: ' | sed 's/ index: /move-sink-input /g' | sed "s/$/ $PA_MASTER_SINK/g")"
+ echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | iconv -c -t ascii | sed -e '/index: /!d;s/ index: /move-sink-input /g;s/$/ $PA_MASTER_SINK/g')"
# Transfer current mute/sink volume to ALSA sink
echo "Transferring current mute ($PA_CURRENT_MUTE) & volume ($PA_CURRENT_VOLUME%) to ALSA sink ($PA_MASTER_SINK)..."
@@ -397,7 +398,7 @@ if [ "$1" = 'enable' ]; then
# Unload & reload stream-restore module with restore_device option disabled (to ensure that previously cached per-client sinks are not used)
echo 'Unloading & reloading stream-restore module...'
- echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: <module-stream-restore>' | grep ' index: ' | sed 's/ index: //g')"
+ echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | iconv -c -t ascii | grep -B1 -m1 'name: <module-stream-restore>' | sed -e '/ index: /!d;s/ index: //g')"
echo >>/tmp/eqcommands.sh 'load-module module-stream-restore restore_device=false'
# Load LADSPA sink module
@@ -420,7 +421,7 @@ if [ "$1" = 'enable' ]; then
# Move currently active client sinks to LADSPA sink
echo "Moving active PulseAudio clients to LADSPA sink ($PA_LADSPA_SINK)..."
- echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | grep 'index: ' | sed 's/ index: /move-sink-input /g' | sed "s/$/ $PA_LADSPA_SINK/g")"
+ echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | iconv -c -t ascii | sed -e '/index: /!d;s/ index: /move-sink-input /g' | sed 's/$/ $PA_LADSPA_SINK/g')"
# Execute all queued commands (for potential speed benefit)...
pacmd </tmp/eqcommands.sh >/dev/null
@@ -454,7 +455,7 @@ if [ "$1" = 'status' ]; then
fi
# Refresh current sink status and display equalizer information
-PA_CURRENT_SINK="$(pacmd stat | grep "Default sink name" | sed 's/Default sink name: //g')"
+PA_CURRENT_SINK="$(pacmd stat | sed -e '/Default sink name/!d;s/Default sink name: //g')"
if [ "$PA_CURRENT_SINK" = "$PA_LADSPA_SINK" ]; then
echo '-------------------------------------'
echo 'Equalizer status: [enabled]'

View File

@@ -0,0 +1,127 @@
--- a/bin/pulseaudio-equalizer.in
+++ b/bin/pulseaudio-equalizer.in
@@ -111,20 +111,20 @@ fi
# Get sink names and volumes
PA_LADSPA_SINK="ladspa_output.$PA_LADSPA_PLUGIN.$PA_LADSPA_LABEL"
-PA_CURRENT_SINK=$(pacmd stat | grep --color=never 'Default sink name' | sed 's/Default sink name: //g')
-PA_CURRENT_VOLUME=$(pacmd list | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'volume: ' | grep --color=never -Po '(\d+)%' | awk 'NR==1{sub(/%/,"",$1); print $1}')
+PA_CURRENT_SINK="$(pactl get-default-sink)"
+PA_CURRENT_VOLUME="$(pactl get-sink-volume "$PA_CURRENT_SINK" | grep --color=never -Eo '([[:digit:]]+)%' | awk 'NR==1{sub(/%/,"",$1); print $1}')"
PA_REAL_VOLUME=$((PA_CURRENT_VOLUME*65536/100))
PA_REAL_PREAMP_FLOAT=$(echo "$PA_PREAMP*65536" | bc)
PA_REAL_PREAMP=${PA_REAL_PREAMP_FLOAT/\.*}
-PA_CURRENT_MUTE=$(pacmd list-sinks | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep -m1 'muted: ' | sed 's/[\t]muted: no/0/g' | sed 's/[\t]muted: yes/1/g')
+PA_CURRENT_MUTE="$(pactl get-sink-mute "$PA_CURRENT_SINK" | sed -e 's/Mute: no/0/g;s/Mute: yes/1/g')"
# Check if equalizer is running and get accurate master sink name
if [ "$PA_CURRENT_SINK" = "$PA_LADSPA_SINK" ]; then
PA_EQUALIZER_STATUS=1
- PA_MASTER_SINK=$(pacmd info | grep --color=never -A30 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'device.master_device = ' | sed 's/device.master_device = //g' | sed 's/"//g' | sed 's/^[ \t]*//')
+ PA_MASTER_SINK="$(pactl list short modules | grep --color=never "module-ladspa-sink.*sink_name=$PA_CURRENT_SINK" | tr ' ' '\n' | sed '/^sink_master/!d;s/^sink_master=//')"
else
PA_EQUALIZER_STATUS=0
- PA_MASTER_SINK=$(pacmd stat | grep --color=never 'Default sink name' | sed 's/Default sink name: //g')
+ PA_MASTER_SINK="$(pactl get-default-sink)"
fi
# Check if equalizer is set as persistent
@@ -365,66 +365,62 @@ if [ "$1" = 'disable' ] || [ "$1" = 'ena
echo '-------------------------------------'
echo 'Current operation: disabling equalizer'
echo '-------------------------------------'
- echo -n >/tmp/eqcommands.sh
# Unload & reload stream-restore module
echo 'Unloading & reloading stream-restore module...'
- echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: <module-stream-restore>' | grep ' index: ' | sed 's/ index: //g')"
- echo >>/tmp/eqcommands.sh 'load-module module-stream-restore'
-
- # Unload LADSPA sink module (if it is already loaded)
- echo 'Unloading module-ladspa-sink...'
- echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: <module-ladspa-sink>' | grep ' index: ' | sed 's/ index: //g')"
+ pactl unload-module module-stream-restore
+ pactl load-module module-stream-restore >/dev/null
# Move active client sinks to ALSA sink
echo "Moving active PulseAudio clients to ALSA sink ($PA_MASTER_SINK)..."
- echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | grep 'index: ' | sed 's/ index: /move-sink-input /g' | sed "s/$/ $PA_MASTER_SINK/g")"
+ pactl list short sink-inputs | awk '{print $1}' | while read -r INPUT; do
+ pactl move-sink-input "$INPUT" "$PA_MASTER_SINK"
+ done
+
+ # Unload LADSPA sink module (if it is already loaded)
+ echo 'Unloading module-ladspa-sink...'
+ pactl unload-module module-ladspa-sink
# Transfer current mute/sink volume to ALSA sink
echo "Transferring current mute ($PA_CURRENT_MUTE) & volume ($PA_CURRENT_VOLUME%) to ALSA sink ($PA_MASTER_SINK)..."
- echo >>/tmp/eqcommands.sh "set-default-sink $PA_MASTER_SINK"
- echo >>/tmp/eqcommands.sh "set-sink-volume $PA_MASTER_SINK $PA_REAL_VOLUME"
- echo >>/tmp/eqcommands.sh "set-sink-mute $PA_MASTER_SINK $PA_CURRENT_MUTE"
-
- # Execute all queued commands (for potential speed benefit)...
- pacmd </tmp/eqcommands.sh >/dev/null
+ pactl set-default-sink "$PA_MASTER_SINK"
+ pactl set-sink-volume "$PA_MASTER_SINK" "$PA_REAL_VOLUME"
+ pactl set-sink-mute "$PA_MASTER_SINK" "$PA_CURRENT_MUTE"
fi
if [ "$1" = 'enable' ]; then
echo '-------------------------------------'
echo 'Current operation: enabling equalizer'
echo '-------------------------------------'
- echo -n >/tmp/eqcommands.sh
# Unload & reload stream-restore module with restore_device option disabled (to ensure that previously cached per-client sinks are not used)
echo 'Unloading & reloading stream-restore module...'
- echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: <module-stream-restore>' | grep ' index: ' | sed 's/ index: //g')"
- echo >>/tmp/eqcommands.sh 'load-module module-stream-restore restore_device=false'
+ pactl unload-module module-stream-restore
+ pactl load-module module-stream-restore restore_device=false >/dev/null
# Load LADSPA sink module
echo 'Loading module-ladspa-sink...'
- echo >>/tmp/eqcommands.sh "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS"
+ pactl load-module module-ladspa-sink "sink_name=$PA_LADSPA_SINK" "sink_master=$PA_MASTER_SINK" "plugin=$PA_LADSPA_PLUGIN" "label=$PA_LADSPA_LABEL" "control=$PA_LADSPA_CONTROLS" >/dev/null
# Transfer current sink mute/volume to LADSPA sink
echo "Transferring current mute ($PA_CURRENT_MUTE) & volume ($PA_CURRENT_VOLUME%) to LADSPA sink ($PA_LADSPA_SINK)..."
- echo >>/tmp/eqcommands.sh "set-sink-volume $PA_LADSPA_SINK $PA_REAL_VOLUME"
- echo >>/tmp/eqcommands.sh "set-sink-mute $PA_LADSPA_SINK $PA_CURRENT_MUTE"
+ pactl set-sink-volume "$PA_LADSPA_SINK" "$PA_REAL_VOLUME"
+ pactl set-sink-mute "$PA_LADSPA_SINK" "$PA_CURRENT_MUTE"
# Unmute & set preamp level on ALSA sink (as LADSPA sink will act as primary volume control)
echo "Setting ALSA sink ($PA_MASTER_SINK) preamp (${PA_PREAMP}x)..."
- #echo >>/tmp/eqcommands.sh "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP"
- echo >>/tmp/eqcommands.sh "set-sink-mute $PA_MASTER_SINK 0"
+ #pactl set-sink-volume "$PA_MASTER_SINK" "$PA_REAL_PREAMP"
+ pactl set-sink-mute "$PA_MASTER_SINK" 0
# Set the LADSPA sink as the default
echo "Setting LADSPA sink ($PA_LADSPA_SINK) as default sink..."
- echo >>/tmp/eqcommands.sh "set-default-sink $PA_LADSPA_SINK"
+ pactl set-default-sink "$PA_LADSPA_SINK"
# Move currently active client sinks to LADSPA sink
echo "Moving active PulseAudio clients to LADSPA sink ($PA_LADSPA_SINK)..."
- echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | grep 'index: ' | sed 's/ index: /move-sink-input /g' | sed "s/$/ $PA_LADSPA_SINK/g")"
-
- # Execute all queued commands (for potential speed benefit)...
- pacmd </tmp/eqcommands.sh >/dev/null
+ pactl list short sink-inputs | awk '{print $1}' | while read -r INPUT; do
+ pactl move-sink-input "$INPUT" "$PA_LADSPA_SINK"
+ done
fi
if [ -z "$1" ] || [ "$1" = '' ] || [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
@@ -455,7 +451,7 @@ if [ "$1" = 'status' ]; then
fi
# Refresh current sink status and display equalizer information
-PA_CURRENT_SINK="$(pacmd stat | grep "Default sink name" | sed 's/Default sink name: //g')"
+PA_CURRENT_SINK="$(pactl get-default-sink)"
if [ "$PA_CURRENT_SINK" = "$PA_LADSPA_SINK" ]; then
echo '-------------------------------------'
echo 'Equalizer status: [enabled]'

View File

@@ -11,10 +11,13 @@ Sat Nov 6 19:51:16 UTC 2021 - Alexei Sorokin <sor.alexei@meowr.ru>
upstream.
- Replace 0006-fix-desktop.patch with %suse_update_desktop_file,
the icon change has been done upstream.
- Rebase and rename 0008-fix-locale-issues.patch to
pulseaudio-equalizer-fix-locale-issues.patch
- Add pulseaudio-equalizer-fix-deprecated-argument.patch:
Fix use of a deprecated module argument.
- Simplify and rename 0008-fix-locale-issues.patch to
pulseaudio-equalizer-fix-locale-issues.patch: iconv does not
appear to be necessary.
- Add pulseaudio-equalizer-use-pactl.patch: Use pactl instead of
pacmd for compatibility with other PulseAudio daemon
implementations.
- Require pulseaudio-daemon instead of pulseaudio.
-------------------------------------------------------------------
Sun Feb 25 18:16:05 UTC 2018 - sor.alexei@meowr.ru

View File

@@ -26,16 +26,15 @@ URL: https://github.com/pulseaudio-equalizer-ladspa/equalizer
Source: https://github.com/pulseaudio-equalizer-ladspa/equalizer/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE pulseaudio-equalizer-fix-locale-issues.patch sor.alexei@meowr.ru -- Fix issues on non-Latin systems.
Patch0: pulseaudio-equalizer-fix-locale-issues.patch
# PATCH-FIX-OPENSUSE pulseaudio-equalizer-fix-deprecated-argument.patch sor.alexei@meowr.ru -- Fix use of a deprecated module argument.
Patch1: pulseaudio-equalizer-fix-deprecated-argument.patch
# PATCH-FIX-OPENSUSE pulseaudio-equalizer-use-pactl.patch sor.alexei@meowr.ru -- Use pactl instead of pacmd.
Patch1: pulseaudio-equalizer-use-pactl.patch
BuildRequires: gobject-introspection-devel
BuildRequires: meson
BuildRequires: python3
BuildRequires: update-desktop-files
Requires: bc
Requires: ladspa-swh-plugins
# No support for pipewire-pulseaudio
Requires: pulseaudio
Requires: pulseaudio-daemon
Requires: pulseaudio-utils
Requires: python3-gobject
Requires: python3-gobject-Gdk