2013-09-06 15:18:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef LUPPP_GENERIC_MIDI_H
|
|
|
|
#define LUPPP_GENERIC_MIDI_H
|
|
|
|
|
|
|
|
#include "controller.hxx"
|
|
|
|
|
2013-09-25 19:46:08 +02:00
|
|
|
#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
|
2013-09-24 19:30:29 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-09-26 21:51:22 +02:00
|
|
|
Binding(unsigned char b1, unsigned char b2, LupppAction act) : status(b1), data(b2), action(act) {}
|
2013-09-25 19:46:08 +02:00
|
|
|
|
2013-09-24 19:30:29 +02:00
|
|
|
unsigned char status;
|
|
|
|
unsigned char data;
|
2013-09-25 19:46:08 +02:00
|
|
|
|
2013-09-26 21:51:22 +02:00
|
|
|
/// the action this binding relates to
|
2013-09-25 19:46:08 +02:00
|
|
|
LupppAction action;
|
2013-09-26 21:51:22 +02:00
|
|
|
|
|
|
|
/// arguments to the event: track number, scene number etc
|
|
|
|
int track;
|
|
|
|
int scene;
|
2013-09-24 19:30:29 +02:00
|
|
|
};
|
|
|
|
|
2013-09-30 15:57:17 +02:00
|
|
|
/** 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:
|
2013-09-30 15:57:17 +02:00
|
|
|
/// Loads
|
2013-09-24 19:30:29 +02:00
|
|
|
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();
|
|
|
|
|
2013-09-24 19:30:29 +02:00
|
|
|
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;
|
2013-09-24 19:30:29 +02:00
|
|
|
|
|
|
|
std::string name;
|
|
|
|
|
2013-09-25 19:46:08 +02:00
|
|
|
/// 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
|
|
|
|
2013-09-24 19:30:29 +02:00
|
|
|
int loadController(std::string controllerFile);
|
2013-09-06 15:18:27 +02:00
|
|
|
|
2013-09-30 15:57:17 +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-30 15:57:17 +02:00
|
|
|
/*
|
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 );
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
2013-09-24 19:30:29 +02:00
|
|
|
#endif // LUPPP_GENERIC_MIDI_H
|
2013-09-06 15:18:27 +02:00
|
|
|
|