当前位置: 首页>>代码示例>>C++>>正文


C++ TrapDouble函数代码示例

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


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

示例1: GetAmpSlider

void AmplifyDialog::OnAmpSlider(wxCommandEvent & event)
{
   if (mLoopDetect)
      return;

   mLoopDetect = true;

   wxString str;
   double dB = GetAmpSlider()->GetValue() / 10.0;
   ratio = pow(10.0,TrapDouble(dB, AMP_MIN, AMP_MAX)/20.0);
   
   double dB2 = (GetAmpSlider()->GetValue()-1) / 10.0;
   double ratio2 = pow(10.0,TrapDouble(dB2, AMP_MIN, AMP_MAX)/20.0);

   if (!GetClipCheckBox()->GetValue() &&
       ratio * peak > 1.0 &&
       ratio2 * peak < 1.0)
      ratio = 1.0 / peak;
   
   str.Printf(wxT("%.1f"), 20*log10(ratio));
   GetAmpText()->SetValue(str);
   str.Printf(wxT("%.1f"), 20*log10(ratio*peak));
   GetPeakText()->SetValue(str);

   mLoopDetect = false;

   CheckClip();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:28,代码来源:Amplify.cpp

示例2: GetAmpText

bool ToneGenDialog::TransferDataFromWindow()
{
   wxTextCtrl *t;

   t = GetAmpText();
   if (t) {
      double d;
      t->GetValue().ToDouble(&d);
      amplitude = TrapDouble(d, AMP_MIN, AMP_MAX);
   }

   t = GetFreqText();
   if (t) {
      double d;
      t->GetValue().ToDouble(&d);
      frequency = TrapDouble(d, FREQ_MIN, FREQ_MAX);
   }

   wxChoice *c = GetWaveformChoice();
   if (c)
      waveform = TrapLong(c->GetSelection(), WAVEFORM_MIN, WAVEFORM_MAX);

   wxCheckBox *cb = GetMixChoice();
   if (cb)
      mix = cb->GetValue();

   return TRUE;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:28,代码来源:ToneGen.cpp

示例3: S

bool ToneGenDialog::TransferDataFromWindow()
{
   ShuttleGui S( this, eIsGettingFromDialog );
   PopulateOrExchange( S );
   amplitude[0] = TrapDouble(amplitude[0], AMP_MIN, AMP_MAX);
   frequency[0] = TrapDouble(frequency[0], FREQ_MIN, FREQ_MAX);
   amplitude[1] = TrapDouble(amplitude[1], AMP_MIN, AMP_MAX);
   frequency[1] = TrapDouble(frequency[1], FREQ_MIN, FREQ_MAX);
   return true;
}
开发者ID:andreipaga,项目名称:audacity,代码行数:10,代码来源:ToneGen.cpp

示例4: TrapDouble

bool ToneGenDialog::TransferDataFromWindow()
{
   EffectDialog::TransferDataFromWindow();

   amplitude[0] = TrapDouble(amplitude[0], AMP_MIN, AMP_MAX);
   frequency[0] = TrapDouble(frequency[0], FREQ_MIN, (float)(GetActiveProject()->GetRate())/2.);
   amplitude[1] = TrapDouble(amplitude[1], AMP_MIN, AMP_MAX);
   frequency[1] = TrapDouble(frequency[1], FREQ_MIN, (float)(GetActiveProject()->GetRate())/2.);

   // Must handle this ourselves since ShuttleGui doesn't know about it
   mDuration = mToneDurationT->GetTimeValue();

   return true;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:14,代码来源:ToneGen.cpp

示例5: TrapDouble

bool AmplifyDialog::TransferDataToWindow()
{
   wxSlider *slider;

   // limit range of gain
   double dB = TrapDouble(200*log10(ratio), AMP_MIN, AMP_MAX)/10.0;
   ratio = pow(10.0, dB/20.0);

   slider = GetAmpSlider();
   if (slider)
      slider->SetValue((int)(200*log10(ratio)+0.5));

   mLoopDetect = true;

   wxTextCtrl *text = GetAmpText();
   if (text) {
      wxString str;
      str.Printf(wxT("%.1f"), 20*log10(ratio));
      text->SetValue(str);
   }

   text = GetPeakText();
   if (text) {
      wxString str;
      str.Printf(wxT("%.1f"), 20*log10(ratio*peak));
      text->SetValue(str);
   }

   mLoopDetect = false;

   return TRUE;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:32,代码来源:Amplify.cpp

示例6: GetAmpText

void AmplifyDialog::OnAmpText(wxCommandEvent & event)
{
   if (mLoopDetect)
      return;

   wxTextCtrl *c = GetAmpText();
   if (c) {
      double r;

      mLoopDetect = true;

      wxString val = c->GetValue();
      val.ToDouble(&r);
      ratio = pow(10.0,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0);

      wxSlider *slider = GetAmpSlider();
      if (slider)
         slider->SetValue((int)(200*log10(ratio)+0.5));

      wxString str;
      if( ratio*peak > 0.0 )
         str.Printf(wxT("%.1f"), 20*log10(ratio*peak));
      else
         str = _("-Infinity");   // the case when the waveform is all zero
      GetPeakText()->SetValue(str);

      mLoopDetect = false;
   }
   
   CheckClip();
}
开发者ID:andreipaga,项目名称:audacity,代码行数:31,代码来源:Amplify.cpp

示例7: ReadAndVerifyEnum

bool EffectToneGen::SetAutomationParameters(EffectAutomationParameters & parms)
{
   ReadAndVerifyEnum(Waveform, mWaveforms);
   ReadAndVerifyEnum(Interp, mInterpolations);
   if (mChirp)
   {
      ReadAndVerifyDouble(StartFreq);
      ReadAndVerifyDouble(EndFreq);
      ReadAndVerifyDouble(StartAmp);
      ReadAndVerifyDouble(EndAmp);
      mFrequency[0] = StartFreq;
      mFrequency[1] = EndFreq;
      mAmplitude[0] = StartAmp;
      mAmplitude[1] = EndAmp;
   }
   else
   {
      ReadAndVerifyDouble(Frequency);
      ReadAndVerifyDouble(Amplitude);
      mFrequency[0] = Frequency;
      mFrequency[1] = Frequency;
      mAmplitude[0] = Amplitude;
      mAmplitude[1] = Amplitude;
   }

   mWaveform = Waveform;
   mInterpolation = Interp;

   double freqMax = (GetActiveProject() ? GetActiveProject()->GetRate() : 44100.0) / 2.0;
   mFrequency[1] = TrapDouble(mFrequency[1], MIN_EndFreq, freqMax);

   return true;
}
开发者ID:MartynShaw,项目名称:audacity,代码行数:33,代码来源:ToneGen+-+Copy.cpp

示例8: GetPeakText

void AmplifyDialog::OnPeakText(wxCommandEvent & event)
{
   if (mLoopDetect)
      return;

   wxTextCtrl *c = GetPeakText();
   if (c) {
      double r;

      mLoopDetect = true;

      wxString val = c->GetValue();
      val.ToDouble(&r);

      ratio = pow(10.0, r/20.0) / peak;
      
      double dB = TrapDouble(200*log10(ratio), AMP_MIN, AMP_MAX)/10.0;
      ratio = pow(10.0, dB/20.0);

      wxSlider *slider = GetAmpSlider();
      if (slider)
         slider->SetValue((int)(10*dB+0.5));
      
      wxString str;
      str.Printf(wxT("%.1f"), dB);
      GetAmpText()->SetValue(str);
      
      mLoopDetect = false;
   }
   
   CheckClip();
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:32,代码来源:Amplify.cpp

示例9: GetAmpText

void AmplifyDialog::OnAmpText(wxCommandEvent & event)
{
   if (mLoopDetect)
      return;

   wxTextCtrl *c = GetAmpText();
   if (c) {
      double r;

      mLoopDetect = true;

      wxString val = c->GetValue();
      val.ToDouble(&r);
      ratio = pow(10,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0);

      wxSlider *slider = GetAmpSlider();
      if (slider)
         slider->SetValue((int)(200*log10(ratio)+0.5));

      wxString str;
      str.Printf("%.1f", 20*log10(ratio*peak));
      GetPeakText()->SetValue(str);

      mLoopDetect = false;
   }
   
   CheckClip();
}
开发者ID:andreipaga,项目名称:audacity,代码行数:28,代码来源:Amplify.cpp

示例10: WXUNUSED

void BassTrebleDialog::OnLevelText(wxCommandEvent & WXUNUSED(event))
{
   double val;
   mLevelT->GetValue().ToDouble(&val);
   int newval = floor(val / 0.1 + 0.5);
   mLevelS->SetValue(TrapDouble(newval, LEVEL_MIN, LEVEL_MAX));
   UpdateUI();
}
开发者ID:jeevithag,项目名称:audacity,代码行数:8,代码来源:BassTreble.cpp

示例11: S

bool NoiseDialog::TransferDataFromWindow()
{
   ShuttleGui S( this, eIsGettingFromDialog );
   PopulateOrExchange( S );

   nAmplitude = TrapDouble(nAmplitude, AMP_MIN, AMP_MAX);
   return true;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:8,代码来源:Noise.cpp

示例12: TrapDouble

bool DtmfDialog::TransferDataFromWindow()
{
   EffectDialog::TransferDataFromWindow();
   dAmplitude = TrapDouble(dAmplitude, AMP_MIN, AMP_MAX);
   // recalculate to make sure all values are up-to-date. This is especially
   // important if the user did not change any values in the dialog
   Recalculate();

   return true;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:10,代码来源:DtmfGen.cpp

示例13: TrapDouble

bool NoiseDialog::TransferDataFromWindow()
{
   EffectDialog::TransferDataFromWindow();

   nAmplitude = TrapDouble(nAmplitude, AMP_MIN, AMP_MAX);

   // Must handle this ourselves since ShuttleGui doesn't know about it
   nDuration = mNoiseDurationT->GetTimeValue();

   return true;
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:11,代码来源:Noise.cpp

示例14: pow

bool AmplifyDialog::TransferDataFromWindow()
{
   wxString val = mAmpT->GetValue();
   double r;

   val.ToDouble(&r);
   ratio = pow(10.0,TrapDouble(r*10, AMP_MIN, AMP_MAX)/200.0);

   noclip = !mClip->GetValue();

   return true;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:12,代码来源:Amplify.cpp

示例15: DB_TO_LINEAR

void EffectAmplify::OnAmpSlider(wxCommandEvent & evt)
{
   double dB = evt.GetInt() / SCL_Amp;
   mRatio = DB_TO_LINEAR(TrapDouble(dB, MIN_Amp, MAX_Amp));

   double dB2 = (evt.GetInt() - 1) / SCL_Amp;
   double ratio2 = DB_TO_LINEAR(TrapDouble(dB2, MIN_Amp, MAX_Amp));

   if (!mClip->GetValue() && mRatio * mPeak > 1.0 && ratio2 * mPeak < 1.0)
   {
      mRatio = 1.0 / mPeak;
   }

   mAmp = LINEAR_TO_DB(mRatio);
   mAmpT->GetValidator()->TransferToWindow();

   mNewPeak = LINEAR_TO_DB(mRatio * mPeak);
   mNewPeakT->GetValidator()->TransferToWindow();

   CheckClip();
}
开发者ID:MindFy,项目名称:audacity,代码行数:21,代码来源:Amplify.cpp


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