| 238 | */ |
| 239 | |
| 240 | eTickResult cWaveSource::myTick(long long t) |
| 241 | { |
| 242 | if (isEOI()) { |
| 243 | // Check if we successfully reached the end of the current segment, |
| 244 | // or if processing got interrupted at a different point. |
| 245 | // If so, give an error: |
| 246 | if (!eof) { |
| 247 | SMILE_IERR(1, "Processing aborted before all data was read from the input wave file! There must be something wrong with your config, e.g. a dataReader blocking a dataMemory level. Look for level full error messages in the debug mode output!"); |
| 248 | } |
| 249 | return TICK_INACTIVE; |
| 250 | } |
| 251 | if (mat_ == NULL) { |
| 252 | if (monoMixdown) allocMat(1, blocksizeW_); |
| 253 | else allocMat(pcmParam.nChan, blocksizeW_); |
| 254 | } |
| 255 | while (negativestart == 1) { |
| 256 | if (negstartoffset >= blocksizeW_) { |
| 257 | if (writer_->checkWrite(negstartoffset)) { |
| 258 | writer_->setNextMatrix(mat_); |
| 259 | } |
| 260 | negstartoffset = negstartoffset - blocksizeW_; |
| 261 | SMILE_IMSG(1, "Negative Start Offset: = %f", negstartoffset); |
| 262 | } |
| 263 | if (negstartoffset > 0 && negstartoffset < blocksizeW_) { |
| 264 | bool noTimeMeta = writer_->getLevelConfig()->noTimeMeta; |
| 265 | cMatrix *matout = new cMatrix(mat_->N, negstartoffset, noTimeMeta); |
| 266 | if (writer_->checkWrite(negstartoffset)) { |
| 267 | writer_->setNextMatrix(matout); |
| 268 | } |
| 269 | negstartoffset = negstartoffset - blocksizeW_; |
| 270 | SMILE_IMSG(1, "Negative Start Offset: = %f", negstartoffset); |
| 271 | negativestart = 0; |
| 272 | } |
| 273 | if (negstartoffset == 0) negativestart = 0; |
| 274 | } |
| 275 | if (!writer_->checkWrite(blocksizeW_)) |
| 276 | return TICK_DEST_NO_SPACE; |
| 277 | if (readData()) { // read new data from wave file! |
| 278 | /**/ |
| 279 | if (properTimestamps_) { |
| 280 | // NOTE: this is experimental, seems to work, but is inefficient. |
| 281 | // This has to be replaced by the new "simple" layers. |
| 282 | for (long i = 0; i < mat_->nT; i++) { // <<-- new timestamp assignment, untested!! |
| 283 | mat_->tmeta[i].smileTime = (double)(curReadPos - mat_->nT + i) |
| 284 | / (double)pcmParam.sampleRate; |
| 285 | }/**/ |
| 286 | } |
| 287 | if (!writer_->setNextMatrix(mat_)) { // save data in dataMemory buffers |
| 288 | SMILE_IERR(1, "can't write, level full... (strange, level space was checked using checkWrite(bs=%i))", blocksizeW_); |
| 289 | } else { |
| 290 | return TICK_SUCCESS; |
| 291 | } |
| 292 | } |
| 293 | return TICK_INACTIVE; |
| 294 | } |
| 295 | |
| 296 | |
| 297 | cWaveSource::~cWaveSource() |
nothing calls this directly
no test coverage detected