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
d3048154b0
commit
efa6d9054c
4 changed files with 34 additions and 12 deletions
|
@ -393,6 +393,7 @@ int Jack::process (jack_nframes_t nframes)
|
||||||
buffers.audio[Buffers::JACK_MASTER_OUT_R] = (float*)jack_port_get_buffer( masterOutputR , nframes );
|
buffers.audio[Buffers::JACK_MASTER_OUT_R] = (float*)jack_port_get_buffer( masterOutputR , nframes );
|
||||||
buffers.audio[Buffers::JACK_SIDECHAIN_KEY] = (float*)jack_port_get_buffer(sidechainKeyOutput,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);
|
buffers.audio[Buffers::JACK_SIDECHAIN_SIGNAL]=(float*)jack_port_get_buffer(sidechainSignalOutput,nframes);
|
||||||
|
|
||||||
|
|
||||||
// clear the buffers
|
// clear the buffers
|
||||||
memset( buffers.audio[Buffers::JACK_MASTER_OUT_L] , 0, sizeof(float) * nframes );
|
memset( buffers.audio[Buffers::JACK_MASTER_OUT_L] , 0, sizeof(float) * nframes );
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "jacksendreturn.hxx"
|
#include "jacksendreturn.hxx"
|
||||||
#include "jack.hxx"
|
#include "jack.hxx"
|
||||||
|
#include <math.h>
|
||||||
|
#include <assert.h>
|
||||||
extern Jack* jack;
|
extern Jack* jack;
|
||||||
JackSendReturn::JackSendReturn(int trackid, AudioProcessor *prev, jack_client_t *client)
|
JackSendReturn::JackSendReturn(int trackid, AudioProcessor *prev, jack_client_t *client)
|
||||||
:m_trackid(trackid), m_previousProcessor(prev)
|
: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);
|
sprintf(name, "Return_track_%d\0",trackid);
|
||||||
m_returnport=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsInput,0);
|
m_returnport=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsInput,0);
|
||||||
m_active=false;
|
m_active=false;
|
||||||
|
m_counter=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
|
void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
|
||||||
{
|
{
|
||||||
//Reset send buffer
|
//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
|
//Process previous AudioProcessor
|
||||||
m_previousProcessor->process(nframes,buffers);
|
m_previousProcessor->process(nframes,buffers);
|
||||||
float* send=(float*)jack_port_get_buffer(m_sendport,(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)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++)
|
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)
|
if(m_active)
|
||||||
memcpy(buffers->audio[Buffers::RETURN_TRACK_0+m_trackid],ret,nframes*sizeof(float));
|
memcpy(rettrack,ret,nframes*sizeof(float));
|
||||||
else
|
else
|
||||||
memcpy(buffers->audio[Buffers::RETURN_TRACK_0+m_trackid],
|
memcpy(rettrack,
|
||||||
buffers->audio[Buffers::SEND_TRACK_0+m_trackid],nframes*sizeof(float));
|
sendtrack,nframes*sizeof(float));
|
||||||
|
m_counter+=nframes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
jack_port_t* m_returnport;
|
jack_port_t* m_returnport;
|
||||||
int m_trackid;
|
int m_trackid;
|
||||||
AudioProcessor* m_previousProcessor;
|
AudioProcessor* m_previousProcessor;
|
||||||
|
int m_counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,8 @@ void TimeManager::process(Buffers* buffers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// process before beat:
|
// process before beat:
|
||||||
jack->processFrames( before );
|
if(before)
|
||||||
|
jack->processFrames( before );
|
||||||
|
|
||||||
// handle beat:
|
// handle beat:
|
||||||
// inform observers of new beat FIRST
|
// inform observers of new beat FIRST
|
||||||
|
@ -246,7 +247,8 @@ void TimeManager::process(Buffers* buffers)
|
||||||
// process after
|
// process after
|
||||||
// we need to clear internal buffers in order to write *after* frames to them
|
// we need to clear internal buffers in order to write *after* frames to them
|
||||||
jack->clearInternalBuffers(nframes);
|
jack->clearInternalBuffers(nframes);
|
||||||
jack->processFrames( after );
|
if(after)
|
||||||
|
jack->processFrames( after );
|
||||||
|
|
||||||
// write new beat to UI (bar info currently not used)
|
// write new beat to UI (bar info currently not used)
|
||||||
EventTimeBarBeat e( barCounter, beatCounter );
|
EventTimeBarBeat e( barCounter, beatCounter );
|
||||||
|
|
Loading…
Add table
Reference in a new issue