Prevent setting playhead from outside for now, only allow reset

main
Georg Krause 2019-04-05 19:23:49 +02:00
parent 71feed4220
commit 1422ab277d
3 changed files with 9 additions and 12 deletions

View File

@ -186,7 +186,7 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
void Looper::resetTimeState()
{
for(int i=0; i<NSCENES; i++)
clips[i]->setPlayHead(0.0);
clips[i]->resetPlayHead();
}
void Looper::pitchShift(int count, float* input, float* output)

View File

@ -37,8 +37,7 @@ LooperClip::LooperClip(int t, int s) :
track(t),
scene(s)
{
_buffer = new AudioBuffer();
_buffer->nonRtResize( LOOPER_SAMPLES_UPDATE_SIZE );
_buffer = new AudioBuffer(LOOPER_SAMPLES_UPDATE_SIZE);
init();
#ifdef DEBUG_BUFFER
@ -174,17 +173,16 @@ void LooperClip::recieveSaveBuffer( AudioBuffer* saveBuffer )
}
}
void LooperClip::setPlayHead(float ph)
void LooperClip::resetPlayHead()
{
// TODO set _barsPlayed correctly, is this a good idea to allow playhead setting from outside?
if(!_recording&&_playing) {
_playhead = ph;
jack->getControllerUpdater()->setTrackSceneProgress(track, scene, getProgress() );
if (!_recording)
{
_playhead = 0;
_barsPlayed = 0;
updateController();
}
}
void LooperClip::record(int count, float* L, float* R)
{
if (recordSpaceAvailable() < LOOPER_SAMPLES_BEFORE_REQUEST && !newBufferInTransit()) {
@ -481,7 +479,6 @@ float LooperClip::getProgress()
{
if ( _buffer && _playing ) {
float p = float(_playhead) / _recordhead;
//printf("LooperClip progress %f\n", p );
return p;
}
return 0.f;

View File

@ -104,7 +104,7 @@ public:
void recieveSaveBuffer( AudioBuffer* ab );
///reset the play head to zero. Does nothing when recording
void setPlayHead(float ph);
void resetPlayHead();
#ifdef BUILD_TESTS
// used only in test cases