Reset Playhead on the first beat of the first bar of a loop

main
Georg Krause 2018-06-08 18:23:58 +02:00
parent 289313ce13
commit a0cca4d78f
2 changed files with 12 additions and 0 deletions

View File

@ -60,6 +60,7 @@ void LooperClip::init()
_playhead = 0;
_recordhead = 0;
_barsPlayed = 0;
}
@ -279,6 +280,15 @@ void LooperClip::bar()
_buffer->setAudioFrames( jack->getTimeManager()->getFpb() * _buffer->getBeats() );
}
if ( _playing ) {
_barsPlayed++;
}
if ( _playing && _barsPlayed >= getBeats() / 4) {
_barsPlayed = 0;
_playhead = 0;
}
if ( _playhead >= _recordhead ) {
_playhead = 0.f;
}

View File

@ -140,6 +140,8 @@ private:
float _playhead;
float _recordhead;
unsigned int _barsPlayed;
AudioBuffer* _buffer;
};