From 2ecbd47742aaa2ce2d8fec9f355ad64ae6c3d223 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Wed, 31 Jul 2013 01:28:18 +0100 Subject: [PATCH] -Debugging strange distortion --- src/jack.cxx | 6 ++++-- src/looper.cxx | 5 +++-- src/trackoutput.hxx | 1 + src/worker.hxx | 6 +++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/jack.cxx b/src/jack.cxx index 3bba39b..ccd9c6f 100644 --- a/src/jack.cxx +++ b/src/jack.cxx @@ -68,7 +68,7 @@ Jack::Jack() trackOutputs.push_back( new TrackOutput(i, loopers.back() ) ); - //buffers.audio[Buffers::TRACK_0 + i] = new float( nframes ); // (float*) malloc( sizeof(float) * nframes ); + buffers.audio[Buffers::TRACK_0 + i] = new float( nframes ); // (float*) malloc( sizeof(float) * nframes ); } timeManager.registerObserver( &metronome ); @@ -114,11 +114,13 @@ int Jack::process (jack_nframes_t nframes) // pre-zero output buffers + /* memset( buffers.audio[Buffers::MASTER_OUTPUT] , 0, sizeof(float) * nframes ); memset( buffers.audio[Buffers::JACK_MASTER_OUTPUT], 0, sizeof(float) * nframes ); memset( buffers.audio[Buffers::REVERB] , 0, sizeof(float) * nframes ); memset( buffers.audio[Buffers::SIDECHAIN] , 0, sizeof(float) * nframes ); memset( buffers.audio[Buffers::POST_SIDECHAIN] , 0, sizeof(float) * nframes ); + */ jack_midi_clear_buffer( buffers.midi[Buffers::APC_OUTPUT] ); @@ -152,7 +154,7 @@ int Jack::process (jack_nframes_t nframes) // process each track, starting at output and working up signal path for(uint i = 0; i < NTRACKS; i++) { - loopers.at(i)->process( nframes, &buffers ); + trackOutputs.at(i)->process( nframes, &buffers ); } /* diff --git a/src/looper.cxx b/src/looper.cxx index c683275..8601ebc 100644 --- a/src/looper.cxx +++ b/src/looper.cxx @@ -30,8 +30,9 @@ Looper::Looper(int t) : // init faust pitch shift variables fSamplingFreq = 44100; IOTA = 0; - for ( int i = 0; i < MAX_BUFFER_SIZE; i++) - tmpBuffer.push_back(0.f); + + tmpBuffer.resize(MAX_BUFFER_SIZE); + for (int i=0; i<65536; i++) fVec0[i] = 0; for (int i=0; i<2; i++) diff --git a/src/trackoutput.hxx b/src/trackoutput.hxx index e3f3b69..53ee09a 100644 --- a/src/trackoutput.hxx +++ b/src/trackoutput.hxx @@ -13,6 +13,7 @@ class TrackOutput : public AudioProcessor { public: TrackOutput(int t, AudioProcessor* ap) : + AudioProcessor(), track(t), previousInChain(ap), dbMeter(44100) diff --git a/src/worker.hxx b/src/worker.hxx index 87549cc..eb4cb55 100644 --- a/src/worker.hxx +++ b/src/worker.hxx @@ -29,7 +29,11 @@ namespace Worker ab->nonRtSetSample( buf ); cout << "Worker: loadSample() " << path << " size: " << infile.frames() << endl; - return ab; + + if ( infile.frames() > 0 ) + return ab; + + return 0; } }