diff --git a/src/controller/apc.cxx b/src/controller/apc.cxx index acdee3a..061650c 100644 --- a/src/controller/apc.cxx +++ b/src/controller/apc.cxx @@ -31,8 +31,9 @@ void AkaiAPC::clipSelect(int t, int clip, ClipMode cm) case CLIP_MODE_PLAYING: data[2] = 1; break; case CLIP_MODE_PLAY_QUEUED: data[2] = 2; break; case CLIP_MODE_RECORDING: data[2] = 3; break; - // case flashing red light?: data[2] = 4; break; + case CLIP_MODE_RECORD_QUEUED: data[2] = 4; break; case CLIP_MODE_LOADED: data[2] = 5; break; + case CLIP_MODE_STOP_QUEUED: data[2] = 6; break; } jack->writeApcOutput( &data[0] ); diff --git a/src/controller/controller.hxx b/src/controller/controller.hxx index d511c0c..9a44416 100644 --- a/src/controller/controller.hxx +++ b/src/controller/controller.hxx @@ -15,12 +15,13 @@ class Controller */ enum ClipMode { + CLIP_MODE_EMPTY, CLIP_MODE_PLAYING, CLIP_MODE_PLAY_QUEUED, CLIP_MODE_LOADED, + CLIP_MODE_STOP_QUEUED, CLIP_MODE_RECORDING, CLIP_MODE_RECORD_QUEUED, - CLIP_MODE_EMPTY, }; Controller(){}; diff --git a/src/looper.cxx b/src/looper.cxx index c646560..6bdd9c9 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -20,6 +20,9 @@ Looper::Looper(int t) : playPoint (0), lastWrittenSampleIndex(0) { + // pre-zero the internal sample + memset( &sample[0], 0, SAMPLE_SIZE ); + // init faust pitch shift variables fSamplingFreq = 44100; IOTA = 0; @@ -48,7 +51,7 @@ void Looper::midi(unsigned char* data) { case 48: setState( STATE_RECORD_QUEUED ); break; case 53: setState( STATE_PLAY_QUEUED ); break; - case 52: setState( STATE_STOPPED ); break; + case 52: setState( STATE_STOP_QUEUED ); break; } } else if ( data[0] - 128 == track ) @@ -62,7 +65,7 @@ void Looper::midi(unsigned char* data) { switch ( data[1] ) { - case 7: gain = int(data[2])/127.f; break; + case 7: gain = int(data[2])/127.f; break; } } @@ -111,7 +114,7 @@ void Looper::updateControllers() if (state == STATE_STOP_QUEUED ) { - jack->getControllerUpdater()->clipSelect(track, currentClip, Controller::CLIP_MODE_LOADED); + jack->getControllerUpdater()->clipSelect(track, currentClip, Controller::CLIP_MODE_STOP_QUEUED); } else if ( state == STATE_STOPPED ) { @@ -193,7 +196,7 @@ void Looper::bar() endPoint = 0; lastWrittenSampleIndex = 0; } - if ( state == STATE_PLAY_QUEUED ) + if ( state == STATE_STOP_QUEUED ) { EventGuiPrint e( "Looper Q->Stopped" ); writeToGuiRingbuffer( &e ); diff --git a/src/looper.hxx b/src/looper.hxx index 8096108..05ea25c 100644 --- a/src/looper.hxx +++ b/src/looper.hxx @@ -8,6 +8,8 @@ #include "buffers.hxx" #include "observer/observer.hxx" +#define SAMPLE_SIZE 44100*60 + using namespace std; class Looper : public Observer // for notifications @@ -50,7 +52,7 @@ class Looper : public Observer // for notifications int endPoint, lastWrittenSampleIndex; float playPoint; - float sample[44100*60]; + float sample[SAMPLE_SIZE]; // Pitch Shifting void pitchShift(int count, float* input, float* output);