#54: Deprecated sending of TuneRequests with sendRealTime.
This commit is contained in:
parent
ac1925a74f
commit
300cb139e9
22
src/MIDI.hpp
22
src/MIDI.hpp
|
|
@ -176,7 +176,7 @@ void MidiInterface<SerialPort, Settings>::send(MidiType inType,
|
|||
mSerial.write(inData2);
|
||||
}
|
||||
}
|
||||
else if (inType >= TuneRequest && inType <= SystemReset)
|
||||
else if (inType >= Clock && inType <= SystemReset)
|
||||
{
|
||||
sendRealTime(inType); // System Real-time and 1 byte.
|
||||
}
|
||||
|
|
@ -344,7 +344,12 @@ void MidiInterface<SerialPort, Settings>::sendSysEx(unsigned inLength,
|
|||
template<class SerialPort, class Settings>
|
||||
void MidiInterface<SerialPort, Settings>::sendTuneRequest()
|
||||
{
|
||||
sendRealTime(TuneRequest);
|
||||
mSerial.write(TuneRequest);
|
||||
|
||||
if (Settings::UseRunningStatus)
|
||||
{
|
||||
mRunningStatus_TX = InvalidType;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Send a MIDI Time Code Quarter Frame.
|
||||
|
|
@ -412,15 +417,16 @@ void MidiInterface<SerialPort, Settings>::sendSongSelect(DataByte inSongNumber)
|
|||
|
||||
\param inType The available Real Time types are:
|
||||
Start, Stop, Continue, Clock, ActiveSensing and SystemReset.
|
||||
You can also send a Tune Request with this method.
|
||||
@see MidiType
|
||||
*/
|
||||
template<class SerialPort, class Settings>
|
||||
void MidiInterface<SerialPort, Settings>::sendRealTime(MidiType inType)
|
||||
{
|
||||
// Do not invalidate Running Status for real-time messages
|
||||
// as they can be interleaved within any message.
|
||||
|
||||
switch (inType)
|
||||
{
|
||||
case TuneRequest: // Not really real-time, but one byte anyway.
|
||||
case Clock:
|
||||
case Start:
|
||||
case Stop:
|
||||
|
|
@ -433,14 +439,6 @@ void MidiInterface<SerialPort, Settings>::sendRealTime(MidiType inType)
|
|||
// Invalid Real Time marker
|
||||
break;
|
||||
}
|
||||
|
||||
// Do not cancel Running Status for real-time messages as they can be
|
||||
// interleaved within any message. Though, TuneRequest can be sent here,
|
||||
// and as it is a System Common message, it must reset Running Status.
|
||||
if (Settings::UseRunningStatus && inType == TuneRequest)
|
||||
{
|
||||
mRunningStatus_TX = InvalidType;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Start a Registered Parameter Number frame.
|
||||
|
|
|
|||
|
|
@ -126,10 +126,9 @@ TEST(MidiOutput, sendGenericRealTimeShortcut)
|
|||
SerialMock serial;
|
||||
MidiInterface midi(serial);
|
||||
Buffer buffer;
|
||||
buffer.resize(7);
|
||||
buffer.resize(6);
|
||||
|
||||
midi.begin();
|
||||
midi.send(midi::TuneRequest, 47, 42, 12);
|
||||
midi.send(midi::Clock, 47, 42, 12);
|
||||
midi.send(midi::Start, 47, 42, 12);
|
||||
midi.send(midi::Continue, 47, 42, 12);
|
||||
|
|
@ -137,9 +136,9 @@ TEST(MidiOutput, sendGenericRealTimeShortcut)
|
|||
midi.send(midi::ActiveSensing, 47, 42, 12);
|
||||
midi.send(midi::SystemReset, 47, 42, 12);
|
||||
|
||||
EXPECT_EQ(serial.mTxBuffer.getLength(), 7);
|
||||
serial.mTxBuffer.read(&buffer[0], 7);
|
||||
EXPECT_THAT(buffer, ElementsAreArray({0xf6, 0xf8, 0xfa, 0xfb, 0xfc, 0xfe, 0xff}));
|
||||
EXPECT_EQ(serial.mTxBuffer.getLength(), 6);
|
||||
serial.mTxBuffer.read(&buffer[0], 6);
|
||||
EXPECT_THAT(buffer, ElementsAreArray({0xf8, 0xfa, 0xfb, 0xfc, 0xfe, 0xff}));
|
||||
}
|
||||
|
||||
// --
|
||||
|
|
|
|||
Loading…
Reference in New Issue