void WavesReverb::RecalculateWavesReverbParams() //---------------------------------------------- { // Recalculate filters const double ReverbTimeSmp = -3000.0 / (m_SndFile.GetSampleRate() * ReverbTime()); const double ReverbTimeSmpHF = ReverbTimeSmp * (1.0 / HighFreqRTRatio() - 1.0); m_coeffs[0] = static_cast<float>(std::pow(10.0, (m_delay[4] / 2) * ReverbTimeSmp)); m_coeffs[1] = static_cast<float>(std::pow(10.0, (m_delay[5] / 2) * ReverbTimeSmp)); double sum = 0.0; for(uint32 pair = 0; pair < 4; pair++) { double gain1 = std::pow(10.0, (m_delay[pair] / 4) * ReverbTimeSmp); double gain2 = (1.0 - std::pow(10.0, ((m_delay[pair] / 4) + (m_delay[4 + pair / 2] / 2)) * ReverbTimeSmpHF)) * 0.5; double gain3 = gain1 * m_coeffs[pair / 2]; double gain4 = gain3 * (((gain3 + 1.0) * gain3 + 1.0) * gain3 + 1.0) + 1.0; m_coeffs[2 + pair * 2] = static_cast<float>(gain1 * (1.0 - gain2)); m_coeffs[3 + pair * 2] = static_cast<float>(gain1 * gain2); sum += gain4 * gain4; } double inGain = std::pow(10.0, GainInDecibel(m_param[kRvbInGain]) * 0.05); double reverbMix = std::pow(10.0, GainInDecibel(m_param[kRvbReverbMix]) * 0.1); m_dryFactor = static_cast<float>(std::sqrt(1.0 - reverbMix) * inGain); m_wetFactor = static_cast<float>(std::sqrt(reverbMix) * (4.0 / std::sqrt(sum) * inGain)); }
CString ParamEq::GetParamDisplay(PlugParamIndex param) //---------------------------------------------------- { float value = 0.0f; switch(param) { case kEqCenter: value = FreqInHertz(); break; case kEqBandwidth: value = BandwidthInSemitones(); break; case kEqGain: value = GainInDecibel(); break; } CString s; s.Format("%.2f", value); return s; }
CString WavesReverb::GetParamDisplay(PlugParamIndex param) //-------------------------------------------------------- { float value = m_param[param]; switch(param) { case kRvbInGain: case kRvbReverbMix: value = GainInDecibel(value); break; case kRvbReverbTime: value = ReverbTime(); break; case kRvbHighFreqRTRatio: value = HighFreqRTRatio(); break; } CString s; s.Format("%.2f", value); return s; }
void ParamEq::RecalculateEqParams() //--------------------------------- { const float freq = std::min(FreqInHertz() / m_SndFile.GetSampleRate(), 0.5f); const float a = std::pow(10, GainInDecibel() / 40.0f); const float w0 = 2.0f * float(M_PI) * freq; const float sinW0 = std::sin(w0); const float cosW0 = std::cos(w0); const float alpha = sinW0 * std::sinh((BandwidthInSemitones() * (float(M_LN2) / 24.0f)) * w0 / sinW0); const float b0 = 1.0f + alpha * a; const float b1 = -2.0f * cosW0; const float b2 = 1.0f - alpha * a; const float a0 = 1.0f + alpha / a; const float a1 = -2.0f * cosW0; const float a2 = 1.0f - alpha / a; b0DIVa0 = b0 / a0; b1DIVa0 = b1 / a0; b2DIVa0 = b2 / a0; a1DIVa0 = a1 / a0; a2DIVa0 = a2 / a0; }