diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-07-25 14:46:44 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-07-26 11:39:59 +0200 |
| commit | 051bac905d3ab8776c804e0e21fecd4c49927549 (patch) | |
| tree | 07fef88f1fa0c53fca71098b63caec8589b0c9cb /src/wx/config_dialog.cc | |
| parent | c7d5e56219f39a6304be9644cc577d89be16b7de (diff) | |
Stop instantiating RtAudio all over the place
and instead just have a singleton. On Windows I saw a situation where
the first instantiation would use ASIO and the second WASAPI, causing
all kinds of confusion.
Diffstat (limited to 'src/wx/config_dialog.cc')
| -rw-r--r-- | src/wx/config_dialog.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index b4adc855e..bbe2278ac 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -19,6 +19,7 @@ */ +#include "audio_backend.h" #include "audio_mapping_view.h" #include "check_box.h" #include "config_dialog.h" @@ -880,7 +881,8 @@ SoundPage::setup () font.SetPointSize (font.GetPointSize() - 1); _sound_output_details->SetFont (font); - RtAudio audio (DCPOMATIC_RTAUDIO_API); + auto& audio = AudioBackend::instance()->rtaudio(); + #if (RTAUDIO_VERSION_MAJOR >= 6) for (auto device_id: audio.getDeviceIds()) { auto dev = audio.getDeviceInfo(device_id); @@ -928,7 +930,8 @@ SoundPage::sound_changed () void SoundPage::sound_output_changed () { - RtAudio audio (DCPOMATIC_RTAUDIO_API); + auto& audio = AudioBackend::instance()->rtaudio(); + auto const so = get_sound_output(); string default_device; #if (RTAUDIO_VERSION_MAJOR >= 6) @@ -957,11 +960,12 @@ SoundPage::config_changed () auto const current_so = get_sound_output (); optional<string> configured_so; + auto& audio = AudioBackend::instance()->rtaudio(); + if (config->sound_output()) { configured_so = config->sound_output().get(); } else { /* No configured output means we should use the default */ - RtAudio audio (DCPOMATIC_RTAUDIO_API); #if (RTAUDIO_VERSION_MAJOR >= 6) configured_so = audio.getDeviceInfo(audio.getDefaultOutputDevice()).name; #else @@ -985,8 +989,6 @@ SoundPage::config_changed () } } - RtAudio audio (DCPOMATIC_RTAUDIO_API); - map<int, wxString> apis; apis[RtAudio::MACOSX_CORE] = _("CoreAudio"); apis[RtAudio::WINDOWS_ASIO] = _("ASIO"); |
