MCPcopy Create free account
hub / github.com/FastLED/FastLED / thruFilter

Method thruFilter

examples/LuminescentGrand/arduino/MIDI.hpp:1400–1483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1398// is matching the input channel and the filter setting
1399template<class Transport, class Settings, class Platform>
1400void MidiInterface<Transport, Settings, Platform>::thruFilter(Channel inChannel)
1401{
1402 // If the feature is disabled, don't do anything.
1403 if (!mThruActivated || (mThruFilterMode == Thru::Off))
1404 return;
1405
1406 // First, check if the received message is Channel
1407 if (mMessage.type >= NoteOff && mMessage.type <= PitchBend)
1408 {
1409 const bool filter_condition = ((mMessage.channel == inChannel) ||
1410 (inChannel == MIDI_CHANNEL_OMNI));
1411
1412 // Now let's pass it to the output
1413 switch (mThruFilterMode)
1414 {
1415 case Thru::Full:
1416 send(mMessage.type,
1417 mMessage.data1,
1418 mMessage.data2,
1419 mMessage.channel);
1420 break;
1421
1422 case Thru::SameChannel:
1423 if (filter_condition)
1424 {
1425 send(mMessage.type,
1426 mMessage.data1,
1427 mMessage.data2,
1428 mMessage.channel);
1429 }
1430 break;
1431
1432 case Thru::DifferentChannel:
1433 if (!filter_condition)
1434 {
1435 send(mMessage.type,
1436 mMessage.data1,
1437 mMessage.data2,
1438 mMessage.channel);
1439 }
1440 break;
1441
1442 default:
1443 break;
1444 }
1445 }
1446 else
1447 {
1448 // Send the message to the output
1449 switch (mMessage.type)
1450 {
1451 // Real Time and 1 byte
1452 case Clock:
1453 case Start:
1454 case Stop:
1455 case Continue:
1456 case ActiveSensing:
1457 case SystemReset:

Callers

nothing calls this directly

Calls 1

sendFunction · 0.50

Tested by

no test coverage detected