comparison runner/FeatureExtractionManager.cpp @ 11:21a31c779384

* progress tweaks
author Chris Cannam
date Fri, 12 Dec 2008 16:12:05 +0000
parents 12f250173bf2
children d20c728c9840
comparison
equal deleted inserted replaced
10:12f250173bf2 11:21a31c779384
365 365
366 void FeatureExtractionManager::extractFeatures(QString audioSource) 366 void FeatureExtractionManager::extractFeatures(QString audioSource)
367 { 367 {
368 if (m_plugins.empty()) return; 368 if (m_plugins.empty()) return;
369 369
370 ProgressPrinter printer("Retrieving audio data..."); 370 ProgressPrinter retrievalProgress("Retrieving audio data...");
371 371
372 FileSource source(audioSource, &printer); 372 FileSource source(audioSource, &retrievalProgress);
373 if (!source.isAvailable()) { 373 if (!source.isAvailable()) {
374 cerr << "ERROR: File or URL \"" << audioSource.toStdString() 374 cerr << "ERROR: File or URL \"" << audioSource.toStdString()
375 << "\" could not be located" << endl; 375 << "\" could not be located" << endl;
376 exit(1); 376 exit(1);
377 } 377 }
397 cerr << "ERROR: Internal error in FeatureExtractionManager::extractFeatures: Plugin list is non-empty, but no sample rate set" << endl; 397 cerr << "ERROR: Internal error in FeatureExtractionManager::extractFeatures: Plugin list is non-empty, but no sample rate set" << endl;
398 exit(1); 398 exit(1);
399 } 399 }
400 400
401 AudioFileReader *reader = 401 AudioFileReader *reader =
402 AudioFileReaderFactory::createReader(source, m_sampleRate, &printer); 402 AudioFileReaderFactory::createReader(source, m_sampleRate, &retrievalProgress);
403 403
404 if (!reader) { 404 if (!reader) {
405 cerr << "ERROR: File or URL \"" << audioSource.toStdString() 405 cerr << "ERROR: File or URL \"" << audioSource.toStdString()
406 << "\" could not be opened" << endl; 406 << "\" could not be opened" << endl;
407 exit(1); 407 exit(1);
408 } 408 }
409 409
410 size_t channels = reader->getChannelCount(); 410 size_t channels = reader->getChannelCount();
411 411
412 retrievalProgress.done();
413
412 cerr << "Opened " << channels << "-channel file or URL \"" << audioSource.toStdString() << "\"" << endl; 414 cerr << "Opened " << channels << "-channel file or URL \"" << audioSource.toStdString() << "\"" << endl;
413 415
414 // reject file if it has too few channels, plugin will handle if it has too many 416 // reject file if it has too few channels, plugin will handle if it has too many
415 if ((int)channels < m_channels) { 417 if ((int)channels < m_channels) {
416 //!!! should not be terminating here! 418 //!!! should not be terminating here!