1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

AudioDeviceSelectorComponent: Tweak buffer size combo box to display the actual buffer size, even it it does not match any reported available buffer size

This commit is contained in:
reuk 2025-05-20 16:05:04 +01:00
parent e92cac9ae0
commit 28a2700a28
No known key found for this signature in database

View file

@ -804,12 +804,19 @@ private:
currentRate = 48000.0;
for (auto bs : currentDevice->getAvailableBufferSizes())
bufferSizeDropDown->addItem (String (bs) + " samples (" + String (bs * 1000.0 / currentRate, 1) + " ms)", bs);
bufferSizeDropDown->addItem (getBufferSizeText (bs, currentRate), bs);
const auto bufferSizeSamples = currentDevice->getCurrentBufferSizeSamples();
bufferSizeDropDown->setText (getBufferSizeText (bufferSizeSamples, currentRate), dontSendNotification);
bufferSizeDropDown->setSelectedId (currentDevice->getCurrentBufferSizeSamples(), dontSendNotification);
bufferSizeDropDown->onChange = [this] { updateConfig (false, false, false, true); };
}
String getBufferSizeText (int bs, double currentRate) const
{
return String (bs) + " samples (" + String (bs * 1000.0 / currentRate, 1) + " ms)";
}
public:
//==============================================================================
class ChannelSelectorListBox final : public ListBox,