Nsound::FilterDC Class Reference

#include <Nsound/FilterDC.h>

List of all members.

Public Member Functions

 FilterDC (const float64 &feedback_gain)
AudioStream filter (const AudioStream &x)
Buffer filter (const Buffer &x)
float64 filter (const float64 &x)

Protected Attributes

float64 feedback_gain_
float64 last_input_
float64 last_output_

Detailed Description

Definition at line 45 of file FilterDC.h.


Constructor & Destructor Documentation

FilterDC::FilterDC ( const float64 feedback_gain  ) 

Definition at line 37 of file FilterDC.cc.

00039     :
00040     feedback_gain_(feedback_gain),
00041     last_input_(0.0),
00042     last_output_(0.0)
00043 {
}


Member Function Documentation

AudioStream FilterDC::filter ( const AudioStream x  ) 

Definition at line 48 of file FilterDC.cc.

References Nsound::AudioStream::getNChannels(), and Nsound::AudioStream::getSampleRate().

Referenced by filter(), and Nsound::Pluck::generate().

00049 {
00050     uint32 n_channels = x.getNChannels();
00051 
00052     AudioStream y(x.getSampleRate(), n_channels);
00053 
00054     for(uint32 channel = 0; channel < n_channels; ++channel)
00055     {
00056         y[channel] = filter(x[channel]);
00057     }
00058 
00059     return y;
00060 }

Buffer FilterDC::filter ( const Buffer x  ) 

Definition at line 66 of file FilterDC.cc.

References filter(), and Nsound::Buffer::getLength().

00067 {
00068     uint32 n_samples = x.getLength();
00069 
00070     Buffer y;
00071 
00072     for(uint32 n = 0; n < n_samples; ++n)
00073     {
00074         y << filter(x[n]);
00075     }
00076 
00077     return y;
00078 }

float64 FilterDC::filter ( const float64 x  ) 

Definition at line 83 of file FilterDC.cc.

References feedback_gain_, last_input_, and last_output_.

00084 {
00085     float64 out = x - last_input_ + feedback_gain_ * last_output_;
00086 
00087     last_input_ = x;
00088     last_output_ = out;
00089 
00090     return out;
00091 }


Member Data Documentation

Definition at line 67 of file FilterDC.h.

Referenced by filter().

Definition at line 68 of file FilterDC.h.

Referenced by filter().

Definition at line 69 of file FilterDC.h.

Referenced by filter().


The documentation for this class was generated from the following files:
Generated on Sun Apr 15 20:10:50 2012 for nsound by  doxygen 1.6.3