| 3156 | } |
| 3157 | |
| 3158 | String ScriptedControlAudioParameter::getText(float value, int) const |
| 3159 | { |
| 3160 | if(vtc.active) |
| 3161 | { |
| 3162 | value = range.convertFrom0to1(value); |
| 3163 | |
| 3164 | if(type == ScriptedControlAudioParameter::Type::ComboBox) |
| 3165 | value -= 1.0; |
| 3166 | |
| 3167 | return vtc.getTextForValue((double)value); |
| 3168 | } |
| 3169 | |
| 3170 | |
| 3171 | switch (type) |
| 3172 | { |
| 3173 | case ScriptedControlAudioParameter::Type::Slider: |
| 3174 | |
| 3175 | return String(range.convertFrom0to1(jlimit(0.0f, 1.0f, value)), 1); |
| 3176 | break; |
| 3177 | case ScriptedControlAudioParameter::Type::Button: |
| 3178 | return value > 0.5f ? "On" : "Off"; |
| 3179 | break; |
| 3180 | case ScriptedControlAudioParameter::Type::ComboBox: |
| 3181 | { |
| 3182 | const int index = jlimit<int>(0, itemList.size() - 1, (int)(value*(float)itemList.size())); |
| 3183 | |
| 3184 | return itemList[index]; |
| 3185 | break; |
| 3186 | } |
| 3187 | case ScriptedControlAudioParameter::Type::Panel: |
| 3188 | { |
| 3189 | return String((int)range.convertFrom0to1(jlimit(0.0f, 1.0f, value))); |
| 3190 | } |
| 3191 | |
| 3192 | case ScriptedControlAudioParameter::Type::Unsupported: |
| 3193 | default: |
| 3194 | jassertfalse; |
| 3195 | break; |
| 3196 | } |
| 3197 | |
| 3198 | return String(); |
| 3199 | } |
| 3200 | |
| 3201 | float ScriptedControlAudioParameter::getValueForText(const String &text) const |
| 3202 | { |
no test coverage detected