-Reworking signal handling using AudioProcessor class and reversed flow process() calling

This commit is contained in:
Harry van Haaren 2013-07-27 22:36:58 +01:00
parent 112d850848
commit f34e43b18a
3 changed files with 73 additions and 1 deletions

31
src/audioprocessor.hxx Normal file
View file

@ -0,0 +1,31 @@
#ifndef LUPPP_AUDIO_PROCESSOR_H
#define LUPPP_AUDIO_PROCESSOR_H
class AudioProcessor
{
public:
AudioProcessor(){}
/// copies the track output to master buffer, sidechain & post-side buffer
virtual void process(int nframes, Buffers* buffers)
{
}
virtual ~AudioProcessor(){};
private:
int track;
float _toMaster;
float _toReverb;
float _toSidechain;
float _toPostSidechain;
};
#endif // LUPPP_AUDIO_PROCESSOR_H

View file

@ -6,6 +6,7 @@
#include <iostream>
#include "buffers.hxx"
#include "audioprocessor.hxx"
#include "observer/observer.hxx"
#define SAMPLE_SIZE 44100*60
@ -14,7 +15,7 @@ class AudioBuffer;
using namespace std;
class Looper : public Observer // for notifications
class Looper : public AudioProcessor, public Observer // for notifications
{
public:
enum State {

40
src/trackoutput.hxx Normal file
View file

@ -0,0 +1,40 @@
#ifndef LUPPP_TRACK_OUTPUT_H
#define LUPPP_TRACK_OUTPUT_H
class TrackOutput
{
public:
TrackOutput(int t, AudioProcessor* ap) :
track(t),
previousInChain(ap),
{
}
/// copies the track output to master buffer, sidechain & post-side buffer
void process(int nframes, Buffers* buffers)
{
ap->process( nframes, buffers );
for(int i = 0; i < nframes; i++)
{
// copy data here
}
}
private:
int track;
float _toMaster;
float _toReverb;
float _toSidechain;
float _toPostSidechain;
/// Pointer to "previous" processor: the graph is backwards
AudioProcessor* previousInChain;
};
#endif // LUPPP_TRACK_OUTPUT_H