 
    
   
Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial
   26   Filter( 
void ) { gain_ = 1.0; channelsIn_ = 1; lastFrame_.
resize( 1, 1, 0.0 ); };
 
   29   unsigned int channelsIn( 
void )
 const { 
return channelsIn_; };
 
   35   virtual void clear( 
void );
 
   42   void setGain( StkFloat gain ) { gain_ = gain; };
 
   45   StkFloat 
getGain( 
void )
 const { 
return gain_; };
 
   72   unsigned int channelsIn_;
 
   75   std::vector<StkFloat> b_;
 
   76   std::vector<StkFloat> a_;
 
   85   for ( i=0; i<inputs_.
size(); i++ )
 
   87   for ( i=0; i<outputs_.
size(); i++ )
 
   89   for ( i=0; i<lastFrame_.
size(); i++ )
 
   96     oStream_ << 
"Filter::phaseDelay: argument (" << frequency << 
") is out of range!";
 
  101   StkFloat real = 0.0, imag = 0.0;
 
  102   for ( 
unsigned int i=0; i<b_.size(); i++ ) {
 
  103     real += b_[i] * std::cos( i * omegaT );
 
  104     imag -= b_[i] * std::sin( i * omegaT );
 
  109   StkFloat phase = atan2( imag, real );
 
  111   real = 0.0, imag = 0.0;
 
  112   for ( 
unsigned int i=0; i<a_.size(); i++ ) {
 
  113     real += a_[i] * std::cos( i * omegaT );
 
  114     imag -= a_[i] * std::sin( i * omegaT );
 
  117   phase -= std::atan2( imag, real );
 
  118   phase = std::fmod( -phase, 2 * PI );
 
  119   return phase / omegaT;
 
  
unsigned int channelsIn(void) const
Return the number of input channels for the class.
Definition: Filter.h:29
StkFloat phaseDelay(StkFloat frequency)
Return the filter phase delay at the specified frequency.
Definition: Filter.h:93
size_t size() const
Returns the total number of audio samples represented by the object.
Definition: Stk.h:362
static StkFloat sampleRate(void)
Static method that returns the current STK sample rate.
Definition: Stk.h:145
const StkFrames & lastFrame(void) const
Return an StkFrames reference to the last output sample frame.
Definition: Filter.h:56
void resize(size_t nFrames, unsigned int nChannels=1)
Resize self to represent the specified number of channels and frames.
Filter(void)
Class constructor.
Definition: Filter.h:26
An STK class to handle vectorized audio data.
Definition: Stk.h:276
StkFloat getGain(void) const
Return the current filter gain.
Definition: Filter.h:45
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:404
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
unsigned int channelsOut(void) const
Return the number of output channels for the class.
Definition: Filter.h:32
virtual StkFrames & tick(StkFrames &frames, unsigned int channel=0)=0
Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs...
virtual void clear(void)
Clears all internal states of the filter.
Definition: Filter.h:82
The STK namespace.
Definition: ADSR.h:6
void setGain(StkFloat gain)
Set the filter gain.
Definition: Filter.h:42
STK abstract filter class.
Definition: Filter.h:23
STK base class.
Definition: Stk.h:133