protux-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Protux-devel] Static filter architeture


From: Luciano Domenico Giordana
Subject: [Protux-devel] Static filter architeture
Date: Tue, 11 Jan 2005 14:36:17 -0200

Hi Eduardo,

By now,  the current architeture for creating a filter in protux is by
subclassing AudioFilter class.
take a look :

class AudioFilter
        {
        public :

                static const int MIN_SAMPLE = -32768;
                static const int MAX_SAMPLE = 32767;


                AudioFilter(int pSampleRate, int pChannels);
                virtual ~AudioFilter();

                void set_preview_quality(float value);
                void set_wet_out(float value);
                void set_dry_out(float value);
                void set_pre_gain(float value);
                void set_pos_gain(float value);

                float get_preview_quality();
                float get_wet_out();
                float get_dry_out();
                float get_pre_gain();
                float get_pos_gain();

                virtual int load_data( char* pAudioFragment, int
pFragmentSize );
                virtual int prepare();
                virtual int process();

                bool isBypassed;

                int cleanup();
        protected :

                float previewQuality;
                float wetOut;
                float dryOut;
                float preGain;
                float posGain;


                void init_tail(int secs);
                void push_tail(int size);
                char* tailBuffer;
                int tailSize;

                char* fragment;
                int fragmentSize;

                int sampleRate;
                int channels;
        };





#endif
.
.



Create a filter is matter of subclassing AudioFilter and implement
load_data, prepare and process. load_data , you just feed your data
structure with the passed samples chunk.
Prepare is used to some kind of common pre-calculation (not the
calculation for each sample, but the main calculation, for example, an
fft size or a hi-pass filter factor array, dont know...
process is the core of the filter. it applyes the filter into your data.

There is set of filter that I call "Tail filters' . Those are the
filter that somehow its results are dragged to the future. An echo
filter for example, will create data AFTER the given samples  . This
"future"-residual  data is stored in a special structure called
tailBuffer.

A tail filter , when "processing" (executing method "process") must
consider the last tail-data from last process. This way, the effect is
cumulative,..

also, when user stop playing back, protux will automatically "cleanup"
for every filter in every filterchain. in a tail filter, the tail must
be cleaned. so next time the playback begins,
you wont hear echos from the past.... hehehe

Why I am telling you about tail filters? Reverb will follow this pattern :-)

Hope that this gives you a initial glimpse of how to implement a
filter in protux.. You will probably spend more time on studying how
modern reverb algorithms works (phisical simultaion instead of  effect
simulation) than coding , even because the code might be small (and
complex).

also, I will provide you (next email) some pratical aspects of reverb
you might already know (just in case....

regards

L

(still working with remon in MHE....)



look 
-- 
Luciano Domenico Giordana
Software Engineer - Goodyear do Brasil - http://www.goodyear.com.br
Project Protux : http://www.nongnu.org/protux




reply via email to

[Prev in Thread] Current Thread [Next in Thread]