-Hunting distortion artifacts

This commit is contained in:
Harry van Haaren 2013-08-12 19:01:47 +01:00
parent edb2913d6e
commit 6b72cc5115
4 changed files with 16 additions and 28 deletions

View file

@ -76,6 +76,8 @@ Jack::Jack() :
for(int i = 0; i < NTRACKS; i++)
{
//buffers.audio[Buffers::TRACK_0 + i] = new float( nframes );
loopers.push_back( new Looper(i) );
trackOutputs.push_back( new TrackOutput(i, loopers.back() ) );
@ -134,25 +136,16 @@ int Jack::process (jack_nframes_t nframes)
buffers.midi [Buffers::APC_INPUT] = (void*) jack_port_get_buffer( apcMidiInput , nframes );
buffers.midi [Buffers::APC_OUTPUT] = (void*) jack_port_get_buffer( apcMidiOutput , nframes );
// pre-zero output buffers
for(uint i = 0; i < nframes; i++)
{
buffers.audio[Buffers::JACK_MASTER_OUT_L][i] = 0.f;
buffers.audio[Buffers::JACK_MASTER_OUT_R][i] = 0.f;
buffers.audio[Buffers::MASTER_OUT_L] [i] = 0.f;
buffers.audio[Buffers::MASTER_OUT_R] [i] = 0.f;
buffers.audio[Buffers::REVERB] [i] = 0.f;
buffers.audio[Buffers::SIDECHAIN] [i] = 0.f;
buffers.audio[Buffers::POST_SIDECHAIN] [i] = 0.f;
}
/*
memset( buffers.audio[Buffers::JACK_MASTER_OUT_L] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::JACK_MASTER_OUT_R] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::MASTER_OUT_L] , 0, sizeof(float) * nframes );
memset( buffers.audio[Buffers::MASTER_OUT_R] , 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] );
@ -188,6 +181,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 );
}
@ -205,7 +199,7 @@ int Jack::process (jack_nframes_t nframes)
if ( reverb->getActive() )
{
reverbMeter->process(nframes, buffers.audio[Buffers::REVERB], buffers.audio[Buffers::REVERB] );
//reverb->process( nframes, &buf[0], &buf[2] );
reverb->process( nframes, &buf[0], &buf[2] );
}
// db meter on master output, then memcpy to JACK
@ -229,7 +223,6 @@ int Jack::process (jack_nframes_t nframes)
memcpy( buffers.audio[Buffers::JACK_MASTER_OUT_R],
buffers.audio[Buffers::MASTER_OUT_R],
//buffers.audio[Buffers::MASTER_OUT_L],
//buffers.audio[Buffers::REVERB], // uncomment to listen to reverb send only
sizeof(float)*nframes);

View file

@ -2,14 +2,6 @@
#ifndef LUPPP_JACK_H
#define LUPPP_JACK_H
/*
jack.hxx
This code contains the JACK client.
It allows reading / writing of audio / midi.
*/
// Library
#include <vector>
#include <cstring>
@ -29,9 +21,12 @@
#include "dsp/dsp_reverb.hxx"
#include "dsp/dsp_dbmeter.hxx"
using namespace std;
/** Jack
This code contains the JACK client.
It allows reading / writing of audio / midi.
**/
class Jack
{
public:

View file

@ -201,8 +201,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_OUT_R];
// process each clip individually: this allows for playback of one clip,
// while another clip records.

View file

@ -142,7 +142,7 @@ class LooperClip
float getProgress()
{
if ( _buffer )
if ( _buffer && _playing )
{
return float(_playhead) / _buffer->getData().size();
}