diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-09-12 00:04:31 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-09-12 00:04:31 +0200 |
| commit | 6c868a634615405a88b874eeae114ac3ef841750 (patch) | |
| tree | 4831f49ab3250f94ce57d95dfda2c31884b04184 | |
| parent | 91f92cf4126a4f291d8e8d841e3f147e795088cb (diff) | |
Cleanup: add AudioBackend::device_count().
| -rw-r--r-- | src/wx/audio_backend.cc | 7 | ||||
| -rw-r--r-- | src/wx/audio_backend.h | 1 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/wx/audio_backend.cc b/src/wx/audio_backend.cc index 3fb902ebb..fbf75e3df 100644 --- a/src/wx/audio_backend.cc +++ b/src/wx/audio_backend.cc @@ -248,3 +248,10 @@ AudioBackend::stream_time() const return const_cast<RtAudio&>(_rtaudio).getStreamTime(); } + +int +AudioBackend::device_count() const +{ + return const_cast<RtAudio&>(_rtaudio).getDeviceCount(); +} + diff --git a/src/wx/audio_backend.h b/src/wx/audio_backend.h index 0ed80dd25..12513aeb4 100644 --- a/src/wx/audio_backend.h +++ b/src/wx/audio_backend.h @@ -44,6 +44,7 @@ public: std::vector<std::string> device_names(); boost::optional<std::string> default_device_name(); boost::optional<int> device_channels(std::string name); + int device_count() const; void abort_stream_if_running(); boost::optional<std::string> start_stream(); diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index b46d316e9..82b4e5287 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -609,7 +609,7 @@ FilmViewer::config_changed (Config::Property p) audio.closeStream(); } - if (Config::instance()->sound() && audio.getDeviceCount() > 0) { + if (Config::instance()->sound() && backend->device_count() > 0) { optional<unsigned int> chosen_device_id; #if (RTAUDIO_VERSION_MAJOR >= 6) if (Config::instance()->sound_output()) { |
