Tutorial: Build a MIDI Synthesizer code formatting of MidiInputCallback objects

I was going through the JUCE tutorial “Build a MIDI synthesizer,” and I came across something under the sections titled “Providing a MIDI input to the SynthAudioSource” and “Listing MIDI inputs,” respectively. There’s a part of the former section that says:

“In our MainContentComponent class we’ll add this MidiMessageCollector object as a MidiInputCallback object to our application’s AudioDeviceManager object.”

In the latter section, it says
“Notice that we add the MidiMessageCollector object from our SynthAudioSource object as a MidiInputCallback object [12] for the specified MIDI input device. We also need to remove the previous MidiInputCallback object for the previously selected MIDI input device if the user changes the selected device using the combo-box [13].”

Since the tutorial doesn’t seem to indicate how to format those two instructions in the specific code and the links to the objects like MidiMessageCollector and MidiInputCallback show several functions and ways of formatting for coding, I don’t know how or where I’m supposed to add and remove the MidiInputCallback objects suitable for these sections or the particular parts of the coding (in the .h file attached to the ZIP file for the tutorial’s demo project). What should I do, or how/where should I format it?

It looks like those annotations are missing from the tutorial files, we’ll get that updated on the website.

[12] should be pointing to the line:

deviceManager.addMidiInputDeviceCallback (newInput.identifier, synthAudioSource.getMidiCollector());

and [13] to:

deviceManager.removeMidiInputDeviceCallback (list[lastInputIndex].identifier, synthAudioSource.getMidiCollector());

You don’t need to add any code at these steps, it’s just explaining the existing code.