| 145 | } |
| 146 | |
| 147 | float LfoManager::getModulatedValue(const juce::String& parameterID) const |
| 148 | { |
| 149 | // Check if the parameter ID exists in our map of modulated normalized values. |
| 150 | auto it = modulatedValues.find(parameterID); |
| 151 | |
| 152 | if (it != modulatedValues.end()) |
| 153 | { |
| 154 | // Convert normalized value to real value --- |
| 155 | auto* parameter = treeState.getParameter(parameterID); |
| 156 | if (parameter) |
| 157 | { |
| 158 | // If found, convert the final normalized value back to the parameter's real value. |
| 159 | return parameter->convertFrom0to1(it->second); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | // If not found, it means the parameter is not being modulated. |
| 164 | // Return its original value directly from the APVTS. |
| 165 | // NOTE: It's safer to get the parameter and ask for its real value. |
| 166 | if (auto* param = treeState.getRawParameterValue(parameterID)) |
| 167 | return *param; |
| 168 | |
| 169 | jassertfalse; // Parameter not found |
| 170 | return 0.0f; |
| 171 | } |
| 172 | |
| 173 | // ============================================================================= |
| 174 | // Private Helper Functions |
no outgoing calls
no test coverage detected