Skip to content

Implement Reset Mixer Settings to Default Button#33799

Open
wjana298 wants to merge 1 commit into
musescore:mainfrom
wjana298:reset-mixer
Open

Implement Reset Mixer Settings to Default Button#33799
wjana298 wants to merge 1 commit into
musescore:mainfrom
wjana298:reset-mixer

Conversation

@wjana298

Copy link
Copy Markdown

Resolves: #24685

Added button and shortcut (Crtl+Shift+R) that reverts all changes in the Mixer Workspace Panel back to "New-Score" defaults (Volume, Pan, Aux sends and Reverb).
When the button is pressed, a pop-up window appears asking to confirm the reset, since the changes will be permanent.

  • I signed the CLA as joanaaguia:
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • I understand all aspects of the code I'm contributing and I'm able to explain it if requested.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.
  • I created a unit test or vtest to verify the changes I made (if applicable).

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0ebb57ce-e1fd-4efb-b67e-1c75e640356e

📥 Commits

Reviewing files that changed from the base of the PR and between 730e430 and 09555ae.

📒 Files selected for processing (13)
  • src/app/configs/data/shortcuts.xml
  • src/playback/internal/playbackcontroller.cpp
  • src/playback/internal/playbackcontroller.h
  • src/playback/internal/playbackuiactions.cpp
  • src/playback/internal/playbackuiactions.h
  • src/playback/iplaybackcontroller.h
  • src/playback/qml/MuseScore/Playback/CMakeLists.txt
  • src/playback/qml/MuseScore/Playback/MixerPanel.qml
  • src/playback/qml/MuseScore/Playback/internal/MixerPanelToolbar.qml
  • src/playback/qml/MuseScore/Playback/internal/ResetMixerButton.qml
  • src/playback/qml/MuseScore/Playback/mixerchannelitem.cpp
  • src/playback/qml/MuseScore/Playback/mixerpanelmodel.cpp
  • src/playback/tests/mocks/playbackcontrollermock.h
✅ Files skipped from review due to trivial changes (2)
  • src/playback/qml/MuseScore/Playback/CMakeLists.txt
  • src/playback/internal/playbackuiactions.h
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/playback/tests/mocks/playbackcontrollermock.h
  • src/playback/qml/MuseScore/Playback/internal/ResetMixerButton.qml
  • src/playback/qml/MuseScore/Playback/internal/MixerPanelToolbar.qml
  • src/playback/internal/playbackuiactions.cpp
  • src/playback/qml/MuseScore/Playback/mixerchannelitem.cpp
  • src/playback/internal/playbackcontroller.h
  • src/playback/iplaybackcontroller.h
  • src/playback/qml/MuseScore/Playback/MixerPanel.qml
  • src/playback/internal/playbackcontroller.cpp

📝 Walkthrough

Walkthrough

This pull request implements a "reset mixer to defaults" feature for the playback system. The implementation spans the controller layer, UI action infrastructure, QML components, and model synchronization. The feature adds a new notification to the IPlaybackController interface, implements resetMixerToDefaults() to reset per-track and master audio parameters, exposes it as a keyboard-triggered UI action (Ctrl+Shift+R), renders a QML button with confirmation dialog, and synchronizes the UI state through the mixer panel model.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Implement Reset Mixer Settings to Default Button' clearly describes the main feature being added—a reset button for mixer settings.
Description check ✅ Passed The PR description adequately addresses the template sections: issue reference (#24685), feature summary, CLA signature, and all checklist items properly completed except unit/vtest.
Linked Issues check ✅ Passed Code changes implement all stated objectives from #24685: reset button for mixer, keyboard shortcut (Ctrl+Shift+R), volume/pan/aux defaults, and confirmation dialog.
Out of Scope Changes check ✅ Passed All changes directly support the reset mixer feature implementation. XML shortcuts, UI actions, controller logic, QML components, and model updates are all aligned with #24685 objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped musescore/muse_framework.git.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/playback/internal/playbackcontroller.cpp`:
- Line 131: The shortcut registration currently calls resetMixerToDefaults
directly via dispatcher()->reg(..., RESET_MIXER_CODE, ...,
&PlaybackController::resetMixerToDefaults); change it to route through the same
confirmation gate used by the button/QML flow: bind RESET_MIXER_CODE to a new or
existing handler (e.g., PlaybackController::requestResetMixerConfirmation or the
exact method the QML button uses) that shows the confirmation dialog and only
calls PlaybackController::resetMixerToDefaults after the user confirms; ensure
the dispatcher()->reg uses that confirmation handler instead of
resetMixerToDefaults so the keyboard shortcut cannot bypass confirmation.
- Around line 961-1033: The resetMixerToDefaults must also restore aux/reverb
channel outputs; update PlaybackController::resetMixerToDefaults to iterate
m_auxTrackIdMap (or the aux IDs from audioSettings()/m_auxTrackIdMap), build
default AuxOutputParams (reset volume/balance/mute/forceMute and set default
send/return values via configuration() or the same defaults used for tracks),
call audioSettings()->setAuxOutputParams(auxInstrumentTrackId, auxParams) for
each aux and push those to playback via
playback()->setAuxControlParams(auxTrackId, auxParams.control()) (and any
equivalent playback API to set aux return/reverb params). Ensure you reference
AuxOutputParams, m_auxTrackIdMap, audioSettings()->auxOutputParams /
setAuxOutputParams, configuration() defaults, and
playback()->setAuxControlParams when making the changes.

In `@src/playback/qml/MuseScore/Playback/MixerPanel.qml`:
- Around line 46-48: The toolbar's onResetMixerRequested currently calls the
local root.resetMixer() and the file contains a local hardcoded reset
implementation (aux defaults in the block around the function used at lines
96-113); instead, remove the local reset logic and route the toolbar click to
the canonical controller action "reset-mixer" so both entry points use the same
controller-computed defaults. Concretely: replace the root.resetMixer() call
path from onResetMixerRequested with invoking the controller's "reset-mixer"
action (or emitting the same signal the shortcut uses) and delete the local
aux-default assignments (isActive = true, audioSignalPercentage = 30) so
defaults are computed only by the controller reset implementation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2206e34e-8567-404d-a2fe-143f44b05c07

📥 Commits

Reviewing files that changed from the base of the PR and between d53a8ed and 730e430.

📒 Files selected for processing (13)
  • src/app/configs/data/shortcuts.xml
  • src/playback/internal/playbackcontroller.cpp
  • src/playback/internal/playbackcontroller.h
  • src/playback/internal/playbackuiactions.cpp
  • src/playback/internal/playbackuiactions.h
  • src/playback/iplaybackcontroller.h
  • src/playback/qml/MuseScore/Playback/CMakeLists.txt
  • src/playback/qml/MuseScore/Playback/MixerPanel.qml
  • src/playback/qml/MuseScore/Playback/internal/MixerPanelToolbar.qml
  • src/playback/qml/MuseScore/Playback/internal/ResetMixerButton.qml
  • src/playback/qml/MuseScore/Playback/mixerchannelitem.cpp
  • src/playback/qml/MuseScore/Playback/mixerpanelmodel.cpp
  • src/playback/tests/mocks/playbackcontrollermock.h

dispatcher()->reg(this, PLAYBACK_SETUP, this, &PlaybackController::openPlaybackSetupDialog);
dispatcher()->reg(this, TOGGLE_HEAR_PLAYBACK_WHEN_EDITING_CODE, this, &PlaybackController::toggleHearPlaybackWhenEditing);
dispatcher()->reg(this, "playback-reload-cache", this, &PlaybackController::reloadPlaybackCache);
dispatcher()->reg(this, RESET_MIXER_CODE, this, &PlaybackController::resetMixerToDefaults);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Route the shortcut through the same confirmation gate.

Line 131 binds reset-mixer directly to resetMixerToDefaults(). With the new Ctrl+Shift+R shortcut, that makes the destructive reset execute immediately, while the confirmation in this PR exists only in the button/QML flow. The shortcut needs the same guard or it can wipe mixer state in one keystroke.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/playback/internal/playbackcontroller.cpp` at line 131, The shortcut
registration currently calls resetMixerToDefaults directly via
dispatcher()->reg(..., RESET_MIXER_CODE, ...,
&PlaybackController::resetMixerToDefaults); change it to route through the same
confirmation gate used by the button/QML flow: bind RESET_MIXER_CODE to a new or
existing handler (e.g., PlaybackController::requestResetMixerConfirmation or the
exact method the QML button uses) that shows the confirmation dialog and only
calls PlaybackController::resetMixerToDefaults after the user confirms; ensure
the dispatcher()->reg uses that confirmation handler instead of
resetMixerToDefaults so the keyboard shortcut cannot bypass confirmation.

Comment on lines +961 to +1033
void PlaybackController::resetMixerToDefaults()
{
IF_ASSERT_FAILED(audioSettings() && notationPlayback()) {
return;
}

InstrumentTrackIdSet existingTrackIdSet = notationPlayback()->existingTrackIdSet();

for (const InstrumentTrackId& instrumentTrackId : existingTrackIdSet) {
if (!muse::contains(m_instrumentTrackIdMap, instrumentTrackId)) {
continue;
}

AudioOutputParams outParams = trackOutputParams(instrumentTrackId);
const bool wasMuted = outParams.muted;
const bool wasForceMute = outParams.forceMute;

outParams.volume = 0.f;
outParams.balance = 0.f;

const AudioInputParams inParams = audioSettings()->trackInputParams(instrumentTrackId);
const AudioSourceType sourceType = inParams.isValid() ? inParams.type() : AudioSourceType::Fluid;
const muse::String instrumentSoundId = inParams.resourceMeta.attributeVal(PLAYBACK_SETUP_DATA_ATTRIBUTE);

const bool isMetronome = instrumentTrackId == notationPlayback()->metronomeTrackId();

if (isMetronome) {
outParams.muted = wasMuted;
} else {
const auto soloMuteState = trackSoloMuteState(instrumentTrackId);
outParams.solo = soloMuteState.solo;
outParams.muted = soloMuteState.mute;
}
outParams.forceMute = wasForceMute;

if (!isMetronome) {
if (outParams.auxSends.empty()) {
const auto& auxMap = m_auxTrackIdMap;
for (aux_channel_idx_t idx = 0; idx < static_cast<aux_channel_idx_t>(auxMap.size()); ++idx) {
gain_t signalAmount = configuration()->defaultAuxSendValue(idx, sourceType, instrumentSoundId);
outParams.auxSends.emplace_back(AuxSendParams { signalAmount, true });
}
} else {
for (aux_channel_idx_t idx = 0; idx < static_cast<aux_channel_idx_t>(outParams.auxSends.size()); ++idx) {
gain_t signalAmount = configuration()->defaultAuxSendValue(idx, sourceType, instrumentSoundId);
outParams.auxSends[idx] = AuxSendParams { signalAmount, true };
}
}
}

audioSettings()->setTrackOutputParams(instrumentTrackId, outParams);

audio::TrackId trackId = m_instrumentTrackIdMap.at(instrumentTrackId);
playback()->setControlParams(trackId, outParams.control());
playback()->setAuxSendsParams(trackId, outParams.auxSends);
}

AudioOutputParams masterParams = audioSettings()->masterAudioOutputParams();
const bool masterWasMuted = masterParams.muted;
const bool masterWasForceMute = masterParams.forceMute;

masterParams.volume = 0.f;
masterParams.balance = 0.f;

masterParams.muted = masterWasMuted;
masterParams.forceMute = masterWasForceMute;

audioSettings()->setMasterAudioOutputParams(masterParams);
playback()->setMasterControlParams(masterParams.control());

m_mixerResetRequested.notify();

}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reset the aux/reverb outputs, not just track sends.

Lines 996-1029 rebuild per-track sends and master control params, but they never restore audioSettings()->auxOutputParams(...) or push default aux-track params back into playback. As written, edits made on the aux/reverb channels themselves survive the reset, so this does not fully return the mixer to the "New-Score" defaults described in the PR objective.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/playback/internal/playbackcontroller.cpp` around lines 961 - 1033, The
resetMixerToDefaults must also restore aux/reverb channel outputs; update
PlaybackController::resetMixerToDefaults to iterate m_auxTrackIdMap (or the aux
IDs from audioSettings()/m_auxTrackIdMap), build default AuxOutputParams (reset
volume/balance/mute/forceMute and set default send/return values via
configuration() or the same defaults used for tracks), call
audioSettings()->setAuxOutputParams(auxInstrumentTrackId, auxParams) for each
aux and push those to playback via playback()->setAuxControlParams(auxTrackId,
auxParams.control()) (and any equivalent playback API to set aux return/reverb
params). Ensure you reference AuxOutputParams, m_auxTrackIdMap,
audioSettings()->auxOutputParams / setAuxOutputParams, configuration() defaults,
and playback()->setAuxControlParams when making the changes.

Comment on lines +46 to +48
onResetMixerRequested: {
root.resetMixer()
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Route reset through the controller action, not a local QML reset implementation.

Line 46 and Line 47 send the button flow to root.resetMixer(), and Lines 96-113 hardcode aux defaults (isActive = true, audioSignalPercentage = 30). This can diverge from the canonical reset behavior used by the "reset-mixer" action/shortcut, where defaults are computed in controller logic per track/source. Please wire the toolbar reset to the same "reset-mixer" action path and remove the local reset logic so both entry points produce identical defaults.

Also applies to: 96-113

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/playback/qml/MuseScore/Playback/MixerPanel.qml` around lines 46 - 48, The
toolbar's onResetMixerRequested currently calls the local root.resetMixer() and
the file contains a local hardcoded reset implementation (aux defaults in the
block around the function used at lines 96-113); instead, remove the local reset
logic and route the toolbar click to the canonical controller action
"reset-mixer" so both entry points use the same controller-computed defaults.
Concretely: replace the root.resetMixer() call path from onResetMixerRequested
with invoking the controller's "reset-mixer" action (or emitting the same signal
the shortcut uses) and delete the local aux-default assignments (isActive =
true, audioSignalPercentage = 30) so defaults are computed only by the
controller reset implementation.

@mathesoncalum

Copy link
Copy Markdown
Contributor

Hmm, as mentioned in the issue discussion we would really prefer to have undo/redo supported in the mixer before trying to implement this. That's a pretty serious undertaking - I certainly wouldn't try to implement that as an afterthought to this task.

I recognise that the popup you've added scoots around this a little but overall I'm not sure - I'll raise this internally.

@mathesoncalum mathesoncalum self-requested a review June 12, 2026 17:02
Added button and shortcut that revert all changes
in the Mixer Workspace Panel back to "New-Score"
defaults (Volume, Pan, Aux sends and Reverb).
When the button is pressed, a pop-up window appears asking to
confirm the reset, since the changes will be permanent.

Closes musescore#24685

Co-authored-by: Miguel Sousa <miguel.de.sousa@tecnico.ulisboa.pt>
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.

Abilities to reset Mixer Panel Settings to Default / Revert Mixer Panel changes to "new-score" layout. (i.e. All Volumes reset to 0 etc...)

3 participants