AudioFlinger: re-add viper optimizations

These make a notable difference when playing audio on ESP32.

Without them, each UI action causes a stutter, so it's not fun to listen
to audio while doing anything on the device. With them, most UI actions don't
cause a stutter. Long maxed out CPU runs and storage access still do, though.
This commit is contained in:
Thomas Farstrike
2025-12-03 23:11:22 +01:00
parent 21311a61f6
commit 4e7baf4ec6
3 changed files with 23 additions and 9 deletions
+11
View File
@@ -101,12 +101,23 @@ if [ "$target" == "esp32" ]; then
elif [ "$target" == "unix" -o "$target" == "macOS" ]; then
manifest=$(readlink -f "$codebasedir"/manifests/manifest.py)
frozenmanifest="FROZEN_MANIFEST=$manifest"
# Comment out @micropython.viper decorator for Unix/macOS builds
# (cross-compiler doesn't support Viper native code emitter)
echo "Temporarily commenting out @micropython.viper decorator for Unix/macOS build..."
stream_wav_file="$codebasedir"/internal_filesystem/lib/mpos/audio/stream_wav.py
sed -i 's/^@micropython\.viper$/#@micropython.viper/' "$stream_wav_file"
# LV_CFLAGS are passed to USER_C_MODULES
# STRIP= makes it so that debug symbols are kept
pushd "$codebasedir"/lvgl_micropython/
# USER_C_MODULE doesn't seem to work properly so there are symlinks in lvgl_micropython/extmod/
python3 make.py "$target" LV_CFLAGS="-g -O0 -ggdb -ljpeg" STRIP= DISPLAY=sdl_display INDEV=sdl_pointer INDEV=sdl_keyboard "$frozenmanifest"
popd
# Restore @micropython.viper decorator after build
echo "Restoring @micropython.viper decorator..."
sed -i 's/^#@micropython\.viper$/@micropython.viper/' "$stream_wav_file"
else
echo "invalid target $target"
fi