Detecting inifinte MIDI feedback loop

If outgoing MIDI is immediately reflected by some receiving app and comes back as input, which in turn is sent out again (MIDI through, input monitoring, etc) … it’s an infinite feedback loop that wreaks considerable havoc on the system.

This does not only happen with MIDI loopback drivers (aka virtual MIDI cables). It’s also likely where external hardware is involved, or where a DAW does live input monitoring.

That said, how are you detecting these feedbacks? There are basically two approaches, one is to probe what’s going out and compare it with what’s coming in. The other simply measures midi messages received per millisecond and rings alarm when a threshold is met.

That probing method seems pretty accurate, but overkill somehow. Anyone tried the simple metering approach with success? Any other ideas?