comparison audioio/AudioCallbackPlaySource.cpp @ 13:00ed645f4175

* various fixes in the time stretcher
author Chris Cannam
date Tue, 12 Sep 2006 19:13:12 +0000
parents ee967635c728
children 085f34c73939
comparison
equal deleted inserted replaced
12:ee967635c728 13:00ed645f4175
595 m_blockSize(blockSize) 595 m_blockSize(blockSize)
596 { 596 {
597 // std::cerr << "TimeStretcherData::TimeStretcherData(" << channels << ", " << factor << ", " << blockSize << ")" << std::endl; 597 // std::cerr << "TimeStretcherData::TimeStretcherData(" << channels << ", " << factor << ", " << blockSize << ")" << std::endl;
598 598
599 for (size_t ch = 0; ch < channels; ++ch) { 599 for (size_t ch = 0; ch < channels; ++ch) {
600
600 m_stretcher[ch] = StretcherBuffer 601 m_stretcher[ch] = StretcherBuffer
601 //!!! We really need to measure performance and work out 602 //!!!
602 //what sort of quality level to use -- or at least to 603 (new IntegerTimeStretcher(factor,
603 //allow the user to configure it 604 blockSize,
604 (new IntegerTimeStretcher(factor, blockSize, 1024), 605 // 128),
606 (blockSize/2) / factor),
605 new float[lrintf(blockSize * factor)]); 607 new float[lrintf(blockSize * factor)]);
606 } 608 }
607 m_stretchInputBuffer = new float[blockSize]; 609 m_stretchInputBuffer = new float[blockSize];
608 } 610 }
609 611
658 } 660 }
659 661
660 if (factor != 1) { 662 if (factor != 1) {
661 TimeStretcherData *newStretcher = new TimeStretcherData 663 TimeStretcherData *newStretcher = new TimeStretcherData
662 (getTargetChannelCount(), factor, 664 (getTargetChannelCount(), factor,
663 factor > 1 ? getTargetBlockSize() : getTargetBlockSize() / factor); 665 // factor > 1 ? getTargetBlockSize() : getTargetBlockSize() / factor);
666 //!!! doesn't work if the block size > getTargetBlockSize(), but it
667 // should be made to
668 getTargetBlockSize());
664 m_slowdownCounter = 0; 669 m_slowdownCounter = 0;
665 m_timeStretcher = newStretcher; 670 m_timeStretcher = newStretcher;
666 } else { 671 } else {
667 m_timeStretcher = 0; 672 m_timeStretcher = 0;
668 } 673 }