Loopp/src/jack.hxx

124 lines
2.9 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 "logic.hxx"
#include "config.hxx"
#include "looper.hxx"
#include "metronome.hxx"
#include "gridlogic.hxx"
#include "trackoutput.hxx"
#include "timemanager.hxx"
#include "controllerupdater.hxx"
#include "dsp/dsp_reverb.hxx"
#include "dsp/dsp_dbmeter.hxx"
using namespace std;
2013-04-20 12:37:36 +02:00
class Jack
{
public:
Jack();
void activate();
int getBuffersize();
int getSamplerate();
/// get functions for components owned by Jack
Looper* getLooper(int t) {return loopers.at(t); }
Metronome* getMetronome(){return metronome;}
Logic* getLogic(){return logic;}
GridLogic* getGridLogic(){return gridLogic;}
TrackOutput* getTrackOutput(int t){return trackOutputs.at(t);}
TimeManager* getTimeManager(){return &timeManager;}
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 12:34:28 +02:00
/// sets reverb bus parameters
void setReverb( bool e, float d, float s );
/// writes MIDI messages to APC port
void writeApcOutput( unsigned char* data );
2013-04-20 12:37:36 +02:00
private:
Buffers buffers;
TimeManager timeManager;
Metronome* metronome;
Logic* logic;
GridLogic* gridLogic;
ControllerUpdater* controllerUpdater;
2013-04-20 12:37:36 +02:00
vector<Looper*> loopers;
vector<TrackOutput*> trackOutputs;
vector<MidiObserver*> midiObservers;
2013-04-20 12:37:36 +02:00
int nframes;
int samplerate;
// FX
Reverb* reverb;
DBMeter* reverbMeter;
DBMeter* masterMeter;
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
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* );
// UI update variables
int uiUpdateCounter;
int uiUpdateConstant;
2013-04-20 12:37:36 +02:00
};
#endif // LUPPP_JACK_H