From fd5cc9e44cf51b2eb28784e779232c8a0324c322 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Fri, 6 Apr 2018 08:41:01 +0200 Subject: [PATCH] Redo The Change --- src/looper.cxx | 3 +++ src/looperclip.cxx | 12 ++++++------ src/looperclip.hxx | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/looper.cxx b/src/looper.cxx index bdb49ea..5d1e431 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -110,6 +110,9 @@ 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]->getBeatsToRecord() > 0 && clips[clip]->getBeats() >= clips[clip]->getBeatsToRecord() - 4) + clips[clip]->queuePlay(true); + if ( clips[clip]->recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST && !clips[clip]->newBufferInTransit() ) { EventLooperClipRequestBuffer e( track, clip, clips[clip]->audioBufferSize() + LOOPER_SAMPLES_UPDATE_SIZE); diff --git a/src/looperclip.cxx b/src/looperclip.cxx index a852cf3..3f4863e 100644 --- a/src/looperclip.cxx +++ b/src/looperclip.cxx @@ -49,7 +49,7 @@ void LooperClip::init() _queuePlay = false; _queueStop = false; _queueRecord= false; - _wantedBeats= -1; + _beatsToRecord= -1; setBeats(0); if ( _buffer ) { @@ -114,7 +114,7 @@ void LooperClip::load( AudioBuffer* ab ) } _buffer = ab; - EventClipBeatsChanged e( track, scene, _wantedBeats, true ); + EventClipBeatsChanged e( track, scene, _beatsToRecord, true ); writeToGuiRingbuffer( &e ); _playhead = 0; @@ -190,19 +190,19 @@ void LooperClip::setPlayHead(float ph) void LooperClip::setBarsToRecord(int bars) { if(!(_playing || _queuePlay || _queueStop || _loaded)) { - _wantedBeats = bars * 4; // we set beats - EventClipBeatsChanged e( track, scene, _wantedBeats, true); + _beatsToRecord = bars * 4; // we set beats + EventClipBeatsChanged e( track, scene, _beatsToRecord, true); writeToGuiRingbuffer(&e); } } int LooperClip::getBeatsToRecord() { - return _wantedBeats; + return _beatsToRecord; } int LooperClip::getBarsToRecord(){ - return _wantedBeats / 4; + return _beatsToRecord / 4; } void LooperClip::record(int count, float* L, float* R) diff --git a/src/looperclip.hxx b/src/looperclip.hxx index 27a763c..6f7936a 100644 --- a/src/looperclip.hxx +++ b/src/looperclip.hxx @@ -145,7 +145,7 @@ private: float _playhead; float _recordhead; - int _wantedBeats; + int _beatsToRecord; AudioBuffer* _buffer; };