Transmit 'Note off' messages to all MIDI channels. */
| 553 | |
| 554 | /** Transmit 'Note off' messages to all MIDI channels. */ |
| 555 | static void TransmitNotesOff(IDirectMusicBuffer *buffer, REFERENCE_TIME block_time, REFERENCE_TIME cur_time) |
| 556 | { |
| 557 | for (int ch = 0; ch < 16; ch++) { |
| 558 | TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0); |
| 559 | TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0); |
| 560 | TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0); |
| 561 | } |
| 562 | |
| 563 | /* Performing a GM reset stops all sound and resets all parameters. */ |
| 564 | TransmitStandardSysex(buffer, block_time + 20, MidiSysexMessage::ResetGM); |
| 565 | TransmitStandardSysex(buffer, block_time + 30, MidiSysexMessage::RolandSetReverb); |
| 566 | |
| 567 | /* Explicitly flush buffer to make sure the messages are processed, |
| 568 | * as we want sound to stop immediately. */ |
| 569 | _port->PlayBuffer(buffer); |
| 570 | buffer->Flush(); |
| 571 | |
| 572 | /* Wait until message time has passed. */ |
| 573 | Sleep(Clamp((block_time - cur_time) / MS_TO_REFTIME, 5, 1000)); |
| 574 | } |
| 575 | |
| 576 | static void MidiThreadProc() |
| 577 | { |
no test coverage detected