Loopp/src/observer/midi.hxx

41 lines
1014 B
C++
Raw Normal View History

2013-07-31 18:19:15 +02:00
#ifndef LUPPP_MIDI_OBSERVER_H
#define LUPPP_MIDI_OBSERVER_H
#include <iostream>
#include <string>
class Jack;
extern Jack* jack;
/** MidiObserver
* A base class allowing the recieving of MIDI message streams to the subclass
**/
class MidiObserver
{
public:
/// registers class with jack's MIDI handling, with MIDI port name
MidiObserver( std::string portName );
virtual ~MidiObserver(){};
2013-07-31 18:19:15 +02:00
2013-09-06 15:18:27 +02:00
/// name string to show in UI
virtual std::string getName() = 0;
2013-07-31 18:19:15 +02:00
/// gets called with each MIDI message from the controller. Deal with its
/// input here, and route to the appropriate function in Luppp
virtual void midi(unsigned char* data) = 0;
/// sets the port number for this instance. Used when writing MIDI messages
/// to identify the port, using Jack::midiObserverWriteMIDI()
void port(int index);
/// returns the port index to the subclass when needed
int port();
private:
int portIndex;
2013-07-31 18:19:15 +02:00
};
#endif // LUPPP_MIDI_OBSERVER_H