| 36 | } |
| 37 | |
| 38 | void NoteInputBuffer::Process(double time) |
| 39 | { |
| 40 | PROFILER(NoteInputBuffer); |
| 41 | |
| 42 | //process note offs first |
| 43 | for (int i = 0; i < kBufferSize; ++i) |
| 44 | { |
| 45 | if (mBuffer[i].time != -1 && mBuffer[i].velocity == 0 && |
| 46 | IsTimeWithinFrame(mBuffer[i].time)) |
| 47 | { |
| 48 | NoteInputElement& element = mBuffer[i]; |
| 49 | mReceiver->PlayNote(element.time, element.pitch, element.velocity, element.voiceIdx, element.modulation); |
| 50 | mBuffer[i].time = -1; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | //now process note ons |
| 55 | for (int i = 0; i < kBufferSize; ++i) |
| 56 | { |
| 57 | if (mBuffer[i].time != -1 && mBuffer[i].velocity != 0 && |
| 58 | IsTimeWithinFrame(mBuffer[i].time)) |
| 59 | { |
| 60 | NoteInputElement& element = mBuffer[i]; |
| 61 | mReceiver->PlayNote(element.time, element.pitch, element.velocity, element.voiceIdx, element.modulation); |
| 62 | mBuffer[i].time = -1; |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | void NoteInputBuffer::QueueNote(double time, int pitch, float velocity, int voiceIdx, ModulationParameters modulation) |
| 68 | { |