From d25a7ab3391a1306e722a347d721c3b477a8c641 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Sat, 7 Dec 2013 23:27:33 +0000 Subject: [PATCH] -Aesthetic code improvements --- src/looper.cxx | 6 ++++++ src/looper.hxx | 2 +- src/looperclip.cxx | 5 ++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/looper.cxx b/src/looper.cxx index 787fc2e..5c54437 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -59,6 +59,11 @@ void Looper::setRequestedBuffer(int s, AudioBuffer* ab) clips[s]->setRequestedBuffer( ab ); } +void Looper::setFpb(int f) +{ + fpb = f; +} + void Looper::process(unsigned int nframes, Buffers* buffers) { // process each clip individually: this allows for playback of one clip, @@ -97,6 +102,7 @@ void Looper::process(unsigned int nframes, Buffers* buffers) for(unsigned int i = 0; i < nframes; i++ ) { + // REFACTOR into system that is better than per sample function calls float tmp = clips[clip]->getSample(playSpeed); float deltaPitch = 12 * log ( playSpeed ) / log (2); diff --git a/src/looper.hxx b/src/looper.hxx index b3058db..f27e421 100644 --- a/src/looper.hxx +++ b/src/looper.hxx @@ -28,7 +28,7 @@ class Looper : public AudioProcessor, public TimeObserver void setRequestedBuffer(int s, AudioBuffer* ab); /// stores the framesPerBeat from TimeManager. Used to stretch audio - void setFpb(int f) { fpb = f; } + void setFpb(int f); /// Retrieve a clip from the Looper LooperClip* getClip(int scene); diff --git a/src/looperclip.cxx b/src/looperclip.cxx index 7f42fa4..1bccf35 100644 --- a/src/looperclip.cxx +++ b/src/looperclip.cxx @@ -139,7 +139,6 @@ void LooperClip::setRequestedBuffer( AudioBuffer* ab ) void LooperClip::recieveSaveBuffer( AudioBuffer* saveBuffer ) { - // CRITICAL FIXME: crash on buffer size difference if ( saveBuffer->getData().size() >= _buffer->getData().at(0) ) { // copy current contents into save buffer, @@ -184,8 +183,8 @@ void LooperClip::record(int count, float* L, float* R) else { // break: this is *BAD*, audio data is lost but the buffer isn't here - // yet to hold new audio data so there's no option. This has only been - // experienced during development / testing, not actual usage. + // yet to hold new audio data so there's no option. This has not been + // encountered in actual usage, only during the development process. char buffer [50]; sprintf (buffer, "LooperClip t %i, s %i, Error: out of mem!",track, scene ); EventGuiPrint e( buffer );