⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polezero.cpp

📁 Mobile STK for Symbian OS V0.1
💻 CPP
字号:
/***************************************************//*! \class PoleZero    \brief STK one-pole, one-zero filter class.    This protected Filter subclass implements    a one-pole, one-zero digital filter.  A    method is provided for creating an allpass    filter with a given coefficient.  Another    method is provided to create a DC blocking filter.    by Perry R. Cook and Gary P. Scavone, 1995 - 2005.*//***************************************************/#include "PoleZero.h"PoleZero :: PoleZero() : Filter(){  // Default setting for pass-through.#if !defined(SYMBIAN)  std::vector<StkFloat> b(2, 0.0);  std::vector<StkFloat> a(2, 0.0);#else  FloatVector b(2, 0.0);  FloatVector a(2, 0.0);/*  StkFloat *b= new (ELeave) TReal[2];  b[1] = 0.0;  StkFloat *a= new (ELeave) TReal[2];  a[1] = 0.0;*/#endif  b[0] = 1.0;  a[0] = 1.0;  Filter::setCoefficients( b, a );}PoleZero :: ~PoleZero(){}void PoleZero :: clear(void){  Filter::clear();}void PoleZero :: setB0(StkFloat b0){  b_[0] = b0;}void PoleZero :: setB1(StkFloat b1){  b_[1] = b1;}void PoleZero :: setA1(StkFloat a1){  a_[1] = a1;}void PoleZero :: setAllpass(StkFloat coefficient){  b_[0] = coefficient;  b_[1] = 1.0;  a_[0] = 1.0; // just in case  a_[1] = coefficient;}void PoleZero :: setBlockZero(StkFloat thePole){  b_[0] = 1.0;  b_[1] = -1.0;  a_[0] = 1.0; // just in case  a_[1] = -thePole;}void PoleZero :: setGain(StkFloat gain){  Filter::setGain(gain);}StkFloat PoleZero :: getGain(void) const{  return Filter::getGain();}StkFloat PoleZero :: lastOut(void) // SYMBIAN const removed: const{  return Filter::lastOut();}StkFloat PoleZero :: tick( StkFloat input ){  inputs_[0] = gain_ * input;  outputs_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] - a_[1] * outputs_[1];  inputs_[1] = inputs_[0];  outputs_[1] = outputs_[0];  return outputs_[0];}StkFrames& PoleZero :: tick( StkFrames& frames, unsigned int channel ){  return Filter::tick( frames, channel );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -