mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Metering takes place in TrackOutput
This commit is contained in:
parent
4591cdfb18
commit
14bbc49e49
3 changed files with 46 additions and 39 deletions
29
src/jack.cxx
29
src/jack.cxx
|
@ -19,10 +19,6 @@ Jack::Jack()
|
|||
buffers.nframes = jack_get_buffer_size( client );
|
||||
buffers.samplerate = jack_get_sample_rate( client );
|
||||
|
||||
// UI update
|
||||
uiUpdateConstant = buffers.samplerate / 30;
|
||||
uiUpdateCounter = buffers.samplerate / 30;
|
||||
|
||||
|
||||
masterOutput = jack_port_register( client,
|
||||
"master_out",
|
||||
|
@ -66,8 +62,6 @@ Jack::Jack()
|
|||
for( int i = 0; i < NTRACKS; i++)
|
||||
{
|
||||
trackOutputs.push_back( new TrackOutput(i, loopers.at(i) ) );
|
||||
|
||||
dbMeters.push_back( DBMeter( buffers.samplerate ) );
|
||||
}
|
||||
|
||||
timeManager.registerObserver( &metronome );
|
||||
|
@ -145,22 +139,6 @@ int Jack::process (jack_nframes_t nframes)
|
|||
trackOutputs.at(i)->process( nframes, &buffers );
|
||||
|
||||
|
||||
// get DB readings, and send to UI
|
||||
for(int n = 0; n < NTRACKS; n++)
|
||||
{
|
||||
// needs to be setup to handle stereo instead of mono
|
||||
float* buf = buffers.audio[Buffers::TRACK_0 + n];
|
||||
dbMeters.at(n).process( nframes, buf, buf );
|
||||
|
||||
if (uiUpdateCounter > uiUpdateConstant )
|
||||
{
|
||||
EventTrackSignalLevel e( n, dbMeters.at(n).getLeftDB(), dbMeters.at(n).getRightDB() );
|
||||
//EventTrackSignalLevel e( n, n / 8.f, n / 8.f );
|
||||
writeToGuiRingbuffer( &e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// mixdown tracks into master output buffer
|
||||
float* output = buffers.audio[Buffers::MASTER_OUTPUT];
|
||||
|
||||
|
@ -177,13 +155,6 @@ int Jack::process (jack_nframes_t nframes)
|
|||
|
||||
metronome.process( nframes, &buffers );
|
||||
|
||||
if (uiUpdateCounter > uiUpdateConstant )
|
||||
{
|
||||
uiUpdateCounter = 0;
|
||||
}
|
||||
|
||||
uiUpdateCounter += nframes;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "metronome.hxx"
|
||||
#include "timemanager.hxx"
|
||||
|
||||
#include "dsp/dsp_dbmeter.hxx"
|
||||
|
||||
#include "controllerupdater.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
@ -69,13 +67,6 @@ class Jack
|
|||
|
||||
vector<TrackOutput*> trackOutputs;
|
||||
|
||||
vector<DBMeter> dbMeters;
|
||||
|
||||
// UI update variables
|
||||
long uiUpdateCounter;
|
||||
long uiUpdateConstant;
|
||||
|
||||
|
||||
int nframes;
|
||||
int samplerate;
|
||||
|
||||
|
|
|
@ -4,13 +4,41 @@
|
|||
|
||||
#include "audioprocessor.hxx"
|
||||
|
||||
#include "eventhandler.hxx"
|
||||
#include "dsp/dsp_dbmeter.hxx"
|
||||
|
||||
class TrackOutput : public AudioProcessor
|
||||
{
|
||||
public:
|
||||
TrackOutput(int t, AudioProcessor* ap) :
|
||||
track(t),
|
||||
previousInChain(ap)
|
||||
previousInChain(ap),
|
||||
dbMeter(44100)
|
||||
{
|
||||
// UI update
|
||||
uiUpdateConstant = 44100 / 20;
|
||||
uiUpdateCounter = 44100 / 30;
|
||||
}
|
||||
|
||||
/// set main mix, 0-1
|
||||
void setMaster(float value)
|
||||
{
|
||||
|
||||
}
|
||||
/// set sidechain mix, 0-1
|
||||
void setSidechain(float value)
|
||||
{
|
||||
|
||||
}
|
||||
/// set post sidechain mix, 0-1
|
||||
void setPostSidechain(float value)
|
||||
{
|
||||
|
||||
}
|
||||
/// set reverb mix, 0-1
|
||||
void setReverb(float value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// copies the track output to master buffer, sidechain & post-side buffer
|
||||
|
@ -21,9 +49,21 @@ class TrackOutput : public AudioProcessor
|
|||
previousInChain->process( nframes, buffers );
|
||||
}
|
||||
|
||||
float* buf = buffers->audio[Buffers::TRACK_0 + track];
|
||||
dbMeter.process( nframes, buf, buf );
|
||||
|
||||
if (uiUpdateCounter > uiUpdateConstant )
|
||||
{
|
||||
EventTrackSignalLevel e( track, dbMeter.getLeftDB(), dbMeter.getRightDB() );
|
||||
writeToGuiRingbuffer( &e );
|
||||
uiUpdateCounter = 0;
|
||||
}
|
||||
uiUpdateCounter += nframes;
|
||||
|
||||
for(int i = 0; i < nframes; i++)
|
||||
{
|
||||
// copy data here
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +78,11 @@ class TrackOutput : public AudioProcessor
|
|||
|
||||
/// Pointer to "previous" processor: the graph is backwards
|
||||
AudioProcessor* previousInChain;
|
||||
|
||||
// Metering variables
|
||||
long uiUpdateCounter;
|
||||
long uiUpdateConstant;
|
||||
DBMeter dbMeter;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue