From 398ab6948261203754d13049fee6f5cee04b1bff Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Sun, 19 May 2013 01:26:18 +0100 Subject: [PATCH] -Updated run script, fixed APC error. --- luppp5apc.ajs | 58 +++++++++++++++++++++++++++++++++++ run.sh | 2 ++ src/controller/controller.hxx | 2 +- src/controllerupdater.hxx | 24 ++++++++++----- src/looper.cxx | 7 +++++ 5 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 luppp5apc.ajs diff --git a/luppp5apc.ajs b/luppp5apc.ajs new file mode 100644 index 0000000..c588904 --- /dev/null +++ b/luppp5apc.ajs @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/run.sh b/run.sh index 01bb359..db03d3e 100755 --- a/run.sh +++ b/run.sh @@ -2,4 +2,6 @@ cd .build/ +xterm -e "sleep 1 && aj-snapshot -r luppp5apc.ajs" & + ./luppp5 diff --git a/src/controller/controller.hxx b/src/controller/controller.hxx index 2ec474e..f8a4401 100644 --- a/src/controller/controller.hxx +++ b/src/controller/controller.hxx @@ -12,7 +12,7 @@ class Controller virtual void mute(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) = 0; virtual void volume(int t, float f){}; }; diff --git a/src/controllerupdater.hxx b/src/controllerupdater.hxx index 8454ce0..9e05f73 100644 --- a/src/controllerupdater.hxx +++ b/src/controllerupdater.hxx @@ -10,39 +10,49 @@ using namespace std; +// this is a wrapper class around a vector of Controller instances +// Call the method on this class, and all controllers will be updated class ControllerUpdator { public: + enum ClipMode { + CLIP_MODE_PLAYING, + CLIP_MODE_PLAY_QUEUED, + CLIP_MODE_LOADED, + CLIP_MODE_EMPTY, + }; + + ControllerUpdator() { - c.push_back( AkaiAPC() ); + c.push_back( new AkaiAPC() ); } void mute(int t, bool b) { - for(int i = 0; i < c.size(); i++) c.at(i).mute(t,b); + for(int i = 0; i < c.size(); i++) c.at(i)->mute(t,b); } - void clipSelect(int t, bool cs) + void clipSelect(int t, ClipMode cm) { for(int i = 0; i < c.size(); i++) - c.at(i).clipSelect(t,cs); + c.at(i)->clipSelect(t,cm); } 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); + 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); + for(int i = 0; i < c.size(); i++) c.at(i)->volume(t,v); } private: - std::vector c; + std::vector c; }; #endif // LUPPP_CONTROLLER_UPDATER_H diff --git a/src/looper.cxx b/src/looper.cxx index 4244a5b..11bf5ef 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -82,6 +82,13 @@ void Looper::setState(State s) numBeats = 0; jack->getControllerUpdator()->record(track, true); } + else + { + jack->getControllerUpdator()->record(track, false); + } + + if (state == STATE_PLAY_QUEUED ) + { } void Looper::process(int nframes, Buffers* buffers)