Revision 36:7d4c98c696a5 TestDefaults.cpp
| TestDefaults.cpp | ||
|---|---|---|
| 187 | 187 |
if (p->getParameterDescriptors().empty()) return r; |
| 188 | 188 |
|
| 189 | 189 |
// Set all parameters to non-default values |
| 190 |
|
|
| 190 | 191 |
Plugin::ParameterList pl = p->getParameterDescriptors(); |
| 192 |
|
|
| 191 | 193 |
for (int i = 0; i < (int)pl.size(); ++i) {
|
| 192 |
if (pl[i].defaultValue == pl[i].minValue) {
|
|
| 193 |
p->setParameter(pl[i].identifier, pl[i].maxValue); |
|
| 194 |
} else {
|
|
| 195 |
p->setParameter(pl[i].identifier, pl[i].minValue); |
|
| 194 |
|
|
| 195 |
// Half-way between default and max value, seems a |
|
| 196 |
// reasonable guess for something to set it to. We want to |
|
| 197 |
// avoid the real extremes because they can sometimes be |
|
| 198 |
// very slow, and we want to avoid setting everything to |
|
| 199 |
// the same values (e.g. min) because plugins will |
|
| 200 |
// sometimes legitimately reject that. |
|
| 201 |
|
|
| 202 |
// Remember to take into account quantization |
|
| 203 |
|
|
| 204 |
float value = (pl[i].defaultValue + pl[i].maxValue) / 2; |
|
| 205 |
|
|
| 206 |
if (pl[i].isQuantized) {
|
|
| 207 |
value = round(value / pl[i].quantizeStep) * pl[i].quantizeStep; |
|
| 196 | 208 |
} |
| 209 |
|
|
| 210 |
if (value > pl[i].maxValue) {
|
|
| 211 |
value = pl[i].maxValue; |
|
| 212 |
} |
|
| 213 |
if (value < pl[i].minValue) {
|
|
| 214 |
value = pl[i].minValue; |
|
| 215 |
} |
|
| 216 |
if (value == pl[i].defaultValue) {
|
|
| 217 |
if (pl[i].defaultValue == pl[i].minValue) {
|
|
| 218 |
value = pl[i].maxValue; |
|
| 219 |
} else {
|
|
| 220 |
value = pl[i].minValue; |
|
| 221 |
} |
|
| 222 |
} |
|
| 223 |
|
|
| 224 |
p->setParameter(pl[i].identifier, value); |
|
| 197 | 225 |
} |
| 198 | 226 |
|
| 199 | 227 |
if (!initAdapted(p.get(), channels, _step, _step, r)) return r; |
Also available in: Unified diff