-Removed Jack internal masterL & masterR buffers, moved track buffers back into Buffer class

This commit is contained in:
Harry van Haaren 2013-08-15 23:21:13 +01:00
parent 65926bad13
commit 35626aad74
4 changed files with 11 additions and 28 deletions

View file

@ -65,28 +65,21 @@ Jack::Jack() :
0 );
masterL.resize( buffers.nframes );
masterR.resize( buffers.nframes );
/// prepare internal buffers
buffers.audio[Buffers::REVERB] = new float[ buffers.nframes ];
buffers.audio[Buffers::SIDECHAIN] = new float[ buffers.nframes ];
buffers.audio[Buffers::POST_SIDECHAIN] = new float[ buffers.nframes ];
buffers.audio[Buffers::MASTER_OUT_L] = &masterL[0]; //new float( buffers.nframes );
buffers.audio[Buffers::MASTER_OUT_R] = &masterR[0]; //new float( buffers.nframes );
cout << "master L buffer = " << buffers.audio[Buffers::MASTER_OUT_L] << endl
<< "master R buffer = " << buffers.audio[Buffers::MASTER_OUT_R] << endl
<< "difference = " << buffers.audio[Buffers::MASTER_OUT_R] - buffers.audio[Buffers::MASTER_OUT_L] << endl;
buffers.audio[Buffers::MASTER_OUT_L] = new float[ buffers.nframes ];
buffers.audio[Buffers::MASTER_OUT_R] = new float[ buffers.nframes ];
for(int i = 0; i < NTRACKS; i++)
{
loopers.push_back( new Looper(i) );
trackOutputs.push_back( new TrackOutput(i, loopers.back() ) );
buffers.audio[Buffers::TRACK_0 + i] = new float[ buffers.nframes ];
timeManager.registerObserver( loopers.back() );
}
@ -185,7 +178,7 @@ int Jack::process (jack_nframes_t nframes)
}
//metronome->process( nframes, &buffers );
metronome->process( nframes, &buffers );
/*
if ( reverb->getActive() )

View file

@ -74,11 +74,6 @@ class Jack
vector<TrackOutput*> trackOutputs;
vector<MidiObserver*> midiObservers;
// internal audio buffers
vector<float> masterL;
vector<float> masterR;
// FX
Reverb* reverb;
DBMeter* reverbMeter;

View file

@ -14,9 +14,6 @@ TrackOutput::TrackOutput(int t, AudioProcessor* ap) :
//printf("trackOutput ID: %i, ap = ", track );
//std::cout << ap << std::endl;
_trackBuffer.resize( MAX_BUFFER_SIZE );
// UI update
uiUpdateConstant = 44100 / 30;
uiUpdateCounter = 44100 / 30;
@ -58,16 +55,16 @@ void TrackOutput::setSend( int send, float value )
void TrackOutput::process(int nframes, Buffers* buffers)
{
// zero track buffer
memset( &_trackBuffer[0], 0, nframes );
// get & zero track buffer
float* trackBuffer = buffers->audio[Buffers::TRACK_0 + track];
memset( trackBuffer, 0, nframes );
buffers->audio[Buffers::TRACK_0 + track] = &_trackBuffer[0];
// call process() up the chain
previousInChain->process( nframes, buffers );
// run the meter
float* buf = &_trackBuffer[0];
dbMeter.process( nframes, buf, buf );
dbMeter.process( nframes, trackBuffer, trackBuffer );
if (uiUpdateCounter > uiUpdateConstant )
{
@ -90,7 +87,7 @@ void TrackOutput::process(int nframes, Buffers* buffers)
for(int i = 0; i < nframes; i++)
{
float tmp = _trackBuffer[i];
float tmp = trackBuffer[i];
masterL[i] += tmp * _toMaster;
masterR[i] += tmp * _toMaster;

View file

@ -33,8 +33,6 @@ class TrackOutput : public AudioProcessor
private:
int track;
std::vector<float> _trackBuffer;
float _toMaster;
float _toReverb;