| 446 | } |
| 447 | |
| 448 | void detectHangingNotes() |
| 449 | { |
| 450 | for (s32 i = 0; i < MIDI_INSTRUMENT_COUNT; i++) |
| 451 | { |
| 452 | // Skip any instruments not being used. |
| 453 | if (!s_instrOn[i].channelMask) { continue; } |
| 454 | |
| 455 | // Look for used channels. |
| 456 | for (u32 c = 0; c < MIDI_CHANNEL_COUNT; c++) |
| 457 | { |
| 458 | const u32 channelMask = 1u << c; |
| 459 | if ((s_instrOn[i].channelMask & channelMask) && (s_curNoteTime - s_instrOn[i].time[c] > s_maxNoteLength)) |
| 460 | { |
| 461 | // Turn off the note. |
| 462 | sendMessageDirect(MID_NOTE_OFF | c, i); |
| 463 | |
| 464 | // Reset the instrument channel information. |
| 465 | s_instrOn[i].channelMask &= ~channelMask; |
| 466 | s_instrOn[i].time[c] = 0.0; |
| 467 | } |
| 468 | } |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | // Thread Function |
| 473 | int midiUpdateFunc(void* userData) |
no test coverage detected