#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);
|
mSerial.write(inData2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (inType >= TuneRequest && inType <= SystemReset)
|
else if (inType >= Clock && inType <= SystemReset)
|
||||||
{
|
{
|
||||||
sendRealTime(inType); // System Real-time and 1 byte.
|
sendRealTime(inType); // System Real-time and 1 byte.
|
||||||
}
|
}
|
||||||
|
|
@ -344,7 +344,12 @@ void MidiInterface<SerialPort, Settings>::sendSysEx(unsigned inLength,
|
||||||
template<class SerialPort, class Settings>
|
template<class SerialPort, class Settings>
|
||||||
void MidiInterface<SerialPort, Settings>::sendTuneRequest()
|
void MidiInterface<SerialPort, Settings>::sendTuneRequest()
|
||||||
{
|
{
|
||||||
sendRealTime(TuneRequest);
|
mSerial.write(TuneRequest);
|
||||||
|
|
||||||
|
if (Settings::UseRunningStatus)
|
||||||
|
{
|
||||||
|
mRunningStatus_TX = InvalidType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Send a MIDI Time Code Quarter Frame.
|
/*! \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:
|
\param inType The available Real Time types are:
|
||||||
Start, Stop, Continue, Clock, ActiveSensing and SystemReset.
|
Start, Stop, Continue, Clock, ActiveSensing and SystemReset.
|
||||||
You can also send a Tune Request with this method.
|
|
||||||
@see MidiType
|
@see MidiType
|
||||||
*/
|
*/
|
||||||
template<class SerialPort, class Settings>
|
template<class SerialPort, class Settings>
|
||||||
void MidiInterface<SerialPort, Settings>::sendRealTime(MidiType inType)
|
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)
|
switch (inType)
|
||||||
{
|
{
|
||||||
case TuneRequest: // Not really real-time, but one byte anyway.
|
|
||||||
case Clock:
|
case Clock:
|
||||||
case Start:
|
case Start:
|
||||||
case Stop:
|
case Stop:
|
||||||
|
|
@ -433,14 +439,6 @@ void MidiInterface<SerialPort, Settings>::sendRealTime(MidiType inType)
|
||||||
// Invalid Real Time marker
|
// Invalid Real Time marker
|
||||||
break;
|
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.
|
/*! \brief Start a Registered Parameter Number frame.
|
||||||
|
|
|
||||||
|
|
@ -126,10 +126,9 @@ TEST(MidiOutput, sendGenericRealTimeShortcut)
|
||||||
SerialMock serial;
|
SerialMock serial;
|
||||||
MidiInterface midi(serial);
|
MidiInterface midi(serial);
|
||||||
Buffer buffer;
|
Buffer buffer;
|
||||||
buffer.resize(7);
|
buffer.resize(6);
|
||||||
|
|
||||||
midi.begin();
|
midi.begin();
|
||||||
midi.send(midi::TuneRequest, 47, 42, 12);
|
|
||||||
midi.send(midi::Clock, 47, 42, 12);
|
midi.send(midi::Clock, 47, 42, 12);
|
||||||
midi.send(midi::Start, 47, 42, 12);
|
midi.send(midi::Start, 47, 42, 12);
|
||||||
midi.send(midi::Continue, 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::ActiveSensing, 47, 42, 12);
|
||||||
midi.send(midi::SystemReset, 47, 42, 12);
|
midi.send(midi::SystemReset, 47, 42, 12);
|
||||||
|
|
||||||
EXPECT_EQ(serial.mTxBuffer.getLength(), 7);
|
EXPECT_EQ(serial.mTxBuffer.getLength(), 6);
|
||||||
serial.mTxBuffer.read(&buffer[0], 7);
|
serial.mTxBuffer.read(&buffer[0], 6);
|
||||||
EXPECT_THAT(buffer, ElementsAreArray({0xf6, 0xf8, 0xfa, 0xfb, 0xfc, 0xfe, 0xff}));
|
EXPECT_THAT(buffer, ElementsAreArray({0xf8, 0xfa, 0xfb, 0xfc, 0xfe, 0xff}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --
|
// --
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue