• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setCoefficients函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setCoefficients函数的典型用法代码示例。如果您正苦于以下问题:C++ setCoefficients函数的具体用法?C++ setCoefficients怎么用?C++ setCoefficients使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setCoefficients函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tan

void IIRFilter::makeHighPass (const double sampleRate,
                              const double frequency) noexcept
{
    const double n = tan (double_Pi * frequency / sampleRate);
    const double nSquared = n * n;
    const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared);

    setCoefficients (c1,
                     c1 * -2.0f,
                     c1,
                     1.0,
                     c1 * 2.0 * (nSquared - 1.0),
                     c1 * (1.0 - std::sqrt (2.0) * n + nSquared));
}
开发者ID:randi2kewl,项目名称:ShoutOut,代码行数:14,代码来源:juce_IIRFilter.cpp


示例2: adjust_imag

void BiquadBase::setTwoPole (complex_t pole1, complex_t zero1,
                             complex_t pole2, complex_t zero2)
{
#if 0
  pole1 = adjust_imag (pole1);
  pole2 = adjust_imag (pole2);
  zero1 = adjust_imag (zero1);
  zero2 = adjust_imag (zero2);
#endif

  const double a0 = 1;
  double a1;
  double a2;

  if (pole1.imag() != 0)
  {
    assert (pole2 == std::conj (pole1));

    a1 = -2 * pole1.real();
    a2 = std::norm (pole1);
  }
  else
  {
    assert (pole2.imag() == 0);

    a1 = -(pole1.real() + pole2.real());
    a2 =   pole1.real() * pole2.real();
  }

  const double b0 = 1;
  double b1;
  double b2;

  if (zero1.imag() != 0)
  {
    assert (zero2 == std::conj (zero1));

    b1 = -2 * zero1.real();
    b2 = std::norm (zero1);
  }
  else
  {
    assert (zero2.imag() == 0);

    b1 = -(zero1.real() + zero2.real());
    b2 =   zero1.real() * zero2.real();
  }

  setCoefficients (a0, a1, a2, b0, b1, b2);
}
开发者ID:COx2,项目名称:DSPFilters,代码行数:50,代码来源:Biquad.cpp


示例3: pow

void Biquad4proc::setPeaking(double center_frequency, double sampling_frequency, double gainDb, double slope)
{
    double w0 = 2 * M_PI * center_frequency / sampling_frequency;
    double A = pow(10, gainDb/40);
    double alpha = sin(w0)/2 * sqrt( (A + 1/A)*(1/slope - 1) + 2 );

    double b0 =   1 + alpha*A;
    double b1 =  -2*cos(w0);
    double b2 =   1 - alpha*A;
    double a0 =   1 + alpha/A;
    double a1 =  -2*cos(w0);
    double a2 =   1 - alpha/A;

    setCoefficients(a0, a1, a2, b0, b1, b2);
}
开发者ID:james34602,项目名称:JamesDSPManager,代码行数:15,代码来源:Biquad4proc.cpp


示例4: setCoefficients

inline void OnePoleFilter::setPolePosition(float pos, bool normalize) {
	float b0, a1;
	a1 = -pos;
	b0 = 1.0f;
	/**Reasoning time:
	The maximum gain of the filter is at dc or nyquist, introducing either a term of -1 or a term of 1.
	The maximum gain of the filter occurs when the denominator is minimized. The denominator is minimized when a1 is negative. So:
	max = 1/(1-|a1|)
	We wish to normalize the filter with b0. This means we wish to set b0 = 1/max.
	By the rules of fractions:
	b0 = 1-|a1|.
	*/
	if(normalize) b0 = (float)(1.0-fabs(a1));
	setCoefficients(b0, a1);
}
开发者ID:camlorn,项目名称:libaudioverse,代码行数:15,代码来源:one_pole_filter.hpp


示例5: jassert

//==============================================================================
void IIRFilter::makeLowPass (const double sampleRate,
                             const double frequency) noexcept
{
    jassert (sampleRate > 0);

    const double n = 1.0 / tan (double_Pi * frequency / sampleRate);
    const double nSquared = n * n;
    const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared);

    setCoefficients (c1,
                     c1 * 2.0f,
                     c1,
                     1.0,
                     c1 * 2.0 * (1.0 - nSquared),
                     c1 * (1.0 - std::sqrt (2.0) * n + nSquared));
}
开发者ID:0x4d52,项目名称:ugen,代码行数:17,代码来源:juce_IIRFilter.cpp


示例6: cos

void AllPass::setup (double sampleRate,
                     double phaseFrequency,
                     double q)
{
  double w0 = 2 * doublePi * phaseFrequency / sampleRate;
  double cs = cos (w0);
  double sn = sin (w0);
  double AL = sn / ( 2 * q );
  double b0 =  1 - AL;
  double b1 = -2 * cs;
  double b2 =  1 + AL;
  double a0 =  1 + AL;
  double a1 = -2 * cs;
  double a2 =  1 - AL;
  setCoefficients (a0, a1, a2, b0, b1, b2);
}
开发者ID:AngryJoker,项目名称:CrossTalk,代码行数:16,代码来源:RBJ.cpp


示例7: cos

void BiquadFilter::makeHighPass (const double sampleRate,
                                 const double frequency,
                                 const double Q) noexcept
{
	const double oneOverCurrentSampleRate = 1.0 / sampleRate;
	float w0 = (float) (2.0f * float_Pi * frequency * oneOverCurrentSampleRate);
	float cos_w0 = cos (w0);
	float sin_w0 = sin (w0);
	float alpha = sin_w0 / (2.0f * (float) Q);
    
	setCoefficients ((1.0f + cos_w0) * 0.5f, 
                     -(1.0f + cos_w0), 
                     (1.0f + cos_w0) * 0.5f, 
                     (1.0f + alpha), 
                     -2.0f * cos_w0, 
                     (1.0f - alpha));	
}
开发者ID:JeromeGill,项目名称:genie,代码行数:17,代码来源:dRowAudio_BiquadFilter.cpp


示例8: pow

void HighShelf::setup (double sampleRate,
                       double cutoffFrequency,
                       double gainDb,
                       double shelfSlope)
{
  double A  = pow (10, gainDb/40);
  double w0 = 2 * doublePi * cutoffFrequency / sampleRate;
  double cs = cos (w0);
  double sn = sin (w0);
  double AL = sn / 2 * ::std::sqrt ((A + 1/A) * (1/shelfSlope - 1) + 2);
  double sq = 2 * sqrt(A) * AL;
  double b0 =    A*( (A+1) - (A-1)*cs + sq );
  double b1 = -2*A*( (A-1) - (A+1)*cs );
  double b2 =    A*( (A+1) - (A-1)*cs - sq );
  double a0 =        (A+1) + (A-1)*cs + sq;
  double a1 =    2*( (A-1) + (A+1)*cs );
  double a2 =        (A+1) + (A-1)*cs - sq;
  setCoefficients (a0, a1, a2, b0, b1, b2);
}
开发者ID:AngryJoker,项目名称:CrossTalk,代码行数:19,代码来源:RBJ.cpp


示例9: adjust_imag

void BiquadBase::setOnePole (complex_t pole, complex_t zero)
{
#if 0
  pole = adjust_imag (pole);
  zero = adjust_imag (zero);
#else
  assert (pole.imag() == 0); 
  assert (zero.imag() == 0);
#endif
  
  const double a0 = 1;
  const double a1 = -pole.real();
  const double a2 = 0;
  const double b0 = -zero.real();
  const double b1 = 1;
  const double b2 = 0;

  setCoefficients (a0, a1, a2, b0, b1, b2);
}
开发者ID:Andrew90,项目名称:def,代码行数:19,代码来源:Biquad.cpp


示例10: powf

void Biquad::setHighShelf(int32_t steps, float center_frequency, float sampling_frequency, float gainDb, float slope, float overallGainDb)
{
    float w0 = 2 * (float) M_PI * center_frequency / sampling_frequency;
    float A = powf(10, gainDb/40);
    float alpha = sinf(w0)/2 * sqrtf( (A + 1/A)*(1/slope - 1) + 2 );

    float b0 =    A*( (A+1) + (A-1)*cosf(w0) + 2*sqrtf(A)*alpha );
    float b1 = -2*A*( (A-1) + (A+1)*cosf(w0)                   );
    float b2 =    A*( (A+1) + (A-1)*cosf(w0) - 2*sqrtf(A)*alpha );
    float a0 =        (A+1) - (A-1)*cosf(w0) + 2*sqrtf(A)*alpha  ;
    float a1 =    2*( (A-1) - (A+1)*cosf(w0)                   );
    float a2 =        (A+1) - (A-1)*cosf(w0) - 2*sqrtf(A)*alpha  ;

    float overallGain = powf(10, overallGainDb / 20);
    b0 *= overallGain;
    b1 *= overallGain;
    b2 *= overallGain;

    setCoefficients(steps, a0, a1, a2, b0, b1, b2);
}
开发者ID:DongheonKim,项目名称:android_frameworks_base,代码行数:20,代码来源:Biquad.cpp


示例11: jlimit

void BiquadFilter::makeBandPass(const double sampleRate,
                                const double frequency,
                                const double Q) noexcept
{
	const double qFactor = jlimit (0.00001, 1000.0, Q);
	const double oneOverCurrentSampleRate = 1.0 / sampleRate;
	
	float w0 = (float) (2.0f * float_Pi * frequency * oneOverCurrentSampleRate);
	float cos_w0 = cos (w0);
	float sin_w0 = sin (w0);
	float alpha = sin_w0 / (2.0f * (float) qFactor);
    //	float alpha = sin_w0 * sinh( (log(2.0)/2.0) * bandwidth * w0/sin_w0 );
	
	setCoefficients (alpha, 
					 0.0f, 
					 -alpha, 
                     1.0f + alpha, 
                     -2.0f * cos_w0, 
                     1.0f - alpha);
}
开发者ID:JeromeGill,项目名称:genie,代码行数:20,代码来源:dRowAudio_BiquadFilter.cpp


示例12: pow

void Biquad::setHighShelf(int32_t steps, double center_frequency, double sampling_frequency, double gainDb, double slope, double overallGainDb)
{
    double w0 = 2 * M_PI * center_frequency / sampling_frequency;
    double A = pow(10, gainDb/40);
    double alpha = sin(w0)/2 * sqrt( (A + 1/A)*(1/slope - 1) + 2 );

    double b0 =    A*( (A+1) + (A-1)*cos(w0) + 2*sqrt(A)*alpha );
    double b1 = -2*A*( (A-1) + (A+1)*cos(w0)                   );
    double b2 =    A*( (A+1) + (A-1)*cos(w0) - 2*sqrt(A)*alpha );
    double a0 =        (A+1) - (A-1)*cos(w0) + 2*sqrt(A)*alpha  ;
    double a1 =    2*( (A-1) - (A+1)*cos(w0)                   );
    double a2 =        (A+1) - (A-1)*cos(w0) - 2*sqrt(A)*alpha  ;

    double overallGain = pow(10, overallGainDb / 20);
    b0 *= overallGain;
    b1 *= overallGain;
    b2 *= overallGain;

    setCoefficients(steps, a0, a1, a2, b0, b1, b2);
}
开发者ID:pavik62,项目名称:JamesDSPManager,代码行数:20,代码来源:Biquad.cpp


示例13: startIt

    void ParametersInterpreter<NMSmodelT>::setSubjectParameters(const std::vector<double>& x) {


        unsigned count = 0;
        for (typename ParametersMap::const_iterator it(parameters_.begin()); it != parameters_.end(); ++it) {

            unsigned noCoefficients = it->second.size;
            std::vector<double>::const_iterator startIt(x.begin() + count);
            std::vector<double>::const_iterator endIt(x.begin() + count + noCoefficients);
            std::vector<double> groupedCoefficients(startIt, endIt);
            std::vector<double> coefficients;

            getCoefficients(it->first, coefficients);
            distributeValues(it->second.muscleGroups, coefficients, groupedCoefficients);
            setCoefficients(it->first, coefficients);

            count += noCoefficients;

        }

    }
开发者ID:CEINMS,项目名称:CEINMS,代码行数:21,代码来源:ParametersInterpreter.cpp


示例14: setCoefficients

void BiquadBase::setIdentity ()
{
  setCoefficients (1, 0, 0, 1, 0, 0);
}
开发者ID:Andrew90,项目名称:def,代码行数:4,代码来源:Biquad.cpp


示例15: setCoefficients

void BiquadBase::applyScale (double scale)
{
    setCoefficients(m_a0, m_a1, m_a2, m_b0 * scale, m_b1 * scale, m_b2 * scale);
}
开发者ID:antarespilot,项目名称:DSPFilters,代码行数:4,代码来源:Biquad.cpp


示例16: xMin_

HarmonicFunction::HarmonicFunction( const RVector & coeff, double xmin, double xmax )
: xMin_( xmin ), xMax_( xmax ){
    setCoefficients( coeff );
}
开发者ID:KristoferHellman,项目名称:gimli,代码行数:4,代码来源:curvefitting.cpp


示例17: setCoefficients

 void Linear::set(const std::vector<scalar>& coeffs, const Engine* engine) {
     setCoefficients(coeffs);
     setEngine(engine);
 }
开发者ID:COJIDAT,项目名称:vcmi-ios,代码行数:4,代码来源:Linear.cpp


示例18: sin

void ProcessorBiquad::setHighpass(float Q, float frequency) {
    float angularFreq = M_2PI * (frequency / LANTERN_AUDIO_SAMPLE_RATE);
    float alpha = sin(angularFreq) / (2.0f * Q);
    float incCos = 1.0f + cos(angularFreq);
    setCoefficients(1.0f + alpha, -2.0f * cos(angularFreq), 1.0f - alpha, incCos * 0.5f, -incCos, incCos * 0.5f);
}
开发者ID:terribleben,项目名称:lantern-engine,代码行数:6,代码来源:ProcessorBiquad.cpp


示例19: setCoefficients

void Polynomial::deleteData()
{
   setCoefficients(nullptr, 0);
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:4,代码来源:Functions.cpp


示例20: setCoefficients

void Biquad4proc::setSOS(double a0, double a1, double a2, double b0, double b1, double b2)
{
	setCoefficients(a0, a1, a2, b0, b1, b2);
}
开发者ID:james34602,项目名称:JamesDSPManager,代码行数:4,代码来源:Biquad4proc.cpp



注:本文中的setCoefficients函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setColor函数代码示例发布时间:2022-05-30
下一篇:
C++ setCodeInvalidated函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap