MIDI library question (fortyseveneffects)

Hello, I'm using the Callbacks.ino example as a starting point for processing MIDI in and out. The example works fine but I cannot turn off MIDI Thru. It seems that MIDIUART.turnThruOff(); is no longer in the MIDI library. Thru::Mode is listed as a structure in the current docs but wont compile tho I do <#include midi_Defs.h> and tried both Thru::Off, Thru::0 and Thru.Off and 0.
Can anyone help me to turn off MIDI Thru? I'm also curious why the scope resolution operator :: is shown to address a structure instead of the dot operator. I confess I'm a newbee at C++ but have been writing ASM and plain C for many years and wrote a lot of MIDI processing code 40 years in DOS and a synth editor in Win98. Now I getting back into MIDI processing in my retirement and am slow catching up with C++ Thanks for any help. Aaron

There are many MIDI libraries. Which one? Post a GitHub link to it.

Which Arduino board are you compiling for?

Thanks, I'm using the MIDI library at: Forty Seven Effects ยท GitHub on a UNO R3 with Arduino IDE 2.3.2 In Win 10-64. The included Callbacks.ino from the library runs fine but I can't turn off MIDI Thru. Thanks again for your reply, Aaron

I'm not sure what you mean. I see that function in the source code on GitHub (MIDI.h & MIDI.cpp) and it's used in the Chaining.ino example.

Mind you, I know next to nothing about MIDI, I'm just looking through the code.

Thanks for the quick reply. You've put me on the right track. I had found "MIDIUART.turnThruOff()" on an old forum post but not in the Doxygen extended documentation, but I did find "Thru::Mode" in it but couldn't figure out how to use it. You found a similar function in the chaining example: "MIDI.turnThruOff()" that I'll bet works but it is not in the Doxygen doc. Lesson for me is that the Doxygen doc is not all that reliable and searching examples or asking on forums is the way to go. I really appreciate your help. I just compiled it and it works! No MIDI Thru.
I also realize how rusty I am at programming. And I notice that making an enumeration by creating elements in a structure is something I've never seen before. I've only used the old?
enum Name { Monday, Tuesday, Wednesday.....etc. Thanks again for your help. Aaron

FYI, the construct is known as a "scoped enum" or "enum class".

Thanks, always more to learn. A

Troubles continue. I thought I had it working but it's not. I added MIDI.turnThruOff(); to the Callbacks example in the setup at line 43, using the same syntax as the Chaining example. It compiles, uploads and runs OK but MIDI Thru is still on and sending all messages out. What am I dong wrong? Thanks for any help, Aaron

Sorry, I may not have inserted the code in correctly but it still looks readable.

// Callbacks2.ino
// added MIDI.turnThruOff(); at line 43
#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

// ------------------------------------------------------------

// This function will be automatically called when a NoteOn is received.
// It must be a void-returning function with the correct parameters,
// see documentation here:
// https://github.com/FortySevenEffects/arduino_midi_library/wiki/Using-Callbacks

void handleNoteOn(byte channel, byte pitch, byte velocity) {
  // Do whatever you want when a note is pressed.

  // Try to keep your callbacks short (no delays ect)
  // otherwise it would slow down the loop() and have a bad impact
  // on real-time performance.
}

void handleNoteOff(byte channel, byte pitch, byte velocity) {
  // Do something when the note is released.
  // Note that NoteOn messages with 0 velocity are interpreted as NoteOffs.
}

// -----------------------------------------------------------------------------

void setup() {
  // Connect the handleNoteOn function to the library,
  // so it is called upon reception of a NoteOn.
  MIDI.setHandleNoteOn(handleNoteOn);  // Put only the name of the function

  // Do the same for NoteOffs
  MIDI.setHandleNoteOff(handleNoteOff);

  // Initiate MIDI communications, listen to all channels
  MIDI.begin(MIDI_CHANNEL_OMNI);

  MIDI.turnThruOff();
}

void loop() {
  // Call MIDI.read the fastest you can for real-time performance.
  MIDI.read();

  // There is no need to check if there are messages incoming
  // if they are bound to a Callback function.
  // The attached method will be called automatically
  // when the corresponding message has been received.
}