mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
fixed some glitch issues, glitch on send_track_0 persists :(
This commit is contained in:
parent
662b235d91
commit
a65ddf6f38
4 changed files with 34 additions and 12 deletions
|
@ -394,6 +394,7 @@ int Jack::process (jack_nframes_t nframes)
|
|||
buffers.audio[Buffers::JACK_SIDECHAIN_KEY] = (float*)jack_port_get_buffer(sidechainKeyOutput,nframes);
|
||||
buffers.audio[Buffers::JACK_SIDECHAIN_SIGNAL]=(float*)jack_port_get_buffer(sidechainSignalOutput,nframes);
|
||||
|
||||
|
||||
// clear the buffers
|
||||
memset( buffers.audio[Buffers::JACK_MASTER_OUT_L] , 0, sizeof(float) * nframes );
|
||||
memset( buffers.audio[Buffers::JACK_MASTER_OUT_R] , 0, sizeof(float) * nframes );
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "jacksendreturn.hxx"
|
||||
#include "jack.hxx"
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
extern Jack* jack;
|
||||
JackSendReturn::JackSendReturn(int trackid, AudioProcessor *prev, jack_client_t *client)
|
||||
:m_trackid(trackid), m_previousProcessor(prev)
|
||||
|
@ -10,30 +12,46 @@ JackSendReturn::JackSendReturn(int trackid, AudioProcessor *prev, jack_client_t
|
|||
sprintf(name, "Return_track_%d\0",trackid);
|
||||
m_returnport=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsInput,0);
|
||||
m_active=false;
|
||||
m_counter=0;
|
||||
}
|
||||
|
||||
void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
|
||||
{
|
||||
//Reset send buffer
|
||||
memset(buffers->audio[Buffers::SEND_TRACK_0+m_trackid],0,nframes*sizeof(float));
|
||||
int offset=m_counter%(buffers->nframes);
|
||||
float* sendtrack=&(buffers->audio[Buffers::SEND_TRACK_0+m_trackid][0]);
|
||||
|
||||
|
||||
float* rettrack=&(buffers->audio[Buffers::RETURN_TRACK_0+m_trackid][0]);
|
||||
|
||||
memset(sendtrack,0,nframes*sizeof(float));
|
||||
|
||||
//Process previous AudioProcessor
|
||||
m_previousProcessor->process(nframes,buffers);
|
||||
float* send=(float*)jack_port_get_buffer(m_sendport,(jack_nframes_t)nframes);
|
||||
float* ret=(float*)jack_port_get_buffer(m_returnport,(jack_nframes_t)nframes);
|
||||
float* send=(float*)jack_port_get_buffer(m_sendport,(jack_nframes_t)(buffers->nframes));
|
||||
float* ret=(float*)jack_port_get_buffer(m_returnport,(jack_nframes_t)(buffers->nframes));
|
||||
if(offset)
|
||||
{
|
||||
send+=offset;
|
||||
ret+=offset;
|
||||
}
|
||||
|
||||
//Copy result of previous AudioProcessor to send port
|
||||
// memcpy(send,buffers->audio[Buffers::SEND_TRACK_0+m_trackid],nframes*sizeof(float));
|
||||
// memset(send,0,nframes*sizeof(float));
|
||||
for(int i=0;i<nframes;i++)
|
||||
send[i]=m_sendvol*buffers->audio[Buffers::SEND_TRACK_0+m_trackid][i];
|
||||
send[i]=m_sendvol*sendtrack[i];
|
||||
// if(nframes!=buffers->nframes)
|
||||
// {
|
||||
// cout<<send<<endl;
|
||||
// }
|
||||
|
||||
if(offset)
|
||||
assert(offset+nframes==buffers->nframes);
|
||||
|
||||
if(m_active)
|
||||
memcpy(buffers->audio[Buffers::RETURN_TRACK_0+m_trackid],ret,nframes*sizeof(float));
|
||||
memcpy(rettrack,ret,nframes*sizeof(float));
|
||||
else
|
||||
memcpy(buffers->audio[Buffers::RETURN_TRACK_0+m_trackid],
|
||||
buffers->audio[Buffers::SEND_TRACK_0+m_trackid],nframes*sizeof(float));
|
||||
memcpy(rettrack,
|
||||
sendtrack,nframes*sizeof(float));
|
||||
m_counter+=nframes;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
jack_port_t* m_returnport;
|
||||
int m_trackid;
|
||||
AudioProcessor* m_previousProcessor;
|
||||
int m_counter;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -223,6 +223,7 @@ void TimeManager::process(Buffers* buffers)
|
|||
}
|
||||
|
||||
// process before beat:
|
||||
if(before)
|
||||
jack->processFrames( before );
|
||||
|
||||
// handle beat:
|
||||
|
@ -246,6 +247,7 @@ void TimeManager::process(Buffers* buffers)
|
|||
// process after
|
||||
// we need to clear internal buffers in order to write *after* frames to them
|
||||
jack->clearInternalBuffers(nframes);
|
||||
if(after)
|
||||
jack->processFrames( after );
|
||||
|
||||
// write new beat to UI (bar info currently not used)
|
||||
|
|
Loading…
Add table
Reference in a new issue