2013-09-06 15:18:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef LUPPP_GENERIC_MIDI_H
|
|
|
|
#define LUPPP_GENERIC_MIDI_H
|
|
|
|
|
|
|
|
#include "controller.hxx"
|
|
|
|
|
2013-10-08 15:12:55 +02:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2013-09-25 19:46:08 +02:00
|
|
|
#include <vector>
|
2013-09-25 19:07:53 +02:00
|
|
|
|
2013-10-03 12:24:34 +02:00
|
|
|
#include "../cjson/cJSON.h"
|
2013-09-06 15:18:27 +02:00
|
|
|
#include "../observer/midi.hxx"
|
|
|
|
|
2013-10-18 02:06:34 +02:00
|
|
|
/// a LupppAction represents the Event type, as from Event.hxx
|
2013-10-03 01:39:00 +02:00
|
|
|
typedef int LupppAction;
|
2013-09-25 19:07:53 +02:00
|
|
|
|
2013-09-26 21:51:22 +02:00
|
|
|
class Binding
|
2013-09-24 19:30:29 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-10-03 12:24:34 +02:00
|
|
|
Binding() : status(0), data(0), action(0), active(false),track(-2),scene(-1),send(-1){}
|
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-10-03 01:39:00 +02:00
|
|
|
/// the action this binding relates to: this is an integer based on the
|
|
|
|
/// event.hxx enumeration of event types
|
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
|
2013-10-03 02:18:06 +02:00
|
|
|
int active;
|
2013-09-26 21:51:22 +02:00
|
|
|
int track;
|
|
|
|
int scene;
|
2013-10-03 02:18:06 +02:00
|
|
|
int send;
|
2013-10-08 15:12:55 +02:00
|
|
|
|
|
|
|
std::map<int,int> clipStateMap;
|
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-10-02 18:42:52 +02:00
|
|
|
class GenericMIDI : public Controller, public MidiIO
|
2013-09-06 15:18:27 +02:00
|
|
|
{
|
|
|
|
public:
|
2013-09-30 15:57:17 +02:00
|
|
|
/// Loads
|
2013-10-01 22:41:39 +02:00
|
|
|
GenericMIDI(std::string file);
|
2013-09-06 15:18:27 +02:00
|
|
|
|
2013-10-01 17:04:59 +02:00
|
|
|
int registerComponents();
|
|
|
|
|
2013-10-01 22:41:39 +02:00
|
|
|
Controller::STATUS status();
|
|
|
|
|
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-10-09 01:15:31 +02:00
|
|
|
void metronomeEnable(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);
|
2013-10-08 15:12:55 +02:00
|
|
|
|
2013-10-08 15:29:35 +02:00
|
|
|
|
|
|
|
void recordArm(int t, bool b);
|
2013-10-08 15:12:55 +02:00
|
|
|
void setSceneState(int track, int clip, GridLogic::State s);
|
|
|
|
|
2013-09-06 15:18:27 +02:00
|
|
|
/*
|
|
|
|
void progress(int t, int s, float f);
|
|
|
|
void launchScene( int scene );
|
|
|
|
|
|
|
|
/// track FX
|
|
|
|
void trackSend(int t, int send, float v);
|
|
|
|
*/
|
|
|
|
|
2013-10-08 15:29:35 +02:00
|
|
|
void trackSend(int t, int send, float v);
|
|
|
|
void trackSendActive(int t, int send, bool a);
|
|
|
|
|
|
|
|
|
2013-09-06 15:18:27 +02:00
|
|
|
void reset();
|
|
|
|
|
|
|
|
void midi(unsigned char* data);
|
|
|
|
|
2013-10-01 18:08:19 +02:00
|
|
|
void process(int nframes);
|
|
|
|
|
2013-10-18 02:06:34 +02:00
|
|
|
// for adding bindings from MIDI / GUI event pair
|
|
|
|
void setupBinding( LupppAction eventType, int midiStatus, int midiData, int track );
|
|
|
|
|
2013-09-06 15:18:27 +02:00
|
|
|
private:
|
2013-10-01 22:41:39 +02:00
|
|
|
STATUS stat;
|
2013-09-24 19:30:29 +02:00
|
|
|
|
|
|
|
std::string name;
|
|
|
|
|
2013-09-25 19:46:08 +02:00
|
|
|
/// contains midi binding instances
|
2013-10-03 11:21:40 +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-10-03 12:24:34 +02:00
|
|
|
/// creates a binding from a cJSON inputBindings / outputBindings object
|
|
|
|
Binding* setupBinding( cJSON* bindings );
|
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
|
|
|
|