mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioDeviceSelectorComponent: Always show the actual samplerate of the device
Previously, the samplerate combo would display as a blank box in the case that the device's actual samplerate wasn't one of the "available" samplerates reported by the device.
This commit is contained in:
parent
fd87195941
commit
ceae64dd40
1 changed files with 7 additions and 3 deletions
|
|
@ -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); };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue