Redo The Change

This commit is contained in:
Valentin Boettcher 2018-04-06 08:41:01 +02:00
parent a149c94423
commit fd5cc9e44c
3 changed files with 10 additions and 7 deletions

View file

@ -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);

View file

@ -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)

View file

@ -145,7 +145,7 @@ private:
float _playhead;
float _recordhead;
int _wantedBeats;
int _beatsToRecord;
AudioBuffer* _buffer;
};