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-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-05-14 01:03:43 +02:00
|
|
|
#include "timemanager.hxx"
|
2013-05-13 23:04:12 +02:00
|
|
|
|
2013-05-18 22:12:36 +02:00
|
|
|
#include "controllerupdater.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:17:08 +02:00
|
|
|
void setLooperState(int t, Looper::State s)
|
2013-05-13 23:04:12 +02:00
|
|
|
{
|
2013-05-15 03:17:08 +02:00
|
|
|
loopers.at(t)->setState(s);
|
2013-05-13 23:04:12 +02:00
|
|
|
}
|
2013-05-16 02:38:11 +02:00
|
|
|
void setLooperLoopLength(int t, float l)
|
|
|
|
{
|
|
|
|
loopers.at(t)->setLoopLength(l);
|
|
|
|
}
|
2013-05-20 00:57:12 +02:00
|
|
|
Looper* getLooper(int t)
|
|
|
|
{
|
|
|
|
return loopers.at(t);
|
|
|
|
}
|
2013-05-15 03:55:51 +02:00
|
|
|
|
2013-05-16 00:27:31 +02:00
|
|
|
Metronome* getMetronome(){return &metronome;}
|
2013-05-15 03:55:51 +02:00
|
|
|
TimeManager* getTimeManager(){return &timeManager;}
|
2013-05-19 03:39:06 +02:00
|
|
|
ControllerUpdater* getControllerUpdater(){return &controllerUpdater;}
|
2013-05-18 20:52:12 +02:00
|
|
|
|
|
|
|
void writeApcOutput( unsigned char* data );
|
2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
private:
|
2013-05-15 23:48:43 +02:00
|
|
|
Buffers buffers;
|
|
|
|
Metronome metronome;
|
2013-05-14 01:03:43 +02:00
|
|
|
TimeManager timeManager;
|
2013-04-20 12:37:36 +02:00
|
|
|
|
2013-05-19 03:39:06 +02:00
|
|
|
ControllerUpdater controllerUpdater;
|
2013-05-18 20:52:12 +02:00
|
|
|
|
2013-05-13 23:04:12 +02:00
|
|
|
vector<Looper*> loopers;
|
|
|
|
|
2013-04-20 12:37:36 +02:00
|
|
|
int nframes;
|
|
|
|
int samplerate;
|
|
|
|
|
|
|
|
// JACK member variables
|
|
|
|
jack_client_t* client;
|
|
|
|
|
|
|
|
jack_port_t* masterInput;
|
|
|
|
jack_port_t* masterOutput;
|
|
|
|
|
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* );
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LUPPP_JACK_H
|
|
|
|
|