Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
* Added disabling Dolby control support for USB DAC's on HyperOS not to reboot
* Excluded "MotorolaSettingsProvider" on Motorala devices only for avoiding their bootloop
* Changed the USB period_us from 2250 usec to 2000 usec to optimize for 48 kHz Opus tracks (recent majority)
  • Loading branch information
yzyhk904 authored Jul 28, 2024
1 parent 17759a2 commit 963ddb3
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 37 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ This module,
| External examples: | - | - | - | - |
| 100 | 29 | (91) | 109 | AK4493 (Sharp roll-off N-fold over-sampling) |
| 150 | 42 | (91) | 109 | AK4191EQ (Sharp roll-off N-fold over-sampling) |
| 120 | 35 | (97) | 110 | ESS 9038PRO (Fast roll-off N-fold over-sampling) |
| 50 ~ 118 | 34 | 96 | (398) | ESS 9039PRO (Fast roll-off N-fold over-sampling) |
| 110 | 40 | (96) | 109 | CX43131 (Fast roll-off N-fold over-sampling) |
| 120 | 35 | (97) | 110 | ES9038PRO (Fast roll-off N-fold over-sampling) |
| vary 50 ~ 118 | 34 | 96 | (398) | ES9039PRO (Fast roll-off N-fold over-sampling) |
| 110 | 40 | (96) | 109 | CS43131 (Fast roll-off N-fold over-sampling) |
| 98 | 130 | 98.5 | | MacOS Leopard (guess) |
| 159 | 240 | | 99 | iZotope, No-Alias (guess) |
| 100 | 64 | | 99 | SoX HQ linear phase (guess) |
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Change logs

# v1.3.8
* Added disabling Dolby control support for USB DAC's on HyperOS not to reboot
* Excluded "MotorolaSettingsProvider" on Motorala devices only for avoiding their bootloop
* Changed the USB period_us from 2250 usec to 2000 usec to optimize for 48 kHz Opus tracks (recent majority)

# v1.3.7
* Added "compatible Magisk-mirroring" message for incompatible Magisk variants
* Adjusted re-sampling parameters for old devices
Expand Down
45 changes: 22 additions & 23 deletions customize-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,9 @@ function replaceSystemProps_S4()
"$MODPATH/system.prop-workaround"
}

function replaceSystemProps_kona()
function replaceSystemProps_Kona()
{
if [ ! "`getprop ro.vendor.build.version.release_or_codename`" -ge "12" -a \
\( -e "${MODPATH%/*/*}/modules/usb-samplerate-unlocker" -o -e "${MODPATH%/*/*}/modules_update/usb-samplerate-unlocker" \) ]; then
if [ -e "${MODPATH%/*/*}/modules/usb-samplerate-unlocker" -o -e "${MODPATH%/*/*}/modules_update/usb-samplerate-unlocker" ]; then
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2750/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2750/' \
Expand All @@ -251,12 +250,12 @@ function replaceSystemProps_kona()

else
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop"
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop-workaround"

fi
Expand All @@ -265,12 +264,12 @@ function replaceSystemProps_kona()
function replaceSystemProps_SDM845()
{
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop"
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop-workaround"
}

Expand All @@ -283,37 +282,37 @@ function replaceSystemProps_SDM()
function replaceSystemProps_MTK_Dimensity()
{
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop"
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop-workaround"
}

function replaceSystemProps_Tensor()
{
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop"
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop-workaround"
}

function replaceSystemProps_Others()
{
if [ -e "${MODPATH%/*/*}/modules/usb-samplerate-unlocker" -o -e "${MODPATH%/*/*}/modules_update/usb-samplerate-unlocker" ]; then
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop"
sed -i \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2250/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2250/' \
-e 's/vendor\.audio\.usb\.perio=.*$/vendor\.audio\.usb\.perio=2000/' \
-e 's/vendor\.audio\.usb\.out\.period_us=.*$/vendor\.audio\.usb\.out\.period_us=2000/' \
"$MODPATH/system.prop-workaround"

loosenedMessage
Expand Down
26 changes: 21 additions & 5 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,34 @@ if ! isMagiskMountCompatible; then
Aborted by no Magisk-mirrors:
try again either
a.) with official Magisk (mounting mirrors), or
b.) after installing "Compatible Magisk-mirroring" Magisk module
b.) after installing "Compatible Magisk-mirroring" Magisk module and rebooting
***'
fi

