Reset Playhead on the first beat of the first bar of a loop
parent
289313ce13
commit
a0cca4d78f
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -140,6 +140,8 @@ private:
|
|||
|
||||
float _playhead;
|
||||
float _recordhead;
|
||||
|
||||
unsigned int _barsPlayed;
|
||||
AudioBuffer* _buffer;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue