Loopp/src/jack.hxx

104 lines
2.1 KiB
C++
Raw Normal View History

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
#include <vector>
2013-04-20 12:37:36 +02:00
#include <cstring>
#include <jack/jack.h>
#include <jack/midiport.h>
#include <jack/transport.h>
2013-04-20 12:37:36 +02:00
#include "config.hxx"
#include "looper.hxx"
#include "metronome.hxx"
#include "timemanager.hxx"
2013-07-26 01:56:06 +02:00
#include "dsp/dsp_dbmeter.hxx"
2013-05-18 22:12:36 +02:00
#include "controllerupdater.hxx"
using namespace std;
2013-04-20 12:37:36 +02:00
class Jack
{
public:
Jack();
void activate();
int getBuffersize();
int getSamplerate();
2013-05-15 03:17:08 +02:00
void setLooperState(int t, Looper::State s)
{
2013-05-15 03:17:08 +02:00
loopers.at(t)->setState(s);
}
void setLooperLoopLength(int t, float l)
{
loopers.at(t)->setLoopLength(l);
}
Looper* getLooper(int t)
{
return loopers.at(t);
}
Metronome* getMetronome(){return &metronome;}
TimeManager* getTimeManager(){return &timeManager;}
2013-05-19 03:39:06 +02:00
ControllerUpdater* getControllerUpdater(){return &controllerUpdater;}
void writeApcOutput( unsigned char* data );
2013-04-20 12:37:36 +02:00
private:
Buffers buffers;
Metronome metronome;
TimeManager timeManager;
2013-04-20 12:37:36 +02:00
2013-05-19 03:39:06 +02:00
ControllerUpdater controllerUpdater;
vector<Looper*> loopers;
vector<DBMeter> dbMeters;
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;
jack_port_t* apcMidiInput;
jack_port_t* apcMidiOutput;
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