Ejemplo n.º 1
0
Error_t Vibrato::setParam( VibratoIf::VibratoParams eParam, float fParamValue )
{
    if (isInParamRange(eParam, fParamValue))
        return kFunctionInvalidArgsError;
    
    if (eParam == VibratoIf::kParamModWidth)
    {
        int iNumAdditionalTaps  = CUtil::float2int<int>(fParamValue - _afParam[VibratoIf::kParamModWidth]);
        if (iNumAdditionalTaps < 0)
        {
            for (int c = 0; c < _iNumChannels; c++)
            {
                _ppCRingBuffer[c]->setWriteIdx(CUtil::float2int<int>(fParamValue) + _ppCRingBuffer[c]->getReadIdx());
            }
        }
        else
        {
            
            for (int c = 0; c < _iNumChannels; c++)
            {
                for (int i = 0; i < iNumAdditionalTaps; i++)
                {
                    _ppCRingBuffer[c]->putPostInc(0.F);
                }
            }
        }
    }
    
    _afParam[eParam]   = fParamValue;
    
    return kNoError;
}
Ejemplo n.º 2
0
Error_t CVibrato::setParam( VibratoParam_t eParam, float fParamValue )
{
    if (!m_bIsInitialized)
        return kNotInitializedError;
    if (!isInParamRange(eParam, fParamValue))
        return kFunctionInvalidArgsError;

    switch (eParam)
    {
    case kParamModFreqInHz:
        return m_pCLfo->setParam(CLfo::kLfoParamFrequency, fParamValue);
    case kParamModWidthInS:
        return m_pCLfo->setParam(CLfo::kLfoParamAmplitude, fParamValue * m_fSampleRate);
    }

    return kNoError;
}