| 1974 | } |
| 1975 | |
| 1976 | double plainParameterToNormalized(const v3_param_id rindex, const double plain) |
| 1977 | { |
| 1978 | #if DPF_VST3_USES_SEPARATE_CONTROLLER || DISTRHO_PLUGIN_WANT_LATENCY || DISTRHO_PLUGIN_WANT_PROGRAMS |
| 1979 | switch (rindex) |
| 1980 | { |
| 1981 | #if DPF_VST3_USES_SEPARATE_CONTROLLER |
| 1982 | case kVst3InternalParameterBufferSize: |
| 1983 | return std::max<double>(0.0, std::min<double>(1.0, plain / DPF_VST3_MAX_BUFFER_SIZE)); |
| 1984 | case kVst3InternalParameterSampleRate: |
| 1985 | return std::max<double>(0.0, std::min<double>(1.0, plain / DPF_VST3_MAX_SAMPLE_RATE)); |
| 1986 | #endif |
| 1987 | #if DISTRHO_PLUGIN_WANT_LATENCY |
| 1988 | case kVst3InternalParameterLatency: |
| 1989 | return std::max<double>(0.0, std::min<double>(1.0, plain / DPF_VST3_MAX_LATENCY)); |
| 1990 | #endif |
| 1991 | #if DISTRHO_PLUGIN_WANT_PROGRAMS |
| 1992 | case kVst3InternalParameterProgram: |
| 1993 | return std::max<double>(0.0, std::min<double>(1.0, plain / fProgramCountMinusOne)); |
| 1994 | #endif |
| 1995 | } |
| 1996 | #endif |
| 1997 | |
| 1998 | #if DISTRHO_PLUGIN_WANT_MIDI_INPUT |
| 1999 | if (rindex < kVst3InternalParameterCount) |
| 2000 | return std::max<double>(0.0, std::min<double>(1.0, plain / 127)); |
| 2001 | #endif |
| 2002 | |
| 2003 | const uint32_t index = static_cast<uint32_t>(rindex - kVst3InternalParameterCount); |
| 2004 | DISTRHO_SAFE_ASSERT_UINT2_RETURN(index < fParameterCount, index, fParameterCount, 0.0); |
| 2005 | |
| 2006 | return _getNormalizedParameterValue(index, plain); |
| 2007 | } |
| 2008 | |
| 2009 | double getParameterNormalized(const v3_param_id rindex) |
| 2010 | { |
no test coverage detected