MCPcopy Create free account
hub / github.com/VCVRack/Rack / appendAudioBlockSizeMenu

Function appendAudioBlockSizeMenu

src/app/AudioDisplay.cpp:238–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236};
237
238static void appendAudioBlockSizeMenu(ui::Menu* menu, audio::Port* port) {
239 if (!port)
240 return;
241
242 std::set<int> blockSizes = port->getBlockSizes();
243 // Add current block size in case it's not in the list
244 blockSizes.insert(port->getBlockSize());
245
246 if (blockSizes.empty()) {
247 menu->addChild(createMenuLabel("(" + string::translate("AudioDisplay.lockedByDevice") + ")"));
248 }
249 for (int blockSize : blockSizes) {
250 if (blockSize <= 0)
251 continue;
252 AudioBlockSizeValueItem* item = new AudioBlockSizeValueItem;
253 item->port = port;
254 item->blockSize = blockSize;
255 float latency = (float) blockSize / port->getSampleRate() * 1000.0;
256 item->text = string::f("%d (%.1f ms)", blockSize, latency);
257 item->rightText = CHECKMARK(item->blockSize == port->getBlockSize());
258 menu->addChild(item);
259 }
260}
261
262void AudioBlockSizeChoice::onAction(const ActionEvent& e) {
263 ui::Menu* menu = createMenu();

Callers 3

onActionMethod · 0.85
createChildMenuMethod · 0.85
appendAudioMenuFunction · 0.85

Calls 8

createMenuLabelFunction · 0.85
translateFunction · 0.85
addChildMethod · 0.80
fFunction · 0.50
getBlockSizesMethod · 0.45
getBlockSizeMethod · 0.45
emptyMethod · 0.45
getSampleRateMethod · 0.45

Tested by

no test coverage detected