Browse Source

Show current sample rate and block size in AudioWidget menu. Increase minimum RtAudio block size back up to 32.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
9e44616837
3 changed files with 19 additions and 6 deletions
  1. +0
    -1
      CHANGELOG.md
  2. +17
    -4
      src/app/AudioWidget.cpp
  3. +2
    -1
      src/rtaudio.cpp

+ 0
- 1
CHANGELOG.md View File

@@ -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.


+ 17
- 4
src/app/AudioWidget.cpp View File

@@ -1,6 +1,7 @@
#include <app/AudioWidget.hpp>
#include <ui/MenuSeparator.hpp>
#include <helpers.hpp>
#include <set>


namespace rack {
@@ -154,10 +155,16 @@ static void appendAudioSampleRateMenu(ui::Menu* menu, audio::Port* port) {
return;

std::vector<int> sampleRates = port->getSampleRates();
if (sampleRates.empty()) {
std::set<int> 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<int> blockSizes = port->getBlockSizes();
if (blockSizes.empty()) {
std::set<int> 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;


+ 2
- 1
src/rtaudio.cpp View File

@@ -161,7 +161,8 @@ struct RtAudioDevice : audio::Device {

std::vector<int> getBlockSizes() override {
std::vector<int> 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;


Loading…
Cancel
Save