Changeset - r27950:709502b00cf1
[Not reviewed]
master
0 1 0
frosch - 15 months ago 2023-09-17 18:49:22
frosch@openttd.org
Cleanup: TransmitNotesOff is only called with buffer==_buffer.
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/music/dmusic.cpp
Show inline comments
 
@@ -565,19 +565,19 @@ static void TransmitStandardSysex(IDirec
 
static void TransmitNotesOff(IDirectMusicBuffer *buffer, REFERENCE_TIME block_time, REFERENCE_TIME cur_time)
 
{
 
	for (int ch = 0; ch < 16; ch++) {
 
		TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0);
 
		TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0);
 
		TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0);
 
		TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0);
 
		TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0);
 
		TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0);
 
	}
 

	
 
	/* Performing a GM reset stops all sound and resets all parameters. */
 
	TransmitStandardSysex(_buffer, block_time + 20, MidiSysexMessage::ResetGM);
 
	TransmitStandardSysex(_buffer, block_time + 30, MidiSysexMessage::RolandSetReverb);
 
	TransmitStandardSysex(buffer, block_time + 20, MidiSysexMessage::ResetGM);
 
	TransmitStandardSysex(buffer, block_time + 30, MidiSysexMessage::RolandSetReverb);
 

	
 
	/* Explicitly flush buffer to make sure the messages are processed,
 
	 * as we want sound to stop immediately. */
 
	_port->PlayBuffer(_buffer);
 
	_buffer->Flush();
 
	_port->PlayBuffer(buffer);
 
	buffer->Flush();
 

	
 
	/* Wait until message time has passed. */
 
	Sleep(Clamp((block_time - cur_time) / MS_TO_REFTIME, 5, 1000));
0 comments (0 inline, 0 general)