| 224 | } |
| 225 | |
| 226 | void |
| 227 | HistogramDialog::feed(const SUFLOAT *data, unsigned int len) |
| 228 | { |
| 229 | bool adjustDecider = false; |
| 230 | |
| 231 | // FIXME: Decision adjustments should be better |
| 232 | if (this->properties.space == SamplingSpace::AMPLITUDE) { |
| 233 | for (unsigned int i = 0; i < len; ++i) { |
| 234 | if (data[i] < min) { |
| 235 | min = data[i]; |
| 236 | adjustDecider = true; |
| 237 | } |
| 238 | |
| 239 | if (data[i] > max) { |
| 240 | max = data[i]; |
| 241 | adjustDecider = true; |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | if (adjustDecider) { |
| 247 | this->dummyDecider.setMinimum(this->min); |
| 248 | this->dummyDecider.setMaximum(this->max); |
| 249 | this->ui->histogram->reset(); |
| 250 | this->refreshUi(); |
| 251 | } |
| 252 | |
| 253 | this->ui->histogram->feed(data, len); |
| 254 | } |
| 255 | |
| 256 | void |
| 257 | HistogramDialog::closeEvent(QCloseEvent *) |