Nsound  0.9.4
Public Member Functions | Protected Attributes | List of all members
Nsound::FilterDC Class Reference

#include <Nsound/FilterDC.h>

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.

38  :
39  feedback_gain_(feedback_gain),
40  last_input_(0.0),
41  last_output_(0.0)
42 {
43 }
float64 feedback_gain_
Definition: FilterDC.h:67
float64 last_input_
Definition: FilterDC.h:68
float64 last_output_
Definition: FilterDC.h:69

Member Function Documentation

AudioStream FilterDC::filter ( const AudioStream x)

Definition at line 47 of file FilterDC.cc.

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

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

48 {
49  uint32 n_channels = x.getNChannels();
50 
51  AudioStream y(x.getSampleRate(), n_channels);
52 
53  for(uint32 channel = 0; channel < n_channels; ++channel)
54  {
55  y[channel] = filter(x[channel]);
56  }
57 
58  return y;
59 }
unsigned int uint32
Definition: Nsound.h:153
float64 getSampleRate() const
Returns the sample rate of the stream.
Definition: AudioStream.h:217
uint32 getNChannels(void) const
Returns the number of audio channels in the stream.
Definition: AudioStream.h:212
AudioStream filter(const AudioStream &x)
Definition: FilterDC.cc:47
Buffer FilterDC::filter ( const Buffer x)

Definition at line 64 of file FilterDC.cc.

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

65 {
66  uint32 n_samples = x.getLength();
67 
68  Buffer y;
69 
70  for(uint32 n = 0; n < n_samples; ++n)
71  {
72  y << filter(x[n]);
73  }
74 
75  return y;
76 }
unsigned int uint32
Definition: Nsound.h:153
uint32 getLength() const
Returns the number of samples in the Buffer.
Definition: Buffer.h:587
A Buffer for storing audio samples.
Definition: Buffer.h:60
AudioStream filter(const AudioStream &x)
Definition: FilterDC.cc:47
float64 FilterDC::filter ( const float64 x)

Definition at line 80 of file FilterDC.cc.

References feedback_gain_, last_input_, and last_output_.

81 {
83 
84  last_input_ = x;
85  last_output_ = out;
86 
87  return out;
88 }
float64 feedback_gain_
Definition: FilterDC.h:67
double float64
Definition: Nsound.h:146
float64 last_input_
Definition: FilterDC.h:68
float64 last_output_
Definition: FilterDC.h:69

Member Data Documentation

float64 Nsound::FilterDC::feedback_gain_
protected

Definition at line 67 of file FilterDC.h.

Referenced by filter().

float64 Nsound::FilterDC::last_input_
protected

Definition at line 68 of file FilterDC.h.

Referenced by filter().

float64 Nsound::FilterDC::last_output_
protected

Definition at line 69 of file FilterDC.h.

Referenced by filter().


The documentation for this class was generated from the following files: