Skip to content

Fix auto switch to system default#121

Merged
RomanPudashkin merged 3 commits into
musescore:mainfrom
RomanPudashkin:fix_auto_switch_to_system_default
Jul 2, 2026
Merged

Fix auto switch to system default#121
RomanPudashkin merged 3 commits into
musescore:mainfrom
RomanPudashkin:fix_auto_switch_to_system_default

Conversation

@RomanPudashkin

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RomanPudashkin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6fc40d9c-8790-4d4a-8a9a-5ee5b9d6a34a

📥 Commits

Reviewing files that changed from the base of the PR and between 6c83d88 and e3ae987.

📒 Files selected for processing (3)
  • framework/audio/driver/platform/win/asio/asioaudiodriver.cpp
  • framework/audio/main/internal/audiodrivercontroller.cpp
  • framework/audio/main/internal/audiodrivercontroller.h
📝 Walkthrough

Walkthrough

This PR removes an unused DEFAULT_BUFFER_SIZE constant from audiotypes.h, adds a defaultOutputSpec() method to IAudioConfiguration implemented in AudioConfiguration (using new constexpr defaults) and stubbed in AudioConfigurationStub. AudioDriverController is refactored: checkOutputDevice()/defaultSpec() are replaced with handleOutputDeviceChange() and switchToDefaultAudioDriver(), output-device change handling becomes asynchronous, and driver open/reset paths gain fallback logic and error logging using the new default spec. AsioAudioDriver::reset() now only notifies device-change listeners instead of closing and reopening the driver.

Changes

Cohort / File(s) Summary
Remove unused constant — audiotypes.h Removed DEFAULT_BUFFER_SIZE constant
Default output spec interface — iaudioconfiguration.h, audioconfiguration.{h,cpp}, audioconfigurationstub.{h,cpp} Added defaultOutputSpec() API, implementation with constexpr defaults, and stub
Driver controller fallback logic — audiodrivercontroller.{h,cpp} Replaced checkOutputDevice/defaultSpec with handleOutputDeviceChange/switchToDefaultAudioDriver; added async handling, retry flag, fallback and error logging
ASIO driver reset simplification — asioaudiodriver.cpp reset() now only notifies listeners instead of reopening the driver

Sequence Diagram(s)

sequenceDiagram
  participant Driver as AudioDriver
  participant Controller as AudioDriverController
  participant Config as AudioConfiguration
  Driver->>Controller: availableOutputDevicesChanged notify
  Controller->>Controller: async::Async::call handleOutputDeviceChange
  Controller->>Driver: close current device
  Controller->>Driver: open(activeSpec)
  alt open fails
    Controller->>Driver: open(DEFAULT_DEVICE_ID)
    alt still fails
      Controller->>Config: defaultOutputSpec()
      Controller->>Controller: switchToDefaultAudioDriver(spec)
      Controller->>Driver: open(new driver, defaultSpec)
    end
  end
  Controller->>Controller: notify output device listeners
Loading

Related issues: None specified.

Related PRs: None specified.

Suggested labels: audio, refactor

Suggested reviewers: None specified.

Poem:
A rabbit tunes its audio ear,
Default specs now crystal clear,
No more resets closing tight,
Fallbacks guide the sound just right,
Hop along, the driver's fine tonight! 🐰🎧

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete and does not follow the required template; it only links a port PR and omits the required sections. Fill in the template sections: issue reference, short motivation, checklist items, build configuration, and any testing or commit notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing auto-switch behavior for the system default audio driver.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@framework/audio/main/internal/audiodrivercontroller.cpp`:
- Around line 377-399: The fallback path in
AudioDriverController::handleOutputDeviceChange() ignores the result of
switchToDefaultAudioDriver(), so retry state can stay wrong after a successful
switch. Update the failure branch to capture the return value from
switchToDefaultAudioDriver() into ok, matching the existing pattern used
elsewhere, and then let m_retryOpenDevice reflect that final success or failure.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: f09266c7-57eb-47a5-815a-503763a1634c

📥 Commits

Reviewing files that changed from the base of the PR and between 1418006 and 6c83d88.

📒 Files selected for processing (9)
  • framework/audio/common/audiotypes.h
  • framework/audio/driver/platform/win/asio/asioaudiodriver.cpp
  • framework/audio/main/iaudioconfiguration.h
  • framework/audio/main/internal/audioconfiguration.cpp
  • framework/audio/main/internal/audioconfiguration.h
  • framework/audio/main/internal/audiodrivercontroller.cpp
  • framework/audio/main/internal/audiodrivercontroller.h
  • framework/stubs/audio/audioconfigurationstub.cpp
  • framework/stubs/audio/audioconfigurationstub.h
💤 Files with no reviewable changes (1)
  • framework/audio/common/audiotypes.h

Comment thread framework/audio/main/internal/audiodrivercontroller.cpp
@RomanPudashkin RomanPudashkin force-pushed the fix_auto_switch_to_system_default branch from 6c83d88 to 57db675 Compare July 2, 2026 14:27
* ASIO reset() now fires availableOutputDevicesChanged instead of
  self-handling close/reopen, matching the WASAPI behavior
* AudioDriverController::checkOutputDevice() falls back to the default
  audio driver (WASAPI) if reopen fails
@RomanPudashkin RomanPudashkin force-pushed the fix_auto_switch_to_system_default branch from 57db675 to e3ae987 Compare July 2, 2026 14:44
@RomanPudashkin RomanPudashkin merged commit 9abcdbc into musescore:main Jul 2, 2026
3 checks passed
@RomanPudashkin RomanPudashkin deleted the fix_auto_switch_to_system_default branch July 2, 2026 15:12
@RomanPudashkin RomanPudashkin restored the fix_auto_switch_to_system_default branch July 3, 2026 09:23
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