Merge pull request #202 from openAVproductions/cleanup

Cleanup and optimize LooperClip playback
This commit is contained in:
Harry van Haaren 2018-03-26 20:47:43 +01:00 committed by GitHub
commit ff34b33893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 19 deletions

View file

@ -36,10 +36,12 @@ void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
//Process previous AudioProcessor
m_previousProcessor->process(nframes,buffers);
float* sendL=(float*)jack_port_get_buffer(m_sendport_l,(jack_nframes_t)(buffers->nframes));
float* sendR=(float*)jack_port_get_buffer(m_sendport_r,(jack_nframes_t)(buffers->nframes));
float* retL=(float*)jack_port_get_buffer(m_returnport_l,(jack_nframes_t)(buffers->nframes));
float* retR=(float*)jack_port_get_buffer(m_returnport_r,(jack_nframes_t)(buffers->nframes));
float* sendL=(float*)jack_port_get_buffer(m_sendport_l, (jack_nframes_t)(buffers->nframes));
float* sendR=(float*)jack_port_get_buffer(m_sendport_r, (jack_nframes_t)(buffers->nframes));
float* retL =(float*)jack_port_get_buffer(m_returnport_l,(jack_nframes_t)(buffers->nframes));
float* retR =(float*)jack_port_get_buffer(m_returnport_r,(jack_nframes_t)(buffers->nframes));
if(offset) {
sendL+=offset;
sendR+=offset;
@ -50,11 +52,7 @@ void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
for(int i=0; i<nframes; i++) {
sendL[i]=m_sendvol*sendtrackL[i];
sendR[i]=m_sendvol*sendtrackR[i];
}
// if(nframes!=buffers->nframes)
// {
// cout<<send<<endl;
// }
}
if(offset)
assert(offset+nframes==buffers->nframes);
@ -62,13 +60,11 @@ void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
if(m_active) {
memcpy(rettrackL,retL,nframes*sizeof(float));
memcpy(rettrackR,retR,nframes*sizeof(float));
}
}
else {
memcpy(rettrackL,
sendtrackL,nframes*sizeof(float));
memcpy(rettrackR,
sendtrackR,nframes*sizeof(float));
}
memcpy(rettrackL, sendtrackL,nframes*sizeof(float));
memcpy(rettrackR, sendtrackR,nframes*sizeof(float));
}
m_counter+=nframes;
}

View file

@ -146,7 +146,7 @@ void Looper::process(unsigned int nframes, Buffers* buffers)
// write the pitch-shifted signal to the track buffer
//FIXME: pitchShift adds delay even for playSpeed = 1.0!!
//we should use something better (e.g librubberband)
if(playSpeed!=1.0f) {
if(0) { //playSpeed!=1.0f) {
pitchShift( 1, &tmpL, &outL[i] );
pitchShift( 1, &tmpR, &outR[i] );
} else {

View file

@ -430,9 +430,9 @@ void LooperClip::getSample(float playSpeed, float* L, float* R)
std::vector<float>& vL = _buffer->getDataL();
std::vector<float>& vR = _buffer->getDataR();
*L = vL.at(_playhead);
*R = vR.at(_playhead);
_playhead +=playSpeed;
*L = vL[_playhead];
*R = vR[_playhead];
_playhead += playSpeed;
} else {
*L = 0.f;
*R = 0.f;