This PR add speed and pitch playback customition to powerplay. it also improves the audio playback experience in the PowerPlay sample app by resolving buffer size issues and handling hardware limitations during PCM Offload mode. It introduces dynamic UI controls that adapt to the file's sample rate and mode, and adds a polished reset feature with smooth animations.
Changes
C++ Engine (PowerPlayMultiPlayer.cpp)
Increased Buffer Capacity: Increased the buffer capacity to 8192 frames to support variable playback speeds without triggering ErrorIllegalArgument due to insufficient buffer size.
Jetpack Compose UI (MainActivity.kt)
Dynamic Control Enablement: Implemented a matrix of rules to enable/disable speed and pitch sliders based on the current performance mode (MMAP vs Classic Offload) and the file's sample rate.
Informative UI Labels: Added text indicators next to sliders to explain why they are disabled (e.g., "Requires API 37" or "Not supported for 44kHz in MMAP Offload").
Reset Button: Added a "Reset to Defaults" button that appears only after modifying values and letting go of the slider.
Smooth Animations: Refined the appearance and disappearance of the Reset button with fade and slide animations for a premium feel.
Offload Limitations Matrix
The following table details the controls enabled in different offload scenarios:
Mode
Sample Rate
Speed Control
Pitch Control
Notes
MMAP PCM Offload
44.1 kHz
Enabled
❌ Disabled
Pitch limitations
48 kHz
Enabled
❌ Disabled
Pitch limitations
96 kHz
Enabled
❌ Disabled
Pitch limitations
Classic PCM Offload
44.1 kHz
Enabled
❌ Disabled
Pitch limitations
48 kHz
Enabled
❌ Disabled
Pitch limitations
96 kHz
Enabled
❌ Disabled
Pitch limitations
Note
Pitch control is disabled in all PCM Offload modes based on current hardware support expectations.
How to Test
Open the PowerPlay sample app.
Load files with different sample rates (44.1k, 48k, 96k).
Switch between different performance modes (Low Latency, Power Saving, PCM Offload) and toggle MMAP.
Verify that the sliders are enabled/disabled according to the matrix above.
Verify that the Reset button appears smoothly after releasing a slider and works as expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR add speed and pitch playback customition to powerplay. it also improves the audio playback experience in the PowerPlay sample app by resolving buffer size issues and handling hardware limitations during PCM Offload mode. It introduces dynamic UI controls that adapt to the file's sample rate and mode, and adds a polished reset feature with smooth animations.
Changes
C++ Engine (PowerPlayMultiPlayer.cpp)
Jetpack Compose UI (MainActivity.kt)
Offload Limitations Matrix
The following table details the controls enabled in different offload scenarios:
Note
Pitch control is disabled in all PCM Offload modes based on current hardware support expectations.
How to Test
Visuals