-Volume controls on tracks working, trackOutput buffers being used

main
Harry van Haaren 2013-07-31 02:48:59 +01:00
parent 272365c589
commit 85ec190e30
3 changed files with 20 additions and 23 deletions

View File

@ -59,23 +59,12 @@ Jack::Jack()
buffers.audio[Buffers::POST_SIDECHAIN] = new float( nframes );
buffers.audio[Buffers::MASTER_OUTPUT] = new float( nframes );
printf("Master output buffer on alloc() %i\n", buffers.audio[Buffers::MASTER_OUTPUT] );
buffers.audio[Buffers::TRACK_0] = new float( nframes );
buffers.audio[Buffers::TRACK_1] = new float( nframes );
buffers.audio[Buffers::TRACK_2] = new float( nframes );
buffers.audio[Buffers::TRACK_3] = new float( nframes );
buffers.audio[Buffers::TRACK_4] = new float( nframes );
buffers.audio[Buffers::TRACK_5] = new float( nframes );
buffers.audio[Buffers::TRACK_6] = new float( nframes );
buffers.audio[Buffers::TRACK_7] = new float( nframes );
for(int i = 0; i < NTRACKS; i++)
{
loopers.push_back( new Looper(i) );
timeManager.registerObserver( loopers.back() );
trackOutputs.push_back( new TrackOutput(i, loopers.back() ) );
timeManager.registerObserver( loopers.back() );
}
timeManager.registerObserver( &metronome );

View File

@ -186,8 +186,8 @@ void Looper::process(int nframes, Buffers* buffers)
// FIXME:
// using the track output causes distortion: clipping / not proper writing.
// writing to master fixes issue, so its due to trackOutput or Looper writing...?
//float* out = buffers->audio[Buffers::TRACK_0 + track];
float* out = buffers->audio[Buffers::MASTER_OUTPUT];
float* out = buffers->audio[Buffers::TRACK_0 + track];
//float* out = buffers->audio[Buffers::MASTER_OUTPUT];
// process each clip individually: this allows for playback of one clip,
// while another clip records.
@ -210,7 +210,7 @@ void Looper::process(int nframes, Buffers* buffers)
// copy data into tmpBuffer, then pitch-stretch into track buffer
for(int i = 0; i < nframes; i++ )
{
out[i] += clips[clip]->getSample();
out[i] = clips[clip]->getSample();
}
// update UI of progress

View File

@ -20,8 +20,6 @@ class TrackOutput : public AudioProcessor
{
printf("trackOutput ID: %i\n", track);
_trackBuffer = new float( 1024 );
// UI update
uiUpdateConstant = 44100 / 30;
uiUpdateCounter = 44100 / 30;
@ -56,18 +54,27 @@ class TrackOutput : public AudioProcessor
/// copies the track output to master buffer, sidechain & post-side buffer
void process(int nframes, Buffers* buffers)
{
// zero track buffer
float* buf = _trackBuffer;
for(int i = 0; i < nframes; i++ )
{
*buf++ = 0.f;
}
if ( previousInChain )
{
buffers->audio[Buffers::TRACK_0 + track] = _trackBuffer;
//memset( _trackBuffer, 0, nframes );
previousInChain->process( nframes, buffers );
}
float* buf = buffers->audio[Buffers::TRACK_0 + track];
// run the meter
buf = _trackBuffer;
dbMeter.process( nframes, buf, buf );
if (uiUpdateCounter > uiUpdateConstant )
{
EventTrackSignalLevel e( track, dbMeter.getLeftDB(), dbMeter.getRightDB() );
EventTrackSignalLevel e( track, dbMeter.getLeftDB() * _toMaster, dbMeter.getRightDB() * _toMaster );
writeToGuiRingbuffer( &e );
uiUpdateCounter = 0;
}
@ -87,10 +94,11 @@ class TrackOutput : public AudioProcessor
//*sidechain++ += *trackBuf * _toSidechain;
//*postSidechain++ += *trackBuf * _toPostSidechain;
//*master++ += *trackBuf * _toMaster;
*master++ += *trackBuf * _toMaster;
trackBuf++;
}
}
~TrackOutput()
@ -101,7 +109,7 @@ class TrackOutput : public AudioProcessor
private:
int track;
float* _trackBuffer;
float _trackBuffer[1024];
float _toMaster;