reworked active Sensing
This commit is contained in:
parent
ff3052ceb4
commit
2685bb458b
|
|
@ -282,7 +282,6 @@ private:
|
|||
MidiMessage mMessage;
|
||||
unsigned long mLastMessageSentTime;
|
||||
unsigned long mLastMessageReceivedTime;
|
||||
unsigned long mSenderActiveSensingPeriodicity;
|
||||
bool mReceiverActiveSensingActivated;
|
||||
int8_t mLastError;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,11 +44,9 @@ inline MidiInterface<Transport, Settings, Platform>::MidiInterface(Transport& in
|
|||
, mThruFilterMode(Thru::Full)
|
||||
, mLastMessageSentTime(0)
|
||||
, mLastMessageReceivedTime(0)
|
||||
, mSenderActiveSensingPeriodicity(0)
|
||||
, mReceiverActiveSensingActivated(false)
|
||||
, mLastError(0)
|
||||
{
|
||||
mSenderActiveSensingPeriodicity = Settings::SenderActiveSensingPeriodicity;
|
||||
}
|
||||
|
||||
/*! \brief Destructor for MidiInterface.
|
||||
|
|
@ -720,7 +718,7 @@ inline bool MidiInterface<Transport, Settings, Platform>::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 (Settings::UseSenderActiveSensing && (mSenderActiveSensingPeriodicity > 0) && (Platform::now() - mLastMessageSentTime) > mSenderActiveSensingPeriodicity)
|
||||
if (Settings::UseSenderActiveSensing && (Platform::now() - mLastMessageSentTime) > Settings::SenderActiveSensingPeriodicity)
|
||||
{
|
||||
sendActiveSensing();
|
||||
mLastMessageSentTime = Platform::now();
|
||||
|
|
@ -1384,7 +1382,7 @@ inline void MidiInterface<Transport, Settings, Platform>::turnThruOff()
|
|||
template<class Transport, class Settings, class Platform>
|
||||
inline void MidiInterface<Transport, Settings, Platform>::UpdateLastSentTime()
|
||||
{
|
||||
if (Settings::UseSenderActiveSensing && mSenderActiveSensingPeriodicity)
|
||||
if (Settings::UseSenderActiveSensing)
|
||||
mLastMessageSentTime = Platform::now();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ struct DefaultSettings
|
|||
/*! Global switch to turn on/off sender ActiveSensing
|
||||
Set to true to send ActiveSensing
|
||||
Set to false will not send ActiveSensing message (will also save memory)
|
||||
as often as possible (1000 / SenderActiveSensingPeriodicity per second).
|
||||
*/
|
||||
static const bool UseSenderActiveSensing = false;
|
||||
|
||||
|
|
@ -95,10 +96,8 @@ struct DefaultSettings
|
|||
|
||||
Typical value is 250 (ms) - an Active Sensing command is send every 250ms.
|
||||
(All Roland devices send Active Sensing every 250ms)
|
||||
|
||||
Setting this field to 0 will disable sending MIDI active sensing.
|
||||
*/
|
||||
static const uint16_t SenderActiveSensingPeriodicity = 0;
|
||||
static const uint16_t SenderActiveSensingPeriodicity = 250;
|
||||
};
|
||||
|
||||
END_MIDI_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -116,10 +116,11 @@ END_MIDI_NAMESPACE
|
|||
#endif
|
||||
|
||||
/*! \brief Create an instance of the library attached to a serial port with
|
||||
custom settings.
|
||||
custom MIDI settings (not to be confused with modified Serial Settings, like BaudRate)
|
||||
@see DefaultSettings
|
||||
@see MIDI_CREATE_INSTANCE
|
||||
*/
|
||||
#define MIDI_CREATE_CUSTOM_INSTANCE(Type, SerialPort, Name, Settings) \
|
||||
MIDI_NAMESPACE::SerialMIDI<Type> serial##Name(SerialPort);\
|
||||
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<Type>, Settings> Name((MIDI_NAMESPACE::SerialMIDI<Type>&)serial##Name);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue