Skip to content

Enable ASIO - #11330

Merged
kryksyh merged 2 commits into
audacity:masterfrom
kryksyh:portaudio_x_asio
Jul 3, 2026
Merged

kryksyh merged 2 commits into
audacity:masterfrom
kryksyh:portaudio_x_asio

Conversation

@kryksyh

@kryksyh kryksyh commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

Resolves: #10828

  • PortAudio was patched to prevent startup device scanning for ASIO devices
  • Option to use current device sample rate allows cooperative playback with WASAPI streams (e.g., audacity + browser)
  • Button to open ASIO driver settings added to preferences
  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

QA:

  • Testflow test cases have been run

@kryksyh
kryksyh force-pushed the portaudio_x_asio branch 2 times, most recently from c2ef24d to cfd780a Compare July 2, 2026 14:12
@kryksyh kryksyh changed the title re enable asio once more Enable ASIO Jul 2, 2026
@kryksyh
kryksyh marked this pull request as ready for review July 2, 2026 14:20
@kryksyh
kryksyh force-pushed the portaudio_x_asio branch from cfd780a to 54312a1 Compare July 2, 2026 14:21
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

📝 Walkthrough

Walkthrough

Adds ASIO audio device support on Windows: DeviceManager gains ASIO detection, capability caching via preferences, sample-rate querying, control panel access, and post-rescan cache application. AudioIOBase and AudioIO adjust PortMixer probing and sample-rate selection for ASIO devices. Au3AudioDevicesProvider and IAudioDevicesProvider add a settable "use device sample rate" preference, a change notification, and control-panel invocation. Preferences QML introduces an AsioSection UI wired to a new configuration-model property, and build/dependency manifests add the ASIO SDK source dependency and update muse_deps.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AsioSection
  participant CommonAudioApiConfigurationModel
  participant Au3AudioDevicesProvider
  participant DeviceManager

  AsioSection->>CommonAudioApiConfigurationModel: showAsioControlPanel()
  CommonAudioApiConfigurationModel->>Au3AudioDevicesProvider: showAsioControlPanel()
  Au3AudioDevicesProvider->>Au3AudioDevicesProvider: resolve panel device index
  Au3AudioDevicesProvider->>DeviceManager: ShowAsioControlPanel(paIndex)
Loading
sequenceDiagram
  participant DeviceManager
  participant PortAudio
  participant Preferences

  DeviceManager->>DeviceManager: IsAsioDevice(paDeviceIndex)
  DeviceManager->>PortAudio: query ASIO device info
  DeviceManager->>Preferences: cache channel/sample-rate info by driver key
  DeviceManager->>Preferences: ApplyCachedAsioDeviceInfo() on Rescan()
  DeviceManager->>DeviceManager: UpdateAsioDeviceCaps(paDeviceIndex)
  DeviceManager->>DeviceManager: update DeviceSourceMap numChannels
Loading

Suggested labels: audio, windows, ASIO, preferences

Suggested reviewers: please assign based on ownership of au3-audio-devices, au3-audio-io, and preferences QML modules

Poem:
A rabbit tunes its driver deep,
ASIO whispers, "Wake, don't sleep!"
Cached channels hum a steady tone,
Control panels open, all its own.
From QML checkbox to native call,
This bunny routes the sample rate for all. 🐰🎛️

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main theme of the PR: adding ASIO support and related controls.
Description check ✅ Passed The description includes the required issue reference, summary, motivation, and checklist items from the template.
Linked Issues check ✅ Passed The changes address #10828 by avoiding ASIO scanning on launch/rescan and preventing the audio drop on Windows.
Out of Scope Changes check ✅ Passed The added UI, PortAudio handling, and sample-rate controls all support the ASIO fix and do not appear unrelated.

Warning

Review ran into problems

🔥 Problems

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


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.

@kryksyh

kryksyh commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
au3/libraries/au3-audio-devices/DeviceManager.cpp (1)

444-459: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Keep uncached ASIO devices in the device maps.

With lazy ASIO enumeration, a clean prefs profile has no cached channel caps, so ApplyCachedAsioDeviceInfo() leaves ASIO devices with unknown/zero caps. The existing maxInputChannels > 0 / maxOutputChannels > 0 gates then skip AddSources(), so the device never reaches the maps that downstream selection uses before UpdateAsioDeviceCaps() can populate the cache.

Possible localized fix
     for (int i = 0; i < nDevices; i++) {
         const PaDeviceInfo* info = Pa_GetDeviceInfo(i);
-        if (info->maxOutputChannels > 0) {
+        const bool isAsio = DeviceManager::IsAsioDevice(i);
+        if (info->maxOutputChannels > 0 || isAsio) {
             AddSources(i, info->defaultSampleRate, &mOutputDeviceSourceMaps, 0);
         }
 
-        if (info->maxInputChannels > 0) {
+        if (info->maxInputChannels > 0 || isAsio) {
             AddSources(i, info->defaultSampleRate, &mInputDeviceSourceMaps, 1);
         }
     }

As per path instructions, *: only report issues of major or critical severity.

Source: Path instructions


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6ed3dec6-7671-4d92-b0c3-b6832c711702

📥 Commits

Reviewing files that changed from the base of the PR and between 1257eae and 54312a10b59f4d036878431df6d25760aca100de.

📒 Files selected for processing (14)
  • au3/libraries/au3-audio-devices/AudioIOBase.cpp
  • au3/libraries/au3-audio-devices/DeviceManager.cpp
  • au3/libraries/au3-audio-devices/DeviceManager.h
  • au3/libraries/au3-audio-io/AudioIO.cpp
  • buildscripts/cmake/DependencyManifest.cmake
  • muse_deps
  • src/au3audio/internal/au3audiodevicesprovider.cpp
  • src/au3audio/internal/au3audiodevicesprovider.h
  • src/audio/iaudiodevicesprovider.h
  • src/preferences/qml/Audacity/Preferences/AudioPreferencesPage.qml
  • src/preferences/qml/Audacity/Preferences/CMakeLists.txt
  • src/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.cpp
  • src/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.h
  • src/preferences/qml/Audacity/Preferences/internal/AsioSection.qml

Comment thread au3/libraries/au3-audio-io/AudioIO.cpp Resolved
kryksyh added 2 commits July 3, 2026 13:29
Patch portaudio to prevent audio drops on startup
@kryksyh
kryksyh force-pushed the portaudio_x_asio branch from 54312a1 to 6f08b07 Compare July 3, 2026 10:29
@kryksyh
kryksyh merged commit 9a36ce0 into audacity:master Jul 3, 2026
4 of 10 checks passed
@kryksyh
kryksyh deleted the portaudio_x_asio branch July 3, 2026 10:30
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.

Audacity 4 drops audio on Launch and Rescan

2 participants