| 484 | } |
| 485 | |
| 486 | void PlaybackManager::executeFMStepEvents(const Step& step, int ch, bool calledByNoteDelay) |
| 487 | { |
| 488 | if (!calledByNoteDelay && !step.isEmptyNote()) clearFMDelayBeyondStepCounts(ch); // Except no key event |
| 489 | |
| 490 | // Set volume |
| 491 | int vol = step.getVolume(); |
| 492 | if (step.hasVolume() && vol < bt_defs::NSTEP_FM_VOLUME) { |
| 493 | opnaCtrl_->setVolumeFM(ch, vol); |
| 494 | } |
| 495 | |
| 496 | // Set instrument |
| 497 | if (step.hasInstrument()) { |
| 498 | if (auto inst = std::dynamic_pointer_cast<InstrumentFM>( |
| 499 | instMan_.lock()->getInstrumentSharedPtr(step.getInstrumentNumber()))) |
| 500 | opnaCtrl_->setInstrumentFM(ch, inst); |
| 501 | } |
| 502 | else { |
| 503 | opnaCtrl_->restoreFMEnvelopeFromReset(ch); |
| 504 | } |
| 505 | |
| 506 | // Set effect |
| 507 | executeStoredEffectsFM(ch); |
| 508 | |
| 509 | // Set key |
| 510 | int noteNum = step.getNoteNumber(); |
| 511 | switch (noteNum) { |
| 512 | case Step::NOTE_NONE: |
| 513 | if (!calledByNoteDelay) { |
| 514 | // When this is called by note delay, skip delay check because it has already checked. |
| 515 | checkFMDelayEventsInTick(step, ch); |
| 516 | } |
| 517 | opnaCtrl_->tickEvent(SoundSource::FM, ch); |
| 518 | break; |
| 519 | case Step::NOTE_KEY_OFF: |
| 520 | opnaCtrl_->keyOffFM(ch); |
| 521 | break; |
| 522 | case Step::NOTE_KEY_CUT: |
| 523 | opnaCtrl_->resetFMChannelEnvelope(ch); |
| 524 | break; |
| 525 | case Step::NOTE_ECHO0: |
| 526 | opnaCtrl_->keyOnFM(ch, 0); |
| 527 | break; |
| 528 | case Step::NOTE_ECHO1: |
| 529 | opnaCtrl_->keyOnFM(ch, 1); |
| 530 | break; |
| 531 | case Step::NOTE_ECHO2: |
| 532 | opnaCtrl_->keyOnFM(ch, 2); |
| 533 | break; |
| 534 | case Step::NOTE_ECHO3: |
| 535 | opnaCtrl_->keyOnFM(ch, 3); |
| 536 | break; |
| 537 | default: // Key on |
| 538 | opnaCtrl_->keyOnFM(ch, Note(noteNum)); |
| 539 | break; |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | void PlaybackManager::executeSSGStepEvents(const Step& step, int ch, bool calledByNoteDelay) |
nothing calls this directly
no test coverage detected