diff --git a/src/config.hxx b/src/config.hxx index 1692989..48098d9 100644 --- a/src/config.hxx +++ b/src/config.hxx @@ -2,23 +2,19 @@ #ifndef LUPPP_CONFIG_H #define LUPPP_CONFIG_H -/// Build options -//#define DEBUG_ALL 1 - - -#ifdef DEBUG_ALL - +/// DEBUG OPTIONS +// Clip selection / queueing #define DEBUG_CLIP 1 +// Buffer loading / resizing #define DEBUG_BUFFER 1 -#endif /// General Options #define NTRACKS 8 #define NSCENES 10 #define MAX_BUFFER_SIZE 1024 - +// nsamples remaining during recording before Looper requests larger buffer #define LOOPER_SAMPLES_BEFORE_REQUEST 44100 #endif // LUPPP_CONFIG_H diff --git a/src/gridlogic.cxx b/src/gridlogic.cxx index 05a71de..b04d372 100644 --- a/src/gridlogic.cxx +++ b/src/gridlogic.cxx @@ -30,28 +30,38 @@ void GridLogic::launchScene( int scene ) { for(unsigned int t = 0; t < NTRACKS; t++ ) { - for(unsigned int s = 0; s < NSCENES; s++ ) + for(int s = 0; s < NSCENES; s++ ) { LooperClip* lc = jack->getLooper( t )->getClip( s ); if ( s == scene ) + { lc->queuePlay(); - //else - //lc->queueStop(); + jack->getControllerUpdater()->setSceneState( t, s, lc->getState() ); + } + else + { + bool current = lc->playing(); + lc->queueStop(); + bool next = lc->playing(); + if ( current != next ) + { + jack->getControllerUpdater()->setSceneState( t, s, lc->getState() ); + } + } } - - } /* for(unsigned int s = 0; s < NSCENES; s++ ) { - jack->getControllerUpdater()->setSceneState( -1, s, s ); + } */ } void GridLogic::pressed( int track, int scene ) { + // get the clip, do the "press" action based on current state. LooperClip* lc = jack->getLooper( track )->getClip( scene ); GridLogic::State s = lc->getState(); @@ -70,13 +80,10 @@ void GridLogic::pressed( int track, int scene ) if ( s == STATE_RECORDING ) lc->queueStop(); - s = lc->getState(); - #ifdef DEBUG_CLIP printf("GridLogic::pressed() after press state = %s\n", StateString[ int(s) ] ); #endif - jack->getControllerUpdater()->setSceneState(track, scene, s ); } diff --git a/src/looperclip.cxx b/src/looperclip.cxx index 16c19a7..8c3b815 100644 --- a/src/looperclip.cxx +++ b/src/looperclip.cxx @@ -142,7 +142,7 @@ void LooperClip::bar() _playhead = 0; } - else if ( _queueStop ) + else if ( _queueStop && _loaded ) { _playing = false; s = GridLogic::STATE_STOPPED; @@ -162,6 +162,12 @@ void LooperClip::bar() _recordhead = 0; } + else if ( _queuePlay ) + { + // clip was queued, but there's nothing loaded + _queuePlay = false; + change = true; + } if ( _recording ) {