Touchscreen MIDI Controller: Creating MidiInputs and MidiOutputs

I am trying to develop a launchpad midi controller app in Xcode, but I am having trouble with properly setting up the midi connections.

class Foo  :  public MidiInputCallback
        midiIn = MidiInput::createNewDevice ("Foo Input", this);


    void handleIncomingMidiMessage (MidiInput *source, const MidiMessage &message) override

    ScopedPointer<MidiInput> midiIn;

I get a Core MIDI error regardless of where I run it. Does my class also need to inherit from the AudioProcessor class? Or maybe include an AudioDeviceManager member?

I just need the MidiInput and MidiOutput to be recognized by other applications.

Did your project include the module that has the MidiInput class in it?

I could be mistaken, but I believe you need an AudioDeviceManager instance as well.

Should my Foo class inherit from the AudioDeviceManager class or just include one as a private member?

include one.

Also, post your error message.

Sorry to correct you:

  1. It is the module juce_audio_devices. The DeviceManager is not needed. You can use the static methods MidiInput::openDevice() et al. instead. The AudioDeviceManager is for AudioDevices (surprise)
  2. include is not needed. If you have added the module and created the project with the projucer, the line #include "../JuceLibraryCode/JuceHeader.h" in each cpp file includes all available juce classes.

So matkatmusic is right, no point in guessing without the error message.

EDIT: ok, double-checked, AudioDeviceManager provides stuff for Midi, but it should work without… sorry for the naughty comment… :wink: The AudioDeviceManager is intended to save and restore user settings like which device was selected etc afaik.

A thought that occurred to me, maybe the startMidi doesn’t like, that the constructor of the MidiInputCallback is not finished? Maybe try that after the constructor… but it is a shot in the blue…