@@ -189,27 +189,34 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
189189 }
190190*/
191191
192+ bool blockSpamThru = m_pConfig->GetMIDIThruBlockSpam ();
192193 // Handle MIDI Thru
193- if (m_DeviceName.compare (m_pConfig->GetMIDIThruIn ()) == 0 )
194- {
195- TDeviceMap::const_iterator Iterator;
194+ bool canThru = ( (nLength > 1 ) || !blockSpamThru
195+ || (pMessage[0 ] != MIDI_TIMING_CLOCK && pMessage[0 ] != MIDI_ACTIVE_SENSING) );
196196
197- Iterator = s_DeviceMap.find (m_pConfig->GetMIDIThruOut ());
198- if (Iterator != s_DeviceMap.end ())
197+ if (canThru)
198+ {
199+ if (m_DeviceName.compare (m_pConfig->GetMIDIThruIn ()) == 0 )
199200 {
200- Iterator->second ->Send (pMessage, nLength, nCable);
201- }
202- }
201+ TDeviceMap::const_iterator Iterator;
203202
204- // Handle MIDI Thru 2
205- if (m_DeviceName.compare (m_pConfig->GetMIDIThru2In ()) == 0 )
206- {
207- TDeviceMap::const_iterator Iterator;
203+ Iterator = s_DeviceMap.find (m_pConfig->GetMIDIThruOut ());
204+ if (Iterator != s_DeviceMap.end ())
205+ {
206+ Iterator->second ->Send (pMessage, nLength, nCable);
207+ }
208+ }
208209
209- Iterator = s_DeviceMap. find (m_pConfig-> GetMIDIThru2Out ());
210- if (Iterator != s_DeviceMap. end () )
210+ // Handle MIDI Thru 2
211+ if (m_DeviceName. compare (m_pConfig-> GetMIDIThru2In ()) == 0 )
211212 {
212- Iterator->second ->Send (pMessage, nLength, nCable);
213+ TDeviceMap::const_iterator Iterator;
214+
215+ Iterator = s_DeviceMap.find (m_pConfig->GetMIDIThru2Out ());
216+ if (Iterator != s_DeviceMap.end ())
217+ {
218+ Iterator->second ->Send (pMessage, nLength, nCable);
219+ }
213220 }
214221 }
215222
0 commit comments