MCPcopy Create free account
hub / github.com/davy7125/polyphone / getEnabledKeysForInstrument

Method getEnabledKeysForInstrument

sources/editor/editor.cpp:459–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459QVector<bool> Editor::getEnabledKeysForInstrument(EltID idInst)
460{
461 SoundfontManager * sf2 = SoundfontManager::getInstance();
462 QVector<bool> result(128);
463 result.fill(false);
464
465 // Default range of this instrument
466 RangesType defInstRange;
467 if (sf2->isSet(idInst, champ_keyRange))
468 defInstRange = sf2->get(idInst, champ_keyRange).rValue;
469 else
470 {
471 defInstRange.byLo = 0;
472 defInstRange.byHi = 127;
473 }
474
475 // Browse all divisions inside the instrument
476 EltID idInstSmpl(elementInstSmpl, idInst.indexSf2, idInst.indexElt);
477 foreach (int j, sf2->getSiblings(idInstSmpl))
478 {
479 idInstSmpl.indexElt2 = j;
480 RangesType instDivRange = defInstRange;
481 if (sf2->isSet(idInstSmpl, champ_keyRange))
482 instDivRange = sf2->get(idInstSmpl, champ_keyRange).rValue;
483
484 // And set all used keys to "true"
485 for (unsigned int key = instDivRange.byLo; key <= instDivRange.byHi; key++)
486 result[key] = true;
487 }
488
489 return result;
490}
491
492void Editor::onErrorEncountered(QString text)
493{

Callers

nothing calls this directly

Calls 2

isSetMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected