diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp index 2a8d08879..d2c41db7d 100644 --- a/src/duckstation-qt/audiosettingswidget.cpp +++ b/src/duckstation-qt/audiosettingswidget.cpp @@ -209,7 +209,8 @@ void AudioSettingsWidget::updateDeviceNames() const AudioBackend backend = getEffectiveBackend(); const std::string driver_name = m_dialog->getEffectiveStringValue("Audio", "Driver", ""); const std::string current_device = m_dialog->getEffectiveStringValue("Audio", "Device", ""); - const std::vector devices = AudioStream::GetOutputDevices(backend, driver_name.c_str()); + const std::vector devices = + AudioStream::GetOutputDevices(backend, driver_name.c_str(), SPU::SAMPLE_RATE); m_ui.outputDevice->disconnect(); m_ui.outputDevice->clear(); diff --git a/src/util/audio_stream.cpp b/src/util/audio_stream.cpp index 6808ff06b..b512fc288 100644 --- a/src/util/audio_stream.cpp +++ b/src/util/audio_stream.cpp @@ -88,14 +88,14 @@ std::vector> AudioStream::GetDriverNames(Aud return ret; } -std::vector AudioStream::GetOutputDevices(AudioBackend backend, const char* driver) +std::vector AudioStream::GetOutputDevices(AudioBackend backend, const char* driver, u32 sample_rate) { std::vector ret; switch (backend) { #ifndef __ANDROID__ case AudioBackend::Cubeb: - ret = GetCubebOutputDevices(driver); + ret = GetCubebOutputDevices(driver, sample_rate); break; #endif diff --git a/src/util/audio_stream.h b/src/util/audio_stream.h index 852561e5e..b83b4f176 100644 --- a/src/util/audio_stream.h +++ b/src/util/audio_stream.h @@ -192,7 +192,7 @@ public: void SetStretchMode(AudioStretchMode mode); static std::vector> GetDriverNames(AudioBackend backend); - static std::vector GetOutputDevices(AudioBackend backend, const char* driver); + static std::vector GetOutputDevices(AudioBackend backend, const char* driver, u32 sample_rate); static std::unique_ptr CreateStream(AudioBackend backend, u32 sample_rate, const AudioStreamParameters& parameters, const char* driver_name, const char* device_name, Error* error = nullptr); @@ -242,7 +242,7 @@ private: #ifndef __ANDROID__ static std::vector> GetCubebDriverNames(); - static std::vector GetCubebOutputDevices(const char* driver); + static std::vector GetCubebOutputDevices(const char* driver, u32 sample_rate); static std::unique_ptr CreateCubebAudioStream(u32 sample_rate, const AudioStreamParameters& parameters, const char* driver_name, const char* device_name, Error* error); diff --git a/src/util/cubeb_audio_stream.cpp b/src/util/cubeb_audio_stream.cpp index 8bd0f29ac..76d6df0fd 100644 --- a/src/util/cubeb_audio_stream.cpp +++ b/src/util/cubeb_audio_stream.cpp @@ -311,7 +311,7 @@ std::vector> AudioStream::GetCubebDriverName return names; } -std::vector AudioStream::GetCubebOutputDevices(const char* driver) +std::vector AudioStream::GetCubebOutputDevices(const char* driver, u32 sample_rate) { std::vector ret; ret.emplace_back(std::string(), TRANSLATE_STR("AudioStream", "Default"), 0); @@ -339,7 +339,7 @@ std::vector AudioStream::GetCubebOutputDevices(const ch // we need stream parameters to query latency cubeb_stream_params params = {}; params.format = CUBEB_SAMPLE_S16LE; - params.rate = 48000; + params.rate = sample_rate; params.channels = 2; params.layout = CUBEB_LAYOUT_UNDEFINED; params.prefs = CUBEB_STREAM_PREF_NONE;