Fixed order of DataEntry bytes (MSB first).

This commit is contained in:
Francois Best 2016-10-07 09:50:37 +02:00
parent a7d6d803a1
commit 34b37f75e8
2 changed files with 53 additions and 4 deletions

View File

@ -471,8 +471,8 @@ inline void MidiInterface<SerialPort, Settings>::sendRpnValue(unsigned inValue,
{; {;
const byte valMsb = 0x7f & (inValue >> 7); const byte valMsb = 0x7f & (inValue >> 7);
const byte valLsb = 0x7f & inValue; const byte valLsb = 0x7f & inValue;
sendControlChange(DataEntryLSB, valLsb, inChannel);
sendControlChange(DataEntryMSB, valMsb, inChannel); sendControlChange(DataEntryMSB, valMsb, inChannel);
sendControlChange(DataEntryLSB, valLsb, inChannel);
} }
/*! \brief Send separate MSB/LSB values for the currently selected RPN number. /*! \brief Send separate MSB/LSB values for the currently selected RPN number.
@ -485,8 +485,8 @@ inline void MidiInterface<SerialPort, Settings>::sendRpnValue(byte inMsb,
byte inLsb, byte inLsb,
Channel inChannel) Channel inChannel)
{ {
sendControlChange(DataEntryLSB, inLsb, inChannel);
sendControlChange(DataEntryMSB, inMsb, inChannel); sendControlChange(DataEntryMSB, inMsb, inChannel);
sendControlChange(DataEntryLSB, inLsb, inChannel);
} }
/* \brief Increment the value of the currently selected RPN number by the specified amount. /* \brief Increment the value of the currently selected RPN number by the specified amount.
@ -551,8 +551,8 @@ inline void MidiInterface<SerialPort, Settings>::sendNrpnValue(unsigned inValue,
{; {;
const byte valMsb = 0x7f & (inValue >> 7); const byte valMsb = 0x7f & (inValue >> 7);
const byte valLsb = 0x7f & inValue; const byte valLsb = 0x7f & inValue;
sendControlChange(DataEntryLSB, valLsb, inChannel);
sendControlChange(DataEntryMSB, valMsb, inChannel); sendControlChange(DataEntryMSB, valMsb, inChannel);
sendControlChange(DataEntryLSB, valLsb, inChannel);
} }
/*! \brief Send separate MSB/LSB values for the currently selected NRPN number. /*! \brief Send separate MSB/LSB values for the currently selected NRPN number.
@ -565,8 +565,8 @@ inline void MidiInterface<SerialPort, Settings>::sendNrpnValue(byte inMsb,
byte inLsb, byte inLsb,
Channel inChannel) Channel inChannel)
{ {
sendControlChange(DataEntryLSB, inLsb, inChannel);
sendControlChange(DataEntryMSB, inMsb, inChannel); sendControlChange(DataEntryMSB, inMsb, inChannel);
sendControlChange(DataEntryLSB, inLsb, inChannel);
} }
/* \brief Increment the value of the currently selected NRPN number by the specified amount. /* \brief Increment the value of the currently selected NRPN number by the specified amount.

View File

@ -244,4 +244,53 @@ TEST(MidiOutput, sendRealTime)
} }
TEST(MidiOutput, RPN)
{
SerialMock serial;
MidiInterface midi(serial);
std::vector<test_mocks::uint8> buffer;
// 14-bit Value Single Frame
{
buffer.clear();
buffer.resize(13);
midi.begin();
midi.beginRpn(1242, 12);
midi.sendRpnValue(12345, 12);
midi.endRpn(12);
EXPECT_EQ(serial.mTxBuffer.getLength(), 13);
serial.mTxBuffer.read(&buffer[0], 13);
EXPECT_THAT(buffer, ElementsAreArray({0xbb,
0x64, 0x5a,
0x65, 0x09,
0x06, 0x60,
0x26, 0x39,
0x64, 0x7f,
0x65, 0x7f}));
}
// MSB/LSB Single Frame
{
}
// Increment Single Frame
{
}
// Decrement Single Frame
{
}
// Multi Frame
{
}
}
TEST(MidiOutput, NRPN)
{
}
END_UNNAMED_NAMESPACE END_UNNAMED_NAMESPACE