From 1408a227c5ea77137374afcb905804ad579b5e00 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 23 Sep 2021 06:52:40 -0700 Subject: [PATCH] rewrite getladspa --- sh/streamcrap | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sh/streamcrap b/sh/streamcrap index 4ce4315..6603380 100644 --- a/sh/streamcrap +++ b/sh/streamcrap @@ -13,6 +13,14 @@ mpvs() { ### @- invoke mpv with some extra flags suited for streamed sources. "$@" } +getladspa() { + argc -eq 1 "$0" "$@" || return + printf '%s' volume + if [ -e "/usr/lib/ladspa/${1}.so" ]; then + printf '%s' "ladspa=f=${1}:p=${1}" + fi +} + # Q: Why are these variables prefixed with _M_? # A: I don't remember. :shobon: _M_PRE_EMPH='equalizer=f=50:g=-10:width_type=o:w=4,equalizer=f=5000:g=+5:width_type=o:w=4' @@ -25,17 +33,7 @@ _M_INSANE="$_M_PRE_EMPH,acompressor=threshold=0.001:ratio=2:attack=1000:release= _M_LESS_INSANE="$_M_PRE_EMPH,acompressor=threshold=0.0020:ratio=1.41:attack=1000:release=9000:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0028:ratio=1.41:attack=320:release=2880:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0040:ratio=1.41:attack=100:release=900:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0057:ratio=1.41:attack=32:release=288:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0080:ratio=1.41:attack=10:release=90:makeup=2.2:knee=6:mix=0.6,$_M_POST_EMPH,alimiter=level_in=2.2:level_out=0.45" _M_NEO="equalizer=700:o:1.3:-5,equalizer=1200:o:1.3:-3,equalizer=1090:o:0.5:-5,equalizer=970:o:1.2:-10,equalizer=4100:o:0.3:-6" _M_DANNY="$_M_PRE_EMPH,alimiter,dynaudnorm=f=400:g=5:p=1:m=32:r=0.1:c=1:s=9:t=0.0003,$_M_POST_EMPH,alimiter=level_in=2.6:level_out=0.91" - -getladspa() { - argc -eq 1 "$0" "$@" || return - REPLY=volume - if [ -e "/usr/lib/ladspa/${1}.so" ]; then - REPLY="ladspa=f=${1}:p=${1}" - fi -} - -getladspa crap_level -_M_LEVEL="$REPLY" +_M_LEVEL="$(getladspa crap_level)" earphones() { argc -eq 0 "$0" "$@" || return @@ -56,8 +54,7 @@ case "$(uname -n | tr A-Z a-z)" in ;; banshee) - getladspa crap_eq_const_T420 - _M_SPEAKERS="$REPLY" + _M_SPEAKERS="$(getladspa crap_eq_const_T420)" speakers() { argc -eq 0 "$0" "$@" || return _M_PROCESS="$_M_LEVEL,$_M_SPEAKERS,alimiter=level_in=0.5"