Loopp/src/jack.hxx

87 lines
1.7 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"
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);
}
Metronome* getMetronome(){return &metronome;}
TimeManager* getTimeManager(){return &timeManager;}
2013-04-20 12:37:36 +02:00
private:
Buffers buffers;
Metronome metronome;
TimeManager timeManager;
2013-04-20 12:37:36 +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;
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