2013-07-31 18:19:15 +02:00
|
|
|
|
2013-10-02 18:42:52 +02:00
|
|
|
#ifndef LUPPP_MIDI_IO_H
|
|
|
|
#define LUPPP_MIDI_IO_H
|
2013-07-31 18:19:15 +02:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
2013-10-02 03:11:23 +02:00
|
|
|
#include <jack/midiport.h>
|
|
|
|
|
2013-07-31 18:19:15 +02:00
|
|
|
class Jack;
|
|
|
|
extern Jack* jack;
|
|
|
|
|
2013-10-02 18:42:52 +02:00
|
|
|
/** MidiIO
|
2013-10-01 18:15:28 +02:00
|
|
|
* A base class for obseriving a MIDI port
|
2013-07-31 18:19:15 +02:00
|
|
|
**/
|
2013-10-02 18:42:52 +02:00
|
|
|
class MidiIO
|
2013-07-31 18:19:15 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-10-02 18:42:52 +02:00
|
|
|
MidiIO();
|
|
|
|
virtual ~MidiIO(){};
|
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-10-01 22:41:39 +02:00
|
|
|
///
|
|
|
|
int status();
|
2013-10-01 18:42:16 +02:00
|
|
|
|
2013-10-03 16:59:34 +02:00
|
|
|
/// gets / clears MIDI buffers
|
|
|
|
void initBuffers(int nframes);
|
|
|
|
|
2013-10-01 18:08:19 +02:00
|
|
|
/// gets called each process() in JACK
|
2013-10-01 18:42:16 +02:00
|
|
|
void process(int nframes);
|
|
|
|
|
|
|
|
/// called by the subclass to create MIDI ports
|
2013-10-11 22:33:20 +02:00
|
|
|
int registerMidiPorts(std::string name);
|
2013-10-01 18:42:16 +02:00
|
|
|
|
|
|
|
virtual void midi(unsigned char* data){};
|
2013-10-02 04:05:10 +02:00
|
|
|
|
|
|
|
void writeMidi( unsigned char* data );
|
2013-09-06 15:05:57 +02:00
|
|
|
|
2013-10-01 18:51:51 +02:00
|
|
|
private:
|
2013-10-01 18:08:19 +02:00
|
|
|
// there are jack_port_t* registered ports
|
2013-10-02 03:11:23 +02:00
|
|
|
jack_port_t* jackInputPort;
|
|
|
|
jack_port_t* jackOutputPort;
|
2013-09-06 15:05:57 +02:00
|
|
|
|
2013-07-31 18:19:15 +02:00
|
|
|
};
|
|
|
|
|
2013-10-02 18:42:52 +02:00
|
|
|
#endif // LUPPP_MIDI_IO_H
|