-Volume controls on tracks working, trackOutput buffers being used
parent
272365c589
commit
85ec190e30
15
src/jack.cxx
15
src/jack.cxx
|
@ -59,23 +59,12 @@ Jack::Jack()
|
||||||
buffers.audio[Buffers::POST_SIDECHAIN] = new float( nframes );
|
buffers.audio[Buffers::POST_SIDECHAIN] = new float( nframes );
|
||||||
buffers.audio[Buffers::MASTER_OUTPUT] = 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++)
|
for(int i = 0; i < NTRACKS; i++)
|
||||||
{
|
{
|
||||||
loopers.push_back( new Looper(i) );
|
loopers.push_back( new Looper(i) );
|
||||||
timeManager.registerObserver( loopers.back() );
|
|
||||||
|
|
||||||
trackOutputs.push_back( new TrackOutput(i, loopers.back() ) );
|
trackOutputs.push_back( new TrackOutput(i, loopers.back() ) );
|
||||||
|
|
||||||
|
timeManager.registerObserver( loopers.back() );
|
||||||
}
|
}
|
||||||
|
|
||||||
timeManager.registerObserver( &metronome );
|
timeManager.registerObserver( &metronome );
|
||||||
|
|
|
@ -186,8 +186,8 @@ void Looper::process(int nframes, Buffers* buffers)
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// using the track output causes distortion: clipping / not proper writing.
|
// using the track output causes distortion: clipping / not proper writing.
|
||||||
// writing to master fixes issue, so its due to trackOutput or Looper 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::TRACK_0 + track];
|
||||||
float* out = buffers->audio[Buffers::MASTER_OUTPUT];
|
//float* out = buffers->audio[Buffers::MASTER_OUTPUT];
|
||||||
|
|
||||||
// process each clip individually: this allows for playback of one clip,
|
// process each clip individually: this allows for playback of one clip,
|
||||||
// while another clip records.
|
// 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
|
// copy data into tmpBuffer, then pitch-stretch into track buffer
|
||||||
for(int i = 0; i < nframes; i++ )
|
for(int i = 0; i < nframes; i++ )
|
||||||
{
|
{
|
||||||
out[i] += clips[clip]->getSample();
|
out[i] = clips[clip]->getSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update UI of progress
|
// update UI of progress
|
||||||
|
|
|
@ -20,8 +20,6 @@ class TrackOutput : public AudioProcessor
|
||||||
{
|
{
|
||||||
printf("trackOutput ID: %i\n", track);
|
printf("trackOutput ID: %i\n", track);
|
||||||
|
|
||||||
_trackBuffer = new float( 1024 );
|
|
||||||
|
|
||||||
// UI update
|
// UI update
|
||||||
uiUpdateConstant = 44100 / 30;
|
uiUpdateConstant = 44100 / 30;
|
||||||
uiUpdateCounter = 44100 / 30;
|
uiUpdateCounter = 44100 / 30;
|
||||||
|
@ -56,18 +54,27 @@ class TrackOutput : public AudioProcessor
|
||||||
/// copies the track output to master buffer, sidechain & post-side buffer
|
/// copies the track output to master buffer, sidechain & post-side buffer
|
||||||
void process(int nframes, Buffers* buffers)
|
void process(int nframes, Buffers* buffers)
|
||||||
{
|
{
|
||||||
|
// zero track buffer
|
||||||
|
float* buf = _trackBuffer;
|
||||||
|
for(int i = 0; i < nframes; i++ )
|
||||||
|
{
|
||||||
|
*buf++ = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
if ( previousInChain )
|
if ( previousInChain )
|
||||||
{
|
{
|
||||||
|
buffers->audio[Buffers::TRACK_0 + track] = _trackBuffer;
|
||||||
|
//memset( _trackBuffer, 0, nframes );
|
||||||
previousInChain->process( nframes, buffers );
|
previousInChain->process( nframes, buffers );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// run the meter
|
||||||
float* buf = buffers->audio[Buffers::TRACK_0 + track];
|
buf = _trackBuffer;
|
||||||
dbMeter.process( nframes, buf, buf );
|
dbMeter.process( nframes, buf, buf );
|
||||||
|
|
||||||
if (uiUpdateCounter > uiUpdateConstant )
|
if (uiUpdateCounter > uiUpdateConstant )
|
||||||
{
|
{
|
||||||
EventTrackSignalLevel e( track, dbMeter.getLeftDB(), dbMeter.getRightDB() );
|
EventTrackSignalLevel e( track, dbMeter.getLeftDB() * _toMaster, dbMeter.getRightDB() * _toMaster );
|
||||||
writeToGuiRingbuffer( &e );
|
writeToGuiRingbuffer( &e );
|
||||||
uiUpdateCounter = 0;
|
uiUpdateCounter = 0;
|
||||||
}
|
}
|
||||||
|
@ -87,10 +94,11 @@ class TrackOutput : public AudioProcessor
|
||||||
//*sidechain++ += *trackBuf * _toSidechain;
|
//*sidechain++ += *trackBuf * _toSidechain;
|
||||||
//*postSidechain++ += *trackBuf * _toPostSidechain;
|
//*postSidechain++ += *trackBuf * _toPostSidechain;
|
||||||
|
|
||||||
//*master++ += *trackBuf * _toMaster;
|
*master++ += *trackBuf * _toMaster;
|
||||||
|
|
||||||
trackBuf++;
|
trackBuf++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~TrackOutput()
|
~TrackOutput()
|
||||||
|
@ -101,7 +109,7 @@ class TrackOutput : public AudioProcessor
|
||||||
private:
|
private:
|
||||||
int track;
|
int track;
|
||||||
|
|
||||||
float* _trackBuffer;
|
float _trackBuffer[1024];
|
||||||
|
|
||||||
float _toMaster;
|
float _toMaster;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue