Repository navigation
11389 add system default for playback and recording devices. - #11428
embarc-gabriel merged 20 commits into
Conversation
4bbc2af to
fab9b42
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAudio device selection now supports an unset state representing “System default.” Provider APIs use optional device names, host-specific defaults are resolved through Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant AudioDeviceUI
participant PlaybackController
participant Au3AudioDevicesProvider
participant DeviceManager
User->>AudioDeviceUI: choose System default
AudioDeviceUI->>PlaybackController: dispatch default-device action
PlaybackController->>Au3AudioDevicesProvider: clear selected device
Au3AudioDevicesProvider->>DeviceManager: resolve host-specific default
DeviceManager-->>Au3AudioDevicesProvider: return default device
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Warning Review ran into problems🔥 ProblemsLinked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped 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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 012fb6bc-26f1-47a1-b7ff-1206685e0d71
📥 Commits
Reviewing files that changed from the base of the PR and between 425fd3c and fab9b42b22876b29d5873ea30f8379733b73ca75.
📒 Files selected for processing (11)
au3/libraries/au3-audio-devices/AudioIOBase.cppau3/libraries/au3-audio-io/AudioIO.cppsrc/au3audio/internal/au3audiodevicesprovider.cppsrc/au3audio/internal/au3audiodevicesprovider.hsrc/audio/iaudiodevicesprovider.hsrc/playback/internal/playbackcontroller.cppsrc/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.cppsrc/projectscene/view/toolbars/audiosetupcontextmenumodel.cppsrc/record/internal/au3/au3record.cppsrc/record/internal/au3/au3record.hsrc/record/recorderrors.h
fab9b42 to
0b3fd4e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 0c69fcac-8dab-46c3-b895-daac0c2073aa
📥 Commits
Reviewing files that changed from the base of the PR and between 0b3fd4e80eda25b33d77c5d9676888f0bd2f882b and 8b27d7cec5178b2dde91f42d9bd56e711c70edbe.
📒 Files selected for processing (33)
CMakeLists.txtSetupConfigure.cmakesrc/au3audio/CMakeLists.txtsrc/au3audio/au3audiomodule.cppsrc/au3audio/au3audiomodule.hsrc/au3audio/iau3devicemanager.hsrc/au3audio/internal/au3audiodevicesprovider.cppsrc/au3audio/internal/au3audiodevicesprovider.hsrc/au3audio/internal/au3devicemanager.cppsrc/au3audio/internal/au3devicemanager.hsrc/au3audio/internal/platform/linux/linuxsystemaudiodeviceslistener.cppsrc/au3audio/internal/platform/linux/linuxsystemaudiodeviceslistener.hsrc/au3audio/internal/platform/macos/macossystemaudiodeviceslistener.cppsrc/au3audio/internal/platform/macos/macossystemaudiodeviceslistener.hsrc/au3audio/internal/platform/stub/stubsystemaudiodeviceslistener.hsrc/au3audio/internal/platform/windows/windowssystemaudiodeviceslistener.cppsrc/au3audio/internal/platform/windows/windowssystemaudiodeviceslistener.hsrc/au3audio/isystemaudiodeviceslistener.hsrc/au3audio/tests/CMakeLists.txtsrc/au3audio/tests/au3audiodevicesprovider_tests.cppsrc/au3audio/tests/environment.cppsrc/au3audio/tests/mocks/au3devicemanagerfake.hsrc/audio/iaudiodevicesprovider.hsrc/audio/tests/mocks/audiodevicesprovidermock.hsrc/audio/tests/mocks/audioenginemock.hsrc/playback/internal/playbackcontroller.cppsrc/playback/internal/playbackcontroller.hsrc/playback/tests/playbackcontroller_tests.cppsrc/preferences/CMakeLists.txtsrc/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.cppsrc/preferences/tests/CMakeLists.txtsrc/preferences/tests/commonaudioapiconfigurationmodel_tests.cppsrc/projectscene/view/toolbars/audiosetupcontextmenumodel.cpp
🚧 Files skipped from review as they are similar to previous changes (5)
- src/audio/iaudiodevicesprovider.h
- src/projectscene/view/toolbars/audiosetupcontextmenumodel.cpp
- src/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.cpp
- src/au3audio/internal/au3audiodevicesprovider.h
- src/au3audio/internal/au3audiodevicesprovider.cpp
1a4169b to
f988236
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 9d78f323-eb8d-4b23-9ceb-2ac0c15e2a86
📥 Commits
Reviewing files that changed from the base of the PR and between 4db113a9a928beb8c86240fcf5b520712971ef56 and f98823686aa3a2f0d24a0232441e79f0ce549331.
📒 Files selected for processing (46)
CMakeLists.txtSetupConfigure.cmakeau3/libraries/au3-audio-devices/AudioIOBase.cppau3/libraries/au3-audio-devices/DeviceManager.cppau3/libraries/au3-audio-io/AudioIO.cppbuildscripts/ci/linux/setup.shsrc/au3audio/CMakeLists.txtsrc/au3audio/au3audiomodule.cppsrc/au3audio/au3audiomodule.hsrc/au3audio/iau3devicemanager.hsrc/au3audio/internal/au3audiodevicesprovider.cppsrc/au3audio/internal/au3audiodevicesprovider.hsrc/au3audio/internal/au3audioengine.cppsrc/au3audio/internal/au3audioengine.hsrc/au3audio/internal/au3audioiolistener.hsrc/au3audio/internal/au3devicemanager.cppsrc/au3audio/internal/au3devicemanager.hsrc/au3audio/internal/platform/linux/linuxsystemaudiodeviceslistener.cppsrc/au3audio/internal/platform/linux/linuxsystemaudiodeviceslistener.hsrc/au3audio/internal/platform/macos/macossystemaudiodeviceslistener.cppsrc/au3audio/internal/platform/macos/macossystemaudiodeviceslistener.hsrc/au3audio/internal/platform/stub/stubsystemaudiodeviceslistener.hsrc/au3audio/internal/platform/windows/windowssystemaudiodeviceslistener.cppsrc/au3audio/internal/platform/windows/windowssystemaudiodeviceslistener.hsrc/au3audio/isystemaudiodeviceslistener.hsrc/au3audio/tests/CMakeLists.txtsrc/au3audio/tests/au3audiodevicesprovider_tests.cppsrc/au3audio/tests/environment.cppsrc/au3audio/tests/mocks/au3devicemanagerfake.hsrc/audio/iaudiodevicesprovider.hsrc/audio/iaudioengine.hsrc/audio/tests/mocks/audiodevicesprovidermock.hsrc/audio/tests/mocks/audioenginemock.hsrc/playback/internal/playbackcontroller.cppsrc/playback/internal/playbackcontroller.hsrc/playback/tests/playbackcontroller_tests.cppsrc/preferences/CMakeLists.txtsrc/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.cppsrc/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.hsrc/preferences/qml/Audacity/Preferences/internal/AudioApiSection.qmlsrc/preferences/tests/CMakeLists.txtsrc/preferences/tests/commonaudioapiconfigurationmodel_tests.cppsrc/projectscene/view/toolbars/audiosetupcontextmenumodel.cppsrc/record/internal/au3/au3record.cppsrc/record/internal/au3/au3record.hsrc/record/recorderrors.h
🚧 Files skipped from review as they are similar to previous changes (38)
- src/record/internal/au3/au3record.h
- src/au3audio/tests/CMakeLists.txt
- src/au3audio/internal/platform/stub/stubsystemaudiodeviceslistener.h
- src/au3audio/internal/au3devicemanager.cpp
- src/au3audio/iau3devicemanager.h
- src/preferences/CMakeLists.txt
- src/preferences/qml/Audacity/Preferences/internal/AudioApiSection.qml
- src/au3audio/internal/platform/macos/macossystemaudiodeviceslistener.h
- src/au3audio/isystemaudiodeviceslistener.h
- CMakeLists.txt
- buildscripts/ci/linux/setup.sh
- src/preferences/tests/CMakeLists.txt
- src/au3audio/tests/mocks/au3devicemanagerfake.h
- src/au3audio/tests/environment.cpp
- src/au3audio/internal/platform/windows/windowssystemaudiodeviceslistener.h
- src/au3audio/internal/au3devicemanager.h
- src/au3audio/internal/platform/linux/linuxsystemaudiodeviceslistener.h
- src/au3audio/CMakeLists.txt
- au3/libraries/au3-audio-devices/AudioIOBase.cpp
- src/au3audio/internal/platform/macos/macossystemaudiodeviceslistener.cpp
- src/record/recorderrors.h
- src/au3audio/internal/platform/linux/linuxsystemaudiodeviceslistener.cpp
- src/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.h
- src/projectscene/view/toolbars/audiosetupcontextmenumodel.cpp
- au3/libraries/au3-audio-io/AudioIO.cpp
- src/au3audio/au3audiomodule.h
- au3/libraries/au3-audio-devices/DeviceManager.cpp
- SetupConfigure.cmake
- src/playback/internal/playbackcontroller.cpp
- src/playback/tests/playbackcontroller_tests.cpp
- src/au3audio/internal/platform/windows/windowssystemaudiodeviceslistener.cpp
- src/playback/internal/playbackcontroller.h
- src/audio/tests/mocks/audiodevicesprovidermock.h
- src/au3audio/au3audiomodule.cpp
- src/au3audio/internal/au3audiodevicesprovider.h
- src/audio/iaudiodevicesprovider.h
- src/preferences/qml/Audacity/Preferences/commonaudioapiconfigurationmodel.cpp
- src/au3audio/internal/au3audiodevicesprovider.cpp
f988236 to
bc74ce0
Compare
on macOS: Start playback |
733f50f to
c37b09c
Compare
|
@chinakov can you test it again? |
eff483d to
f7fa789
Compare
GetInputDevicePaIndex/GetOutputDevicePaIndex initialize the DeviceManager on first use, but GetDefaultDevice did not. With an empty device preference the Pa-index lookup that used to trigger Init() is skipped, so an early getPlayDevIndex/getRecordDevIndex call could iterate empty device maps and silently fall through to the global PortAudio default of a possibly different host API.
The device comboboxes used the translated 'System default' display string as the sentinel for the default-device entry, so a real device carrying that name (or colliding with the translation) could never be selected. Use index-based selection like the audio setup context menu, with entry 0 being 'System default'. This also makes the empty state consistent: with no devices for the selected API the list is empty and the current index is now -1, instead of a current value that was absent from the combo's model.
Cover CommonAudioApiConfigurationModel's index-based device selection: list composition with the leading 'System default' entry, index mapping (including the empty-list and unknown-device cases), selection forwarding to the devices provider, and the case of a real device named 'System default', which must stay distinguishable from the default entry. Also verify that provider notifications are forwarded as property-change signals. Introduces a reusable gmock for IAudioDevicesProvider.
Expose the resolved system default device names on IAudioDevicesProvider and label the default entry 'System default: <device>' in the preferences comboboxes and the audio setup menu, so users can see which device will actually be used.
Add ISystemAudioDevicesListener with a macOS implementation that watches CoreAudio for device list changes and for changes of the system default input/output device (e.g. via Audio MIDI Setup or unplugging a headset), debounced into a single notification. When the system devices change, the devices provider rescans automatically so the device list and the resolved system default stay up to date; the rescan is deferred until the stream finishes when audio is running, since rescanning restarts PortAudio. When the rescan changes the device actually in use, the provider reports the new device through usedInputDeviceChanged/usedOutputDeviceChanged. Other platforms keep a stub listener (no automatic detection).
When a system-side device change (default device switched in the OS, device unplugged) causes the playback or recording device in use to change, show a toast telling the user which device is now used.
Windows: an IMMNotificationClient registered with the WASAPI device enumerator reports device add/remove/state changes and default-device switches; notifications arrive on a WASAPI thread and are marshalled to the main thread and debounced, like the macOS listener. Linux: a udev monitor on the 'sound' subsystem watched through a QSocketNotifier detects devices being plugged and unplugged. Default device changes inside the sound server (PulseAudio/PipeWire) are not visible to udev; the stub is kept when libudev is not available at configure time.
Needed so the udev-based system audio device change detection is actually compiled in CI instead of silently falling back to the stub.
f7fa789 to
1d6a7b0
Compare
1d6a7b0 to
d6273b5
Compare
Resolves: #11389
Resolves: #11394
Adds a "system default" option for playback and recording devices.
Also return a meaningful error if there is no device available and the user tries to record audio.
This PR does not implement refresh on device add/remove, UI actions enable/disable while recording and playback or other tweaks. These implementations will be included on follow up tickets.
Recommended:
QA:
Known limitations: (to confirm and add follow up tickets, please)