Feature: Audio Device Selection#2826
Merged
Merged
Conversation
8ff2acd to
8a1fb2b
Compare
Member
|
This works equally well for both speech and audio clips. I'll convert the hardcoded "Default Device" string into a localizable resource and then merge. o7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Audio Device Selection for Text-to-Speech & Audio Output
Summary
This PR adds the ability for users to select a specific audio playback device for all speech and audio generated by EDDI, rather than always outputting to the default Windows audio device.
The selected device configuration persists across sessions. If the configured device becomes unavailable (e.g., unplugged), the app automatically and gracefully falls back to the system's "Default Device" and saves that update.
Additionally, this PR features a zero-overhead window message listener to automatically refresh available audio devices and update selection when hardware is plugged in or unplugged in real-time.
Detailed Changes
1. Configuration Storage & Logic
ConfigService/Configurations/SpeechServiceConfiguration.cs:AudioDeviceproperty (serialised asaudioDeviceinspeech.json) to persist the chosen device ID.AudioDevicetonullonClear().2. Audio Device Enumeration & Playback Routing
SpeechService/AudioDevice.cs:AudioDevicerepresentation class.AudioDeviceServicewith a static methodGetAudioDevices()to query active audio endpoints using NAudio.SpeechService/SoundManager.cs:GetSoundOut(IWaveProvider provider)to checkspeechServiceConfiguration.AudioDevice.MMDeviceand instantiatesWasapiOut(device, ...).new WasapiOut()if the device is not found or fails to initialise.3. User Interface, Localisation & Real-time Tracking
EddiUI/Properties/Resources.resx&Resources.Designer.cs:tab_tts_audio_device_label("Audio device:").EddiUI/TextToSpeechTab.xaml:EddiUI/TextToSpeechTab.xaml.cs:WM_DEVICECHANGE(0x0219) native message hook onLoaded(removed onUnloaded) to catch system hardware changes. This allows the dropdown list and selection to refresh dynamically in real-time without background polling overhead.4. Build System Fix
BuildInstaller/BuildInstaller.csproj:$(SolutionDir)path in double-quotes inside thePostBuildEventbatch command invocation. This fixes a build failure that occurred when the project was located in a path containing spaces.