| 102 | } |
| 103 | |
| 104 | void NoteCanvas::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation) |
| 105 | { |
| 106 | mNoteOutput.PlayNote(time, pitch, velocity, voiceIdx, modulation); |
| 107 | |
| 108 | if (!mEnabled || !mRecord) |
| 109 | return; |
| 110 | |
| 111 | if (mInputNotes[pitch]) //handle note-offs or retriggers |
| 112 | { |
| 113 | double endPos = GetCurPos(time); |
| 114 | if (mInputNotes[pitch]->GetStart() > endPos) |
| 115 | endPos += 1; //wrap |
| 116 | mInputNotes[pitch]->SetEnd(endPos); |
| 117 | mInputNotes[pitch] = nullptr; |
| 118 | } |
| 119 | |
| 120 | if (velocity > 0) |
| 121 | { |
| 122 | if (mFreeRecord && mFreeRecordStartMeasure == -1) |
| 123 | mFreeRecordStartMeasure = TheTransport->GetMeasure(time); |
| 124 | |
| 125 | double measurePos = GetCurPos(time) * mNumMeasures; |
| 126 | NoteCanvasElement* element = AddNote(measurePos, pitch, velocity, 1 / mCanvas->GetNumCols(), voiceIdx, modulation); |
| 127 | mInputNotes[pitch] = element; |
| 128 | mCanvas->SetRowOffset(element->mRow - mCanvas->GetNumVisibleRows() / 2); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | void NoteCanvas::KeyPressed(int key, bool isRepeat) |
| 133 | { |
no test coverage detected