replaced ActiveSensing with Sender Active Sensing
Receiver active Sensing is not implemented (yet)
This commit is contained in:
parent
7f9934b1aa
commit
5fab6b3fc3
|
|
@ -86,8 +86,6 @@ public:
|
|||
DataByte inPressure,
|
||||
Channel inChannel);
|
||||
|
||||
inline void sendActiveSensing();
|
||||
|
||||
inline void sendSysEx(unsigned inLength,
|
||||
const byte* inArray,
|
||||
bool inArrayContainsBoundaries = false);
|
||||
|
|
@ -242,9 +240,10 @@ private:
|
|||
unsigned mCurrentNrpnNumber;
|
||||
bool mThruActivated : 1;
|
||||
Thru::Mode mThruFilterMode : 7;
|
||||
unsigned long mLastMessageSentTime;
|
||||
bool mSenderActiveSensingActivated;
|
||||
MidiMessage mMessage;
|
||||
unsigned long mLastSendMessageTime;
|
||||
bool mActiveSensingActivated;
|
||||
|
||||
|
||||
private:
|
||||
inline StatusByte getStatus(MidiType inType,
|
||||
|
|
|
|||
38
src/MIDI.hpp
38
src/MIDI.hpp
|
|
@ -40,8 +40,8 @@ inline MidiInterface<SerialPort, Settings>::MidiInterface(SerialPort& inSerial)
|
|||
, mPendingMessageIndex(0)
|
||||
, mCurrentRpnNumber(0xffff)
|
||||
, mCurrentNrpnNumber(0xffff)
|
||||
, mActiveSensingActivated(false)
|
||||
, mLastSendMessageTime(0)
|
||||
, mSenderActiveSensingActivated(false)
|
||||
, mLastMessageSentTime(0)
|
||||
, mThruActivated(true)
|
||||
, mThruFilterMode(Thru::Full)
|
||||
{
|
||||
|
|
@ -102,15 +102,15 @@ void MidiInterface<SerialPort, Settings>::begin(Channel inChannel)
|
|||
mCurrentRpnNumber = 0xffff;
|
||||
mCurrentNrpnNumber = 0xffff;
|
||||
|
||||
mActiveSensingActivated = false;
|
||||
mLastSendMessageTime = millis();
|
||||
|
||||
mMessage.valid = false;
|
||||
mMessage.type = InvalidType;
|
||||
mMessage.channel = 0;
|
||||
mMessage.data1 = 0;
|
||||
mMessage.data2 = 0;
|
||||
|
||||
mSenderActiveSensingActivated = Settings::UseSenderActiveSensing;
|
||||
mLastMessageSentTime = millis();
|
||||
|
||||
mThruFilterMode = Thru::Full;
|
||||
mThruActivated = true;
|
||||
}
|
||||
|
|
@ -182,9 +182,9 @@ void MidiInterface<SerialPort, Settings>::send(MidiType inType,
|
|||
{
|
||||
sendRealTime(inType); // System Real-time and 1 byte.
|
||||
}
|
||||
|
||||
if (mActiveSensingActivated)
|
||||
mLastSendMessageTime = millis();
|
||||
|
||||
if (mSenderActiveSensingActivated)
|
||||
mLastMessageSentTime = millis();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -320,22 +320,6 @@ void MidiInterface<SerialPort, Settings>::sendPitchBend(double inPitchValue,
|
|||
sendPitchBend(value, inChannel);
|
||||
}
|
||||
|
||||
/*! \brief Send an Active Sensing message.
|
||||
|
||||
This message is intended to be sent
|
||||
repeatedly to tell the receiver that a connection is alive. Use
|
||||
of this message is optional. When initially received, the
|
||||
receiver will expect to receive another Active Sensing
|
||||
message each 300ms (max), and if it does not then it will
|
||||
assume that the connection has been terminated.
|
||||
*/
|
||||
template<class Encoder, class Settings>
|
||||
void MidiInterface<Encoder, Settings>::sendActiveSensing()
|
||||
{
|
||||
sendRealTime(ActiveSensing);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Generate and send a System Exclusive frame.
|
||||
\param inLength The size of the array to send
|
||||
\param inArray The byte array containing the data to send
|
||||
|
|
@ -682,10 +666,10 @@ inline bool MidiInterface<SerialPort, Settings>::read(Channel inChannel)
|
|||
// assume that the connection has been terminated. At
|
||||
// termination, the receiver will turn off all voices and return to
|
||||
// normal (non- active sensing) operation.
|
||||
if (mActiveSensingActivated && (millis() - mLastSendMessageTime) > 250)
|
||||
if (mSenderActiveSensingActivated && (millis() - mLastMessageSentTime) > 250)
|
||||
{
|
||||
sendActiveSensing();
|
||||
mLastSendMessageTime = millis();
|
||||
sendRealTime(ActiveSensing);
|
||||
mLastMessageSentTime = millis();
|
||||
}
|
||||
|
||||
if (inChannel >= MIDI_CHANNEL_OFF)
|
||||
|
|
|
|||
|
|
@ -61,6 +61,17 @@ struct DefaultSettings
|
|||
*/
|
||||
static const bool HandleNullVelocityNoteOnAsNoteOff = true;
|
||||
|
||||
/*! Active Sensing is intended to be sent
|
||||
repeatedly by the sender to tell the receiver that a connection is alive. Use
|
||||
of this message is optional. When initially received, the
|
||||
receiver will expect to receive another Active Sensing
|
||||
message each 300ms (max), and if it does not then it will
|
||||
assume that the connection has been terminated. At
|
||||
termination, the receiver will turn off all voices and return to
|
||||
normal (non- active sensing) operation..
|
||||
*/
|
||||
static const bool UseSenderActiveSensing = true;
|
||||
|
||||
/*! Setting this to true will make MIDI.read parse only one byte of data for each
|
||||
call when data is available. This can speed up your application if receiving
|
||||
a lot of traffic, but might induce MIDI Thru and treatment latency.
|
||||
|
|
|
|||
Loading…
Reference in New Issue