diff --git a/CHANGELOG.md b/CHANGELOG.md index b94607c4..6a395b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,6 @@ In this document, Mod is Ctrl on Windows/Linux and Cmd on Mac. - Break Rack executable into libRack shared library and lightweight standalone Rack executable. - Add support for 1/2x and 1/4x low-fidelity sample rates to engine and "Engine > Sample rates" menu. - Add Escape key command for existing fullscreen, in case F11 doesn't work. -- Allow RtAudio device block size to be as low as 16. - Copy cable color when cloning cables with Ctrl+click. - Fix key commands on AZERTY, Dvorak, and all other keyboard layouts. - Add Mouse device to Computer keyboard/mouse MIDI driver. diff --git a/src/app/AudioWidget.cpp b/src/app/AudioWidget.cpp index 1aa79cc5..0968ce4c 100644 --- a/src/app/AudioWidget.cpp +++ b/src/app/AudioWidget.cpp @@ -1,6 +1,7 @@ #include #include #include +#include namespace rack { @@ -154,10 +155,16 @@ static void appendAudioSampleRateMenu(ui::Menu* menu, audio::Port* port) { return; std::vector sampleRates = port->getSampleRates(); - if (sampleRates.empty()) { + std::set sampleRatesSet(sampleRates.begin(), sampleRates.end()); + // Add current sample rate in case it's not in the list + sampleRatesSet.insert(port->getSampleRate()); + + if (sampleRatesSet.empty()) { menu->addChild(createMenuLabel("(Locked by device)")); } - for (int sampleRate : sampleRates) { + for (int sampleRate : sampleRatesSet) { + if (sampleRate <= 0) + continue; AudioSampleRateValueItem* item = new AudioSampleRateValueItem; item->port = port; item->sampleRate = sampleRate; @@ -214,10 +221,16 @@ static void appendAudioBlockSizeMenu(ui::Menu* menu, audio::Port* port) { return; std::vector blockSizes = port->getBlockSizes(); - if (blockSizes.empty()) { + std::set blockSizesSet(blockSizes.begin(), blockSizes.end()); + // Add current block size in case it's not in the list + blockSizesSet.insert(port->getBlockSize()); + + if (blockSizesSet.empty()) { menu->addChild(createMenuLabel("(Locked by device)")); } - for (int blockSize : blockSizes) { + for (int blockSize : blockSizesSet) { + if (blockSize <= 0) + continue; AudioBlockSizeValueItem* item = new AudioBlockSizeValueItem; item->port = port; item->blockSize = blockSize; diff --git a/src/rtaudio.cpp b/src/rtaudio.cpp index 9eee8daa..57a4878f 100644 --- a/src/rtaudio.cpp +++ b/src/rtaudio.cpp @@ -161,7 +161,8 @@ struct RtAudioDevice : audio::Device { std::vector getBlockSizes() override { std::vector blockSizes; - for (int i = 4; i <= 12; i++) { + // 32 to 4096 + for (int i = 5; i <= 12; i++) { blockSizes.push_back(1 << i); } return blockSizes;