| 200 | } |
| 201 | |
| 202 | void |
| 203 | GenericDataSaver::setSampleRate(unsigned int rate) |
| 204 | { |
| 205 | if (this->rateHint != rate) { |
| 206 | QMutexLocker locker(&this->dataMutex); |
| 207 | |
| 208 | this->rateHint = rate; |
| 209 | this->allocation = 3 * rate; // Up to 3 sec of data |
| 210 | |
| 211 | // No data is being written, we can reallocate here |
| 212 | if (!this->dataWritten) { |
| 213 | this->buffers[0].resize(this->allocation); |
| 214 | this->buffers[1].resize(this->allocation); |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | void |
| 220 | GenericDataSaver::setBufferSize(unsigned int size) |