Adds 'numSamples' pcs of samples from the 'samples' memory position into the input of the object.
| 291 | // Adds 'numSamples' pcs of samples from the 'samples' memory position into |
| 292 | // the input of the object. |
| 293 | void SoundTouch::putSamples(const SAMPLETYPE *samples, uint nSamples) |
| 294 | { |
| 295 | if (bSrateSet == FALSE) |
| 296 | { |
| 297 | ST_THROW_RT_ERROR("SoundTouch : Sample rate not defined"); |
| 298 | } |
| 299 | else if (channels == 0) |
| 300 | { |
| 301 | ST_THROW_RT_ERROR("SoundTouch : Number of channels not defined"); |
| 302 | } |
| 303 | |
| 304 | // Transpose the rate of the new samples if necessary |
| 305 | /* Bypass the nominal setting - can introduce a click in sound when tempo/pitch control crosses the nominal value... |
| 306 | if (rate == 1.0f) |
| 307 | { |
| 308 | // The rate value is same as the original, simply evaluate the tempo changer. |
| 309 | assert(output == pTDStretch); |
| 310 | if (pRateTransposer->isEmpty() == 0) |
| 311 | { |
| 312 | // yet flush the last samples in the pitch transposer buffer |
| 313 | // (may happen if 'rate' changes from a non-zero value to zero) |
| 314 | pTDStretch->moveSamples(*pRateTransposer); |
| 315 | } |
| 316 | pTDStretch->putSamples(samples, nSamples); |
| 317 | } |
| 318 | */ |
| 319 | #ifndef SOUNDTOUCH_PREVENT_CLICK_AT_RATE_CROSSOVER |
| 320 | else if (rate <= 1.0f) |
| 321 | { |
| 322 | // transpose the rate down, output the transposed sound to tempo changer buffer |
| 323 | assert(output == pTDStretch); |
| 324 | pRateTransposer->putSamples(samples, nSamples); |
| 325 | pTDStretch->moveSamples(*pRateTransposer); |
| 326 | } |
| 327 | else |
| 328 | #endif |
| 329 | { |
| 330 | // evaluate the tempo changer, then transpose the rate up, |
| 331 | assert(output == pRateTransposer); |
| 332 | pTDStretch->putSamples(samples, nSamples); |
| 333 | pRateTransposer->moveSamples(*pTDStretch); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | |
| 338 | // Flushes the last samples from the processing pipeline to the output. |
nothing calls this directly
no test coverage detected