diff --git a/src/looper.cxx b/src/looper.cxx index 49dcc28..84f5c62 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -115,13 +115,6 @@ void Looper::process(unsigned int nframes, Buffers* buffers) // handle state of clip, and do what needs doing: // record into buffer, play from buffer, etc if ( clips[clip]->recording() ) { - if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST && - !clips[clip]->newBufferInTransit() ) { - EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE); - writeToGuiRingbuffer( &e ); - clips[clip]->newBufferInTransit(true); - } - // copy data from input buffer to recording buffer float* inputL = buffers->audio[Buffers::MASTER_INPUT_L]; float* inputR = buffers->audio[Buffers::MASTER_INPUT_R]; diff --git a/src/looperclip.cxx b/src/looperclip.cxx index 5a20686..4190346 100644 --- a/src/looperclip.cxx +++ b/src/looperclip.cxx @@ -38,7 +38,7 @@ LooperClip::LooperClip(int t, int s) : scene(s) { _buffer = new AudioBuffer(); - _buffer->nonRtResize( 4410 ); + _buffer->nonRtResize( LOOPER_SAMPLES_UPDATE_SIZE ); init(); } @@ -193,6 +193,11 @@ void LooperClip::setPlayHead(float ph) void LooperClip::record(int count, float* L, float* R) { + if (recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST && !newBufferInTransit()) { + EventLooperClipRequestBuffer e( track, scene, audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE); + writeToGuiRingbuffer( &e ); + newBufferInTransit(true); + } // write "count" samples into current buffer. if ( _buffer ) { size_t size = _buffer->getSize(); diff --git a/src/looperclip.hxx b/src/looperclip.hxx index 4df764c..8d7a9a5 100644 --- a/src/looperclip.hxx +++ b/src/looperclip.hxx @@ -99,11 +99,6 @@ public: /// set buffer state void setBeats(int beats); - /// Luppp internal buffer resizing - void newBufferInTransit(bool n); - bool newBufferInTransit(); - unsigned long recordSpaceAvailable(); - /** used to update the size of the buffer for this looperclip. The current * data is copied into the new buffer, then the smaller buffer is sent * for de-allocation. @@ -143,6 +138,11 @@ private: unsigned int _barsPlayed; AudioBuffer* _buffer; + + /// Luppp internal buffer resizing + void newBufferInTransit(bool n); + bool newBufferInTransit(); + unsigned long recordSpaceAvailable(); }; #endif // LUPPP_LOOPER_CLIP_H