apply internal default naming of private vars
parent
4328296257
commit
d1d06b6607
|
@ -4,28 +4,28 @@
|
|||
#include <assert.h>
|
||||
extern Jack* jack;
|
||||
JackSendReturn::JackSendReturn(int trackid, AudioProcessor *prev, jack_client_t *client)
|
||||
:m_trackid(trackid), m_previousProcessor(prev), m_sendvol(1.0f)
|
||||
:_trackId(trackid), _previousProcessor(prev), _sendVol(1.0f)
|
||||
{
|
||||
char name[50];
|
||||
int trackid_human = trackid + 1;
|
||||
sprintf(name, "Send_track_%d_l\n",trackid_human);
|
||||
m_sendport_l=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsOutput,0);
|
||||
_sendPortL=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsOutput,0);
|
||||
sprintf(name, "Send_track_%d_r\n",trackid_human);
|
||||
m_sendport_r=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsOutput,0);
|
||||
_sendPortR=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsOutput,0);
|
||||
sprintf(name, "Return_track_%d_l\n",trackid_human);
|
||||
m_returnport_l=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsInput,0);
|
||||
_returnPortL=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsInput,0);
|
||||
sprintf(name, "Return_track_%d_r\n",trackid_human);
|
||||
m_returnport_r=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsInput,0);
|
||||
m_active=false;
|
||||
m_counter=0;
|
||||
_returnPortR=jack_port_register(client,name,JACK_DEFAULT_AUDIO_TYPE,JackPortIsInput,0);
|
||||
_active=false;
|
||||
_counter=0;
|
||||
}
|
||||
|
||||
void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
|
||||
{
|
||||
// index = first-track + (track * channels)
|
||||
int trackoffset = m_trackid * NCHANNELS;
|
||||
int trackoffset = _trackId * NCHANNELS;
|
||||
//Reset send buffer
|
||||
int offset=m_counter%(buffers->nframes);
|
||||
int offset=_counter%(buffers->nframes);
|
||||
float* sendtrackL=&(buffers->audio[Buffers::SEND_TRACK_0_L + trackoffset][0]);
|
||||
float* sendtrackR=&(buffers->audio[Buffers::SEND_TRACK_0_R + trackoffset][0]);
|
||||
|
||||
|
@ -37,12 +37,12 @@ void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
|
|||
memset(sendtrackR,0,nframes*sizeof(float));
|
||||
|
||||
//Process previous AudioProcessor
|
||||
m_previousProcessor->process(nframes,buffers);
|
||||
_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(_sendPortL, (jack_nframes_t)(buffers->nframes));
|
||||
float* sendR=(float*)jack_port_get_buffer(_sendPortR, (jack_nframes_t)(buffers->nframes));
|
||||
float* retL =(float*)jack_port_get_buffer(_returnPortL,(jack_nframes_t)(buffers->nframes));
|
||||
float* retR =(float*)jack_port_get_buffer(_returnPortR,(jack_nframes_t)(buffers->nframes));
|
||||
|
||||
if(offset) {
|
||||
sendL+=offset;
|
||||
|
@ -52,14 +52,14 @@ 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];
|
||||
sendL[i]=_sendVol*sendtrackL[i];
|
||||
sendR[i]=_sendVol*sendtrackR[i];
|
||||
}
|
||||
|
||||
if(offset)
|
||||
assert(offset+nframes==buffers->nframes);
|
||||
|
||||
if(m_active) {
|
||||
if(_active) {
|
||||
memcpy(rettrackL,retL,nframes*sizeof(float));
|
||||
memcpy(rettrackR,retR,nframes*sizeof(float));
|
||||
}
|
||||
|
@ -67,16 +67,16 @@ void JackSendReturn::process(unsigned int nframes, Buffers *buffers)
|
|||
memcpy(rettrackL, sendtrackL,nframes*sizeof(float));
|
||||
memcpy(rettrackR, sendtrackR,nframes*sizeof(float));
|
||||
}
|
||||
m_counter+=nframes;
|
||||
_counter+=nframes;
|
||||
|
||||
}
|
||||
|
||||
void JackSendReturn::activate(bool act)
|
||||
{
|
||||
m_active=act;
|
||||
_active=act;
|
||||
}
|
||||
|
||||
void JackSendReturn::sendVolume(float vol)
|
||||
{
|
||||
m_sendvol=vol;
|
||||
_sendVol=vol;
|
||||
}
|
||||
|
|
|
@ -37,21 +37,21 @@ public:
|
|||
//The process callback
|
||||
virtual void process(unsigned int nframes, Buffers* buffers);
|
||||
|
||||
//Activate the return chain. When m_active=true then Buffers::RETURN_TRACK_0+m_trackid gets the data
|
||||
//Activate the return chain. When _active=true then Buffers::RETURN_TRACK_0+_trackid gets the data
|
||||
//from the return port. The send port always send the incoming data
|
||||
void activate(bool act);
|
||||
void sendVolume(float vol);
|
||||
|
||||
private:
|
||||
bool m_active;
|
||||
float m_sendvol;
|
||||
jack_port_t* m_sendport_l;
|
||||
jack_port_t* m_sendport_r;
|
||||
jack_port_t* m_returnport_l;
|
||||
jack_port_t* m_returnport_r;
|
||||
int m_trackid;
|
||||
AudioProcessor* m_previousProcessor;
|
||||
int m_counter;
|
||||
bool _active;
|
||||
float _sendVol;
|
||||
jack_port_t* _sendPortL;
|
||||
jack_port_t* _sendPortR;
|
||||
jack_port_t* _returnPortL;
|
||||
jack_port_t* _returnPortR;
|
||||
int _trackId;
|
||||
AudioProcessor* _previousProcessor;
|
||||
int _counter;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue