comparison runner/FeatureExtractionManager.cpp @ 219:d0fe861bb116

Fix grisly error in multiplexed audio reader (calling itself!)
author Chris Cannam
date Fri, 20 Nov 2015 09:32:11 +0000
parents c17b184c16db
children 88044af67bd1
comparison
equal deleted inserted replaced
218:dc82579c9a26 219:d0fe861bb116
614 retrievalProgress.done(); 614 retrievalProgress.done();
615 } 615 }
616 if (!reader) { 616 if (!reader) {
617 throw FailedToOpenFile(source); 617 throw FailedToOpenFile(source);
618 } 618 }
619 return reader;
620 }
621
622 void
623 FeatureExtractionManager::extractFeaturesFor(AudioFileReader *reader,
624 QString audioSource)
625 {
626 // Note: This also deletes reader
627
628 cerr << "Audio file \"" << audioSource.toStdString() << "\": "
629 << reader->getChannelCount() << "ch at "
630 << reader->getNativeRate() << "Hz" << endl;
631 if (reader->getChannelCount() != m_channels || 619 if (reader->getChannelCount() != m_channels ||
632 reader->getNativeRate() != m_sampleRate) { 620 reader->getNativeRate() != m_sampleRate) {
633 cerr << "NOTE: File will be mixed or resampled for processing, to: " 621 cerr << "NOTE: File will be mixed or resampled for processing, to: "
634 << m_channels << "ch at " 622 << m_channels << "ch at "
635 << m_sampleRate << "Hz" << endl; 623 << m_sampleRate << "Hz" << endl;
636 } 624 }
625 return reader;
626 }
627
628 void
629 FeatureExtractionManager::extractFeaturesFor(AudioFileReader *reader,
630 QString audioSource)
631 {
632 // Note: This also deletes reader
633
634 cerr << "Audio file \"" << audioSource.toStdString() << "\": "
635 << reader->getChannelCount() << "ch at "
636 << reader->getNativeRate() << "Hz" << endl;
637 637
638 // allocate audio buffers 638 // allocate audio buffers
639 float **data = new float *[m_channels]; 639 float **data = new float *[m_channels];
640 for (int c = 0; c < m_channels; ++c) { 640 for (int c = 0; c < m_channels; ++c) {
641 data[c] = new float[m_blockSize]; 641 data[c] = new float[m_blockSize];