From 48c47f398fe2716ef3be1bbc8d490d9cebdbb075 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Wed, 31 Jul 2013 11:46:45 +0100 Subject: [PATCH] -LooperClips now just normal instances, not pointers to --- src/looper.cxx | 16 ++++++++-------- src/looper.hxx | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/looper.cxx b/src/looper.cxx index f303b2a..bb8fab2 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -24,7 +24,7 @@ Looper::Looper(int t) : for(int i = 0; i < 10; i++ ) { - clips[i] = new LooperClip(); + clips[i] = LooperClip(); } // init faust pitch shift variables @@ -44,7 +44,7 @@ Looper::Looper(int t) : LooperClip* Looper::getClip(int scene) { - return clips[scene]; + return &clips[scene]; } void Looper::midi(unsigned char* data) @@ -148,7 +148,7 @@ void Looper::updateControllers() void Looper::setSample(int scene, AudioBuffer* ab) { - clips[scene]->load( ab ); + clips[scene].load( ab ); /* vector& buf = ab->getData(); if ( buf.size() > SAMPLE_SIZE ) @@ -195,28 +195,28 @@ void Looper::process(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].recording() ) { // copy data from input buffer to recording buffer - if ( clips[clip]->nframesAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST ) + if ( clips[clip].nframesAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST ) { // request bigger buffer for this track/scene } } - else if ( clips[clip]->playing() ) + else if ( clips[clip].playing() ) { //printf("Looper %i playing()\n", track ); // copy data into tmpBuffer, then pitch-stretch into track buffer for(int i = 0; i < nframes; i++ ) { - out[i] = clips[clip]->getSample(); + out[i] = clips[clip].getSample(); } // update UI of progress if ( uiUpdateCounter > uiUpdateConstant ) { - EventLooperProgress e(track, clips[clip]->getProgress() ); + EventLooperProgress e(track, clips[clip].getProgress() ); writeToGuiRingbuffer( &e ); //printf("writing event\n"); uiUpdateCounter = 0; diff --git a/src/looper.hxx b/src/looper.hxx index 8caacb6..046f8a3 100644 --- a/src/looper.hxx +++ b/src/looper.hxx @@ -44,7 +44,7 @@ class Looper : public AudioProcessor, public TimeObserver const int track; float* tmpRecordBuffer; - LooperClip* clips[10]; + LooperClip clips[10]; // Pitch Shifting void pitchShift(int count, float* input, float* output);