Skip to content

feat(equalizer): stabilize audio effects and improve state persistence#1073

Merged
theovilardo merged 1 commit intomasterfrom
fix/equalizer-bugs
Feb 14, 2026
Merged

feat(equalizer): stabilize audio effects and improve state persistence#1073
theovilardo merged 1 commit intomasterfrom
fix/equalizer-bugs

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

  • Core Audio:

    • Implement onAudioSessionIdChanged in DualPlayerEngine to track and update the active audio session ID.
    • Standardize the number of equalizer bands to 10 across the repository and UI.
    • Clamp LoudnessEnhancer gain to a stable range of 0–1000 mB (10dB) to ensure cross-device consistency.
  • State Management:

    • Add a synchronous flush of equalizer and audio effect settings in EqualizerViewModel.onCleared() to prevent data loss from debounced updates when the screen is dismissed.
    • Improve data normalization in UserPreferencesRepository for equalizer bands and loudness strength.
  • Equalizer Engine:

    • Refactor EqualizerManager to better synchronize effect states (Bass Boost, Virtualizer, Loudness) when re-attaching to a new audio session.
    • Ensure target gain is applied before enabling LoudnessEnhancer to prevent audio spikes.
  • UI:

    • Update EqualizerScreen slider ranges to match the new 1000 mB limit for Loudness.

- **Core Audio**:
    - Implement `onAudioSessionIdChanged` in `DualPlayerEngine` to track and update the active audio session ID.
    - Standardize the number of equalizer bands to 10 across the repository and UI.
    - Clamp `LoudnessEnhancer` gain to a stable range of 0–1000 mB (10dB) to ensure cross-device consistency.

- **State Management**:
    - Add a synchronous flush of equalizer and audio effect settings in `EqualizerViewModel.onCleared()` to prevent data loss from debounced updates when the screen is dismissed.
    - Improve data normalization in `UserPreferencesRepository` for equalizer bands and loudness strength.

- **Equalizer Engine**:
    - Refactor `EqualizerManager` to better synchronize effect states (Bass Boost, Virtualizer, Loudness) when re-attaching to a new audio session.
    - Ensure target gain is applied before enabling `LoudnessEnhancer` to prevent audio spikes.

- **UI**:
    - Update `EqualizerScreen` slider ranges to match the new 1000 mB limit for Loudness.
@theovilardo theovilardo merged commit 3f20698 into master Feb 14, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 751dca9d53

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +485 to +486
kotlinx.coroutines.runBlocking {
val latest = _uiState.value
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move onCleared flush off the main thread

onCleared() runs on the main thread, and this new runBlocking path performs a sequence of DataStore writes synchronously before returning. On slower storage or when DataStore is contended, dismissing the equalizer screen can block the UI thread long enough to cause visible jank or ANR-risk behavior; this flush should be moved off-main (or batched into one write) instead of blocking lifecycle teardown.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant