restyled looper and looperclip

main
Harry van Haaren 2017-03-27 21:14:53 +01:00
parent a431ff3868
commit a2e154a8be
2 changed files with 13 additions and 15 deletions

View File

@ -136,8 +136,8 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
for(unsigned int i = 0; i < nframes; i++ ) {
// REFACTOR into system that is better than per sample function calls
float tmpL = 0;
float tmpR = 0;
float tmpL = 0;
float tmpR = 0;
clips[clip]->getSample(playSpeed, &tmpL, &tmpR);
float deltaPitch = 12 * log ( playSpeed ) / log (2);
@ -149,11 +149,10 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
if(playSpeed!=1.0f) {
pitchShift( 1, &tmpL, &outL[i] );
pitchShift( 1, &tmpR, &outR[i] );
}
else {
} else {
outL[i]+=tmpL;
outR[i]+=tmpR;
}
}
}
//printf("Looper %i playing(), speed = %f\n", track, playSpeed );

View File

@ -157,7 +157,7 @@ void LooperClip::recieveSaveBuffer( AudioBuffer* saveBuffer )
if ( saveBuffer->getSize() >= _buffer->getDataL().at(0) ||
saveBuffer->getSize() >= _buffer->getDataR().at(0) ) {
// copy current contents into save buffer,
// getData() contains L and R buffer, so twice the size is needed
// getData() contains L and R buffer, so twice the size is needed
size_t framesBySize = _buffer->getAudioFrames();
memcpy( &saveBuffer->getDataL().at(0), &_buffer->getDataL().at(0), sizeof(float)*framesBySize);
memcpy( &saveBuffer->getDataR().at(0), &_buffer->getDataR().at(0), sizeof(float)*framesBySize);
@ -223,7 +223,7 @@ void LooperClip::record(int count, float* L, float* R)
unsigned long LooperClip::recordSpaceAvailable()
{
if ( _buffer )
// getData() contains L and R buffer, so it is twice the size
// getData() contains L and R buffer, so it is twice the size
return _buffer->getSize() - _recordhead;
return 0;
@ -428,16 +428,15 @@ void LooperClip::getSample(float playSpeed, float* L, float* R)
//writeToGuiRingbuffer( &e );
}
std::vector<float>& vL = _buffer->getDataL();
std::vector<float>& vR = _buffer->getDataR();
*L = vL.at(_playhead);
*R = vR.at(_playhead);
std::vector<float>& vL = _buffer->getDataL();
std::vector<float>& vR = _buffer->getDataR();
*L = vL.at(_playhead);
*R = vR.at(_playhead);
_playhead +=playSpeed;
} else {
*L = 0.f;
*R = 0.f;
}
else {
*L = 0.f;
*R = 0.f;
}
}
float LooperClip::getProgress()