| 457 | } |
| 458 | |
| 459 | QVector<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 | |
| 492 | void Editor::onErrorEncountered(QString text) |
| 493 | { |