diff --git a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp index af5c993a12..90ca7483e9 100644 --- a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp @@ -692,13 +692,17 @@ private: sampleRateDropDown->onChange = nullptr; } + const auto getFrequencyString = [] (int rate) { return String (rate) + " Hz"; }; + for (auto rate : currentDevice->getAvailableSampleRates()) { - auto intRate = roundToInt (rate); - sampleRateDropDown->addItem (String (intRate) + " Hz", intRate); + const auto intRate = roundToInt (rate); + sampleRateDropDown->addItem (getFrequencyString (intRate), intRate); } - sampleRateDropDown->setSelectedId (roundToInt (currentDevice->getCurrentSampleRate()), dontSendNotification); + const auto intRate = roundToInt (currentDevice->getCurrentSampleRate()); + sampleRateDropDown->setText (getFrequencyString (intRate), dontSendNotification); + sampleRateDropDown->onChange = [this] { updateConfig (false, false, true, false); }; }