-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 ); 0 );
masterL.resize( buffers.nframes );
masterR.resize( buffers.nframes );
/// prepare internal buffers /// prepare internal buffers
buffers.audio[Buffers::REVERB] = new float[ buffers.nframes ]; buffers.audio[Buffers::REVERB] = new float[ buffers.nframes ];
buffers.audio[Buffers::SIDECHAIN] = new float[ buffers.nframes ]; buffers.audio[Buffers::SIDECHAIN] = new float[ buffers.nframes ];
buffers.audio[Buffers::POST_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_L] = new float[ buffers.nframes ];
buffers.audio[Buffers::MASTER_OUT_R] = &masterR[0]; //new float( buffers.nframes ); buffers.audio[Buffers::MASTER_OUT_R] = 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;
for(int i = 0; i < NTRACKS; i++) for(int i = 0; i < NTRACKS; i++)
{ {
loopers.push_back( new Looper(i) ); loopers.push_back( new Looper(i) );
trackOutputs.push_back( new TrackOutput(i, loopers.back() ) ); trackOutputs.push_back( new TrackOutput(i, loopers.back() ) );
buffers.audio[Buffers::TRACK_0 + i] = new float[ buffers.nframes ];
timeManager.registerObserver( loopers.back() ); 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() ) if ( reverb->getActive() )

View file

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

View file

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

View file

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