REPLACE=""

# making patched ALSA utility and Tensor's offload libraries for "ro.audio.usb.period_us"
# Make patched ALSA utility and Tensor's offload libraries for "ro.audio.usb.period_us"
makeLibraries

# removing post-A13 (especially Tensor's) spatial audio flags in an audio configuration file for avoiding errors
# Remove post-A13 (especially Tensor's) spatial audio flags in an audio configuration file for avoiding errors
deSpatializeAudioPolicyConfig "/vendor/etc/bluetooth_audio_policy_configuration_7_0.xml"

# disabling pre-installed Moto Dolby faetures and Wellbeing for reducing very large jitter caused by them
disablePrivApps "
# Disable pre-installed Moto Dolby faetures and Wellbeing for reducing very large jitter caused by them
# Excluded "MotorolaSettingsProvider" on Motorala devices only for avoiding their bootloop
if [ "`getprop ro.product.manufacturer`" = "Motorola" ]; then
disablePrivApps "
/system_ext/priv-app/MotoDolbyDax3
/system_ext/priv-app/daxService
/system_ext/priv-app/DaxUI
/system_ext/app/MotoSignatureApp
/product/priv-app/WellbeingPrebuilt
/product/priv-app/Wellbeing
/system_ext/priv-app/WellbeingPrebuilt
/system_ext/priv-app/Wellbeing
"

else
disablePrivApps "
/system_ext/priv-app/MotoDolbyDax3
/system_ext/priv-app/MotorolaSettingsProvider
/system_ext/priv-app/daxService
Expand All @@ -34,6 +48,8 @@ disablePrivApps "
/system_ext/priv-app/Wellbeing
"

fi

if "$IS64BIT"; then
board="`getprop ro.board.platform`"
case "$board" in
Expand Down
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=audio-misc-settings
name=Audio misc. settings
version=v1.3.7
versionCode=1307
version=v1.3.8
versionCode=1308
author=zyhk
description=Setting audio misc. configuration values (e.g. 100 volume steps, raising the resampling quality, disabling the effects framework, etc.)
15 changes: 15 additions & 0 deletions service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ function additionalSettings()
fi

fi

# Force disabling spatializer if OS reverted the spatializer setting during the booting process
if [ "`getprop ro.audio.spatializer_enabled`" = "true" ]; then
resetprop_command="`which_resetprop_command`"
if [ -n "$resetprop_command" ]; then
# Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)
"$resetprop_command" --delete ro.audio.spatializer_enabled 1>"/dev/null" 2>&1
# End of workaround
"$resetprop_command" ro.audio.spatializer_enabled false
force_restart_server=1
else
return 1
fi
fi


if [ "$force_restart_server" = "1" -o "`getprop ro.system.build.version.release`" -ge "12" ]; then
if [ -n "`getprop init.svc.audioserver`" ]; then
Expand Down
6 changes: 4 additions & 2 deletions system.prop
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ ro.config.media_vol_steps=100
audio.safemedia.bypass=true
ro.audio.ignore_effects=true
ro.audio.spatializer_enabled=false
vendor.audio.usb.perio=2250
vendor.audio.usb.out.period_us=2250
ro.vendor.audio.dolby.dax.support=false
vendor.audio.dolby.control.support=false
vendor.audio.usb.perio=2000
vendor.audio.usb.out.period_us=2000
vendor.audio.usb.out.period_count=2
vendor.audio_hal.period_size=120
vendor.audio_hal.period_multiplier=1
Expand Down
6 changes: 4 additions & 2 deletions system.prop-workaround
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ ro.config.media_vol_steps=100
audio.safemedia.bypass=true
ro.audio.ignore_effects=true
ro.audio.spatializer_enabled=false
vendor.audio.usb.perio=2250
vendor.audio.usb.out.period_us=2250
ro.vendor.audio.dolby.dax.support=false
vendor.audio.dolby.control.support=false
vendor.audio.usb.perio=2000
vendor.audio.usb.out.period_us=2000
vendor.audio.usb.out.period_count=2
vendor.audio_hal.period_size=120
vendor.audio_hal.period_multiplier=1
Expand Down

0 comments on commit 963ddb3

Please sign in to comment.