Loopp/src/controller/genericmidi.hxx

94 lines
2.1 KiB
C++
Raw Normal View History

2013-09-06 15:18:27 +02:00
#ifndef LUPPP_GENERIC_MIDI_H
#define LUPPP_GENERIC_MIDI_H
#include "controller.hxx"
#include <vector>
2013-09-25 19:07:53 +02:00
2013-09-06 15:18:27 +02:00
#include "../observer/midi.hxx"
2013-09-25 19:07:53 +02:00
/// for future compatibility, LupppAction might be a string mapped to a unique number
typedef std::string LupppAction;
2013-09-26 21:51:22 +02:00
class Binding
{
public:
2013-09-26 21:51:22 +02:00
Binding(unsigned char b1, unsigned char b2, LupppAction act) : status(b1), data(b2), action(act) {}
unsigned char status;
unsigned char data;
2013-09-26 21:51:22 +02:00
/// the action this binding relates to
LupppAction action;
2013-09-26 21:51:22 +02:00
/// arguments to the event: track number, scene number etc
int track;
int scene;
};
/** GenericMIDI
* This class is used to load a <controller>.cfg JSON file as a MIDI map.
* The name parameter is the name of the JACK MIDI ports that are registered.
**/
2013-09-06 15:18:27 +02:00
class GenericMIDI : public Controller, public MidiObserver
{
public:
/// Loads
GenericMIDI(std::string file, std::string name);
2013-09-06 15:18:27 +02:00
2013-10-01 17:04:59 +02:00
int registerComponents();
std::string getName();
2013-09-06 15:18:27 +02:00
/// track actions
//void mute(int t, bool b);
2013-09-26 21:51:22 +02:00
void launchScene( int scene );
2013-09-06 15:18:27 +02:00
void volume(int t, float f);
/*
void progress(int t, int s, float f);
void recordArm(int t, bool b);
void launchScene( int scene );
void setSceneState(int track, int clip, GridLogic::State s);
/// track FX
void trackSend(int t, int send, float v);
*/
void reset();
void midi(unsigned char* data);
private:
int _port;
std::string name;
/// contains midi binding instances
2013-09-26 21:51:22 +02:00
std::vector<Binding> midiToAction;
std::vector<Binding> actionToMidi;
2013-09-25 19:07:53 +02:00
int loadController(std::string controllerFile);
2013-09-06 15:18:27 +02:00
/// for "sampling" a clip in the grid, and applying events to it:
/// footpedal for example
bool shiftPressed;
2013-09-06 15:18:27 +02:00
int footpedalTrack;
int footpedalScene;
/*
2013-09-06 15:18:27 +02:00
/// for handling events
void ccChange( int track, int cc, float value );
void noteOff( int track, int note, int vel );
void noteOn( int track, int note, int vel );
*/
};
#endif // LUPPP_GENERIC_MIDI_H
2013-09-06 15:18:27 +02:00