mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
restyled looper and looperclip
This commit is contained in:
parent
a431ff3868
commit
a2e154a8be
2 changed files with 13 additions and 15 deletions
|
@ -136,8 +136,8 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
|
||||||
|
|
||||||
for(unsigned int i = 0; i < nframes; i++ ) {
|
for(unsigned int i = 0; i < nframes; i++ ) {
|
||||||
// REFACTOR into system that is better than per sample function calls
|
// REFACTOR into system that is better than per sample function calls
|
||||||
float tmpL = 0;
|
float tmpL = 0;
|
||||||
float tmpR = 0;
|
float tmpR = 0;
|
||||||
clips[clip]->getSample(playSpeed, &tmpL, &tmpR);
|
clips[clip]->getSample(playSpeed, &tmpL, &tmpR);
|
||||||
|
|
||||||
float deltaPitch = 12 * log ( playSpeed ) / log (2);
|
float deltaPitch = 12 * log ( playSpeed ) / log (2);
|
||||||
|
@ -149,11 +149,10 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
|
||||||
if(playSpeed!=1.0f) {
|
if(playSpeed!=1.0f) {
|
||||||
pitchShift( 1, &tmpL, &outL[i] );
|
pitchShift( 1, &tmpL, &outL[i] );
|
||||||
pitchShift( 1, &tmpR, &outR[i] );
|
pitchShift( 1, &tmpR, &outR[i] );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
outL[i]+=tmpL;
|
outL[i]+=tmpL;
|
||||||
outR[i]+=tmpR;
|
outR[i]+=tmpR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("Looper %i playing(), speed = %f\n", track, playSpeed );
|
//printf("Looper %i playing(), speed = %f\n", track, playSpeed );
|
||||||
|
|
|
@ -157,7 +157,7 @@ void LooperClip::recieveSaveBuffer( AudioBuffer* saveBuffer )
|
||||||
if ( saveBuffer->getSize() >= _buffer->getDataL().at(0) ||
|
if ( saveBuffer->getSize() >= _buffer->getDataL().at(0) ||
|
||||||
saveBuffer->getSize() >= _buffer->getDataR().at(0) ) {
|
saveBuffer->getSize() >= _buffer->getDataR().at(0) ) {
|
||||||
// copy current contents into save buffer,
|
// 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();
|
size_t framesBySize = _buffer->getAudioFrames();
|
||||||
memcpy( &saveBuffer->getDataL().at(0), &_buffer->getDataL().at(0), sizeof(float)*framesBySize);
|
memcpy( &saveBuffer->getDataL().at(0), &_buffer->getDataL().at(0), sizeof(float)*framesBySize);
|
||||||
memcpy( &saveBuffer->getDataR().at(0), &_buffer->getDataR().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()
|
unsigned long LooperClip::recordSpaceAvailable()
|
||||||
{
|
{
|
||||||
if ( _buffer )
|
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 _buffer->getSize() - _recordhead;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -428,16 +428,15 @@ void LooperClip::getSample(float playSpeed, float* L, float* R)
|
||||||
//writeToGuiRingbuffer( &e );
|
//writeToGuiRingbuffer( &e );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<float>& vL = _buffer->getDataL();
|
std::vector<float>& vL = _buffer->getDataL();
|
||||||
std::vector<float>& vR = _buffer->getDataR();
|
std::vector<float>& vR = _buffer->getDataR();
|
||||||
*L = vL.at(_playhead);
|
*L = vL.at(_playhead);
|
||||||
*R = vR.at(_playhead);
|
*R = vR.at(_playhead);
|
||||||
_playhead +=playSpeed;
|
_playhead +=playSpeed;
|
||||||
|
} else {
|
||||||
|
*L = 0.f;
|
||||||
|
*R = 0.f;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
*L = 0.f;
|
|
||||||
*R = 0.f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float LooperClip::getProgress()
|
float LooperClip::getProgress()
|
||||||
|
|
Loading…
Add table
Reference in a new issue