mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-WIP, controller APC
This commit is contained in:
parent
39d6c6e60f
commit
3f8cc2f926
8 changed files with 98 additions and 17 deletions
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
#include "../jack.hxx"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
extern Jack* jack;
|
||||||
|
|
||||||
|
AkaiAPC::AkaiAPC()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkaiAPC::record(int t, bool b)
|
||||||
|
{
|
||||||
|
unsigned char data[3];
|
||||||
|
data[0] = 144 + t;
|
||||||
|
data[1] = 48; // record LED
|
||||||
|
data[2] = 127 * b;
|
||||||
|
jack->writeApcOutput( &data[0] );
|
||||||
|
cout << "record written to JACK" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkaiAPC::mute(int t, bool b)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkaiAPC::clipSelect(int t, bool b)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkaiAPC::volume(int t, float f)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -11,10 +11,9 @@ class AkaiAPC : public Controller
|
||||||
AkaiAPC();
|
AkaiAPC();
|
||||||
|
|
||||||
void mute(int t, bool b);
|
void mute(int t, bool b);
|
||||||
void clip(int t, bool b);
|
void clipSelect(int t, bool b);
|
||||||
|
|
||||||
void record(int t, bool b);
|
|
||||||
|
|
||||||
|
virtual void record(int t, bool b);
|
||||||
void volume(int t, float f);
|
void volume(int t, float f);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
class Controller
|
class Controller
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Controller();
|
Controller(){};
|
||||||
virtual ~Controller();
|
virtual ~Controller(){};
|
||||||
|
|
||||||
virtual void mute(int t, bool b);
|
virtual void mute(int t, bool b){};
|
||||||
virtual void clip(int t, bool b);
|
virtual void clipSelect(int t, bool b){};
|
||||||
|
|
||||||
virtual void record(int t, bool b);
|
virtual void record(int t, bool b){};
|
||||||
|
|
||||||
virtual void volume(int t, float f);
|
virtual void volume(int t, float f){};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LUPPP_CONTROLLER_H
|
#endif // LUPPP_CONTROLLER_H
|
||||||
|
|
49
src/controllerupdater.hxx
Normal file
49
src/controllerupdater.hxx
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
#ifndef LUPPP_CONTROLLER_UPDATER_H
|
||||||
|
#define LUPPP_CONTROLLER_UPDATER_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "controller/apc.hxx"
|
||||||
|
#include "controller/controller.hxx"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class ControllerUpdator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ControllerUpdator()
|
||||||
|
{
|
||||||
|
c.push_back( AkaiAPC() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void mute(int t, bool b)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < c.size(); i++) c.at(i).mute(t,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clipSelect(int t, bool cs)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < c.size(); i++)
|
||||||
|
c.at(i).clipSelect(t,cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void record(int t, bool r)
|
||||||
|
{
|
||||||
|
cout << "record() " << t << " " << r << endl;
|
||||||
|
for(int i = 0; i < c.size(); i++)
|
||||||
|
c.at(i).record(t,r);
|
||||||
|
}
|
||||||
|
|
||||||
|
void volume(int t, float v)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < c.size(); i++) c.at(i).volume(t,v);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<Controller> c;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LUPPP_CONTROLLER_UPDATER_H
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include "eventhandler.hxx"
|
#include "eventhandler.hxx"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
extern int jackSamplerate;
|
extern int jackSamplerate;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "metronome.hxx"
|
#include "metronome.hxx"
|
||||||
#include "timemanager.hxx"
|
#include "timemanager.hxx"
|
||||||
|
|
||||||
#include "controller/apc.hxx"
|
#include "controllerupdater.hxx"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ class Jack
|
||||||
|
|
||||||
Metronome* getMetronome(){return &metronome;}
|
Metronome* getMetronome(){return &metronome;}
|
||||||
TimeManager* getTimeManager(){return &timeManager;}
|
TimeManager* getTimeManager(){return &timeManager;}
|
||||||
|
ControllerUpdator* getControllerUpdator(){return &controllerUpdator;}
|
||||||
|
|
||||||
void writeApcOutput( unsigned char* data );
|
void writeApcOutput( unsigned char* data );
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ class Jack
|
||||||
Metronome metronome;
|
Metronome metronome;
|
||||||
TimeManager timeManager;
|
TimeManager timeManager;
|
||||||
|
|
||||||
vector<Controller*> controllers;
|
ControllerUpdator controllerUpdator;
|
||||||
|
|
||||||
vector<Looper*> loopers;
|
vector<Looper*> loopers;
|
||||||
|
|
||||||
|
|
|
@ -80,11 +80,7 @@ void Looper::setState(State s)
|
||||||
if (state == STATE_RECORD_QUEUED )
|
if (state == STATE_RECORD_QUEUED )
|
||||||
{
|
{
|
||||||
numBeats = 0;
|
numBeats = 0;
|
||||||
unsigned char data[3];
|
jack->getControllerUpdator()->record(track, true);
|
||||||
data[0] = 144 + track;
|
|
||||||
data[1] = 48; // record LED
|
|
||||||
data[2] = 127;
|
|
||||||
jack->writeApcOutput( &data[0] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
wscript
1
wscript
|
@ -23,6 +23,7 @@ def build(bld):
|
||||||
'src/main.cxx',
|
'src/main.cxx',
|
||||||
'src/jack.cxx',
|
'src/jack.cxx',
|
||||||
'src/looper.cxx',
|
'src/looper.cxx',
|
||||||
|
'src/controller/apc.cxx',
|
||||||
'src/eventhandlergui.cxx',
|
'src/eventhandlergui.cxx',
|
||||||
'src/eventhandlerdsp.cxx']
|
'src/eventhandlerdsp.cxx']
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue