2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
#ifndef LUPPP_JACK_H
|
|
|
|
#define LUPPP_JACK_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
jack.hxx
|
|
|
|
|
|
|
|
This code contains the JACK client.
|
|
|
|
It allows reading / writing of audio / midi.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Library
|
2013-05-13 23:04:12 +02:00
|
|
|
#include <vector>
|
2013-04-20 12:37:36 +02:00
|
|
|
#include <cstring>
|
|
|
|
#include <jack/jack.h>
|
|
|
|
#include <jack/midiport.h>
|
2013-05-14 01:03:43 +02:00
|
|
|
#include <jack/transport.h>
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-08-05 14:56:38 +02:00
|
|
|
#include "logic.hxx"
|
2013-05-16 02:38:11 +02:00
|
|
|
#include "config.hxx"
|
2013-05-13 23:04:12 +02:00
|
|
|
#include "looper.hxx"
|
2013-05-15 23:48:43 +02:00
|
|
|
#include "metronome.hxx"
|
2013-08-02 04:16:56 +02:00
|
|
|
#include "gridlogic.hxx"
|
|
|
|
#include "trackoutput.hxx"
|
2013-05-14 01:03:43 +02:00
|
|
|
#include "timemanager.hxx"
|
2013-08-02 04:16:56 +02:00
|
|
|
#include "controllerupdater.hxx"
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-07-28 15:20:54 +02:00
|
|
|
#include "dsp/dsp_reverb.hxx"
|
|
|
|
#include "dsp/dsp_dbmeter.hxx"
|
|
|
|
|
2013-05-18 20:52:12 +02:00
|
|
|
|
2013-05-13 23:04:12 +02:00
|
|
|
using namespace std;
|
2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
class Jack
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Jack();
|
|
|
|
|
|
|
|
void activate();
|
|
|
|
int getBuffersize();
|
|
|
|
int getSamplerate();
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-05-15 03:55:51 +02:00
|
|
|
|
2013-07-31 18:31:47 +02:00
|
|
|
/// get functions for components owned by Jack
|
|
|
|
Looper* getLooper(int t) {return loopers.at(t); }
|
2013-08-04 19:04:26 +02:00
|
|
|
Metronome* getMetronome(){return metronome;}
|
2013-08-05 14:56:38 +02:00
|
|
|
Logic* getLogic(){return logic;}
|
2013-08-04 19:04:26 +02:00
|
|
|
GridLogic* getGridLogic(){return gridLogic;}
|
2013-07-31 18:31:47 +02:00
|
|
|
TrackOutput* getTrackOutput(int t){return trackOutputs.at(t);}
|
|
|
|
TimeManager* getTimeManager(){return &timeManager;}
|
2013-07-31 19:01:51 +02:00
|
|
|
ControllerUpdater* getControllerUpdater(){return controllerUpdater;}
|
|
|
|
|
|
|
|
/// register MIDI observers: they're called when a MIDI message arrives on
|
|
|
|
/// a port they're watching
|
|
|
|
void registerMidiObserver( MidiObserver* mo )
|
|
|
|
{
|
|
|
|
midiObservers.push_back( mo );
|
|
|
|
}
|
2013-07-31 18:31:47 +02:00
|
|
|
|
2013-07-31 12:34:28 +02:00
|
|
|
|
2013-07-31 18:31:47 +02:00
|
|
|
/// sets reverb bus parameters
|
|
|
|
void setReverb( bool e, float d, float s );
|
2013-05-18 20:52:12 +02:00
|
|
|
|
2013-07-31 18:31:47 +02:00
|
|
|
/// writes MIDI messages to APC port
|
2013-05-18 20:52:12 +02:00
|
|
|
void writeApcOutput( unsigned char* data );
|
2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
private:
|
2013-08-04 19:04:26 +02:00
|
|
|
Buffers buffers;
|
|
|
|
TimeManager timeManager;
|
|
|
|
Metronome* metronome;
|
2013-08-05 14:56:38 +02:00
|
|
|
Logic* logic;
|
2013-08-04 19:04:26 +02:00
|
|
|
GridLogic* gridLogic;
|
|
|
|
ControllerUpdater* controllerUpdater;
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-08-04 19:04:26 +02:00
|
|
|
vector<Looper*> loopers;
|
|
|
|
vector<TrackOutput*> trackOutputs;
|
|
|
|
vector<MidiObserver*> midiObservers;
|
2013-07-31 19:01:51 +02:00
|
|
|
|
2013-04-20 12:37:36 +02:00
|
|
|
int nframes;
|
|
|
|
int samplerate;
|
|
|
|
|
2013-07-28 15:20:54 +02:00
|
|
|
// FX
|
|
|
|
Reverb* reverb;
|
|
|
|
DBMeter* reverbMeter;
|
2013-07-28 17:00:17 +02:00
|
|
|
DBMeter* masterMeter;
|
2013-07-28 15:20:54 +02:00
|
|
|
|
2013-04-20 12:37:36 +02:00
|
|
|
// JACK member variables
|
2013-07-31 18:19:15 +02:00
|
|
|
bool clientActive;
|
2013-04-20 12:37:36 +02:00
|
|
|
jack_client_t* client;
|
|
|
|
|
|
|
|
jack_port_t* masterInput;
|
2013-07-31 12:34:28 +02:00
|
|
|
jack_port_t* masterOutputL;
|
|
|
|
jack_port_t* masterOutputR;
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-05-18 20:52:12 +02:00
|
|
|
jack_port_t* apcMidiInput;
|
|
|
|
jack_port_t* apcMidiOutput;
|
2013-05-18 17:37:03 +02:00
|
|
|
jack_port_t* masterMidiInput;
|
|
|
|
|
2013-04-20 12:37:36 +02:00
|
|
|
// JACK callbacks
|
|
|
|
int process (jack_nframes_t);
|
|
|
|
|
|
|
|
int timebase(jack_transport_state_t,
|
|
|
|
jack_nframes_t,
|
|
|
|
jack_position_t*,
|
|
|
|
int );
|
|
|
|
|
|
|
|
// static JACK callbacks
|
|
|
|
static int static_process (jack_nframes_t, void *);
|
|
|
|
|
|
|
|
static int static_timebase (jack_transport_state_t,
|
|
|
|
jack_nframes_t,
|
|
|
|
jack_position_t*,
|
|
|
|
int,
|
|
|
|
void* );
|
|
|
|
|
2013-07-28 15:20:54 +02:00
|
|
|
// UI update variables
|
|
|
|
int uiUpdateCounter;
|
|
|
|
int uiUpdateConstant;
|
2013-04-20 12:37:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LUPPP_JACK_H
|
|
|
|
|