Skip to content

Commit 9b550eb

Browse files
1 parent 814f11e commit 9b550eb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

magiskmodule/customize.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,26 @@ else
9696
fi
9797

9898
ui_print "- Patching system audio files"
99+
osp_detect() {
100+
local file="$1"
101+
local osp=music
102+
case $file in
103+
*.conf)
104+
spaces=$(sed -n "/^output_session_processing {/,/^}/ {/^ *$osp {/p}" "$fil"e | sed -r "s/( *).*/\1/")
105+
effects=$(sed -n "/^output_session_processing {/,/^}/ {/^$spaces\$osp {/,/^$spaces}/p}" "$file" | grep -E "^$spaces +[A-Za-z]+" | sed -r "s/( *.*) .*/\1/g")
106+
for effect in ${effects}; do
107+
spaces=$(sed -n "/^effects {/,/^}/ {/^ *$effect {/p}" "$file" | sed -r "s/( *).*/\1/")
108+
sed -i "/^effects {/,/^}/ {/^$spaces$effect {/,/^$spaces}/d}" "$file"
109+
done
110+
;;
111+
*.xml)
112+
effects=$(sed -n "/^ *<postprocess>$/,/^ *<\/postprocess>$/ {/^ *<stream type=\"$osp\">$/,/^ *<\/stream>$/ {/<stream type=\"$osp\">/d; /<\/stream>/d; s/<apply effect=\"//g; s/\"\/>//g; s/ *//g; p}}" "$file")
113+
for effect in ${effects}; do
114+
sed -i "/^\( *\)<apply effect=\"$effect\"\/>/d" "$file"
115+
done
116+
;;
117+
esac
118+
}
99119
AUDIO_EFFECTS_FILES="$( \
100120
find -H \
101121
$SEARCH_ROOT/system $SEARCH_ROOT/vendor $SEARCH_ROOT/odm \
@@ -121,6 +141,7 @@ for ORIGINAL_FILE in $AUDIO_EFFECTS_FILES; do
121141
< "$ORIGINAL_FILE" > "$FILE"
122142
;;
123143
esac
144+
osp_detect "$FILE"
124145
done
125146
[ -z "$AUDIO_EFFECTS_FILES" ] && abort "Cant find any system audio configs!"
126147

0 commit comments

Comments
 (0)