Inheriting MidiOutput and MidiInput


#1

Hi All,

Apologies in advance if this a C++ Newbie Question.

I want to subclass MidiOutput and MidiInput, so that I can log the messages in and out of my application (by overriding SendMessageNow and adding my own methods before letting the user have their way).

I'm having trouble because of all the static constructors already in the app, like:

​static MidiOutput* openDevice(int deviceIndex);

What is the proper way of doing something like this?

Thanks,

Chris


#2

I don't believe the MidiInput and MidiOutput are designed to be subclassed in the way you're intending.  The headers for those hide the platform implementations (e.g. Mac, Win, Linux..etc), so although they do have virtual methods that are meant to be overridden, the intention is that they are overridden to provide platform specific code.  i.e. If you're on windows, the windows implementations would be used and so forth.

Could you just log the messages at whatever point you call sendmessagenow, or for input in your midi input callback method?


#3

Subclassing is the more elegant solution for what I'm trying to achieve; but if it can't be done "Find All: sendMessageNow" is the way to go.

Thanks for your help :-)