Mercurial > hg > sonic-annotator
comparison runner/FeatureExtractionManager.cpp @ 116:1c0799754670
Normalise option (yet to be tested)
author | Chris Cannam |
---|---|
date | Fri, 03 Oct 2014 15:42:55 +0100 |
parents | 297f9e415e39 |
children | 5be4995f4029 |
comparison
equal
deleted
inserted
replaced
115:95de6db296a1 | 116:1c0799754670 |
---|---|
57 // PluginBufferingAdapter handles this for us. It's likely to be | 57 // PluginBufferingAdapter handles this for us. It's likely to be |
58 // quicker to use larger sizes than smallish ones like 1024 | 58 // quicker to use larger sizes than smallish ones like 1024 |
59 m_blockSize(16384), | 59 m_blockSize(16384), |
60 m_defaultSampleRate(0), | 60 m_defaultSampleRate(0), |
61 m_sampleRate(0), | 61 m_sampleRate(0), |
62 m_channels(0) | 62 m_channels(0), |
63 m_normalise(false) | |
63 { | 64 { |
64 } | 65 } |
65 | 66 |
66 FeatureExtractionManager::~FeatureExtractionManager() | 67 FeatureExtractionManager::~FeatureExtractionManager() |
67 { | 68 { |
80 } | 81 } |
81 | 82 |
82 void FeatureExtractionManager::setDefaultSampleRate(int sampleRate) | 83 void FeatureExtractionManager::setDefaultSampleRate(int sampleRate) |
83 { | 84 { |
84 m_defaultSampleRate = sampleRate; | 85 m_defaultSampleRate = sampleRate; |
86 } | |
87 | |
88 void FeatureExtractionManager::setNormalise(bool normalise) | |
89 { | |
90 m_normalise = normalise; | |
85 } | 91 } |
86 | 92 |
87 static PluginSummarisingAdapter::SummaryType | 93 static PluginSummarisingAdapter::SummaryType |
88 getSummaryType(string name) | 94 getSummaryType(string name) |
89 { | 95 { |
455 | 461 |
456 // Open to determine validity, channel count, sample rate only | 462 // Open to determine validity, channel count, sample rate only |
457 // (then close, and open again later with actual desired rate &c) | 463 // (then close, and open again later with actual desired rate &c) |
458 | 464 |
459 AudioFileReader *reader = | 465 AudioFileReader *reader = |
460 AudioFileReaderFactory::createReader(source, 0, false, | 466 AudioFileReaderFactory::createReader(source, 0, |
467 m_normalise, | |
461 &retrievalProgress); | 468 &retrievalProgress); |
462 | 469 |
463 if (!reader) { | 470 if (!reader) { |
464 throw FailedToOpenFile(audioSource); | 471 throw FailedToOpenFile(audioSource); |
465 } | 472 } |
554 } | 561 } |
555 if (!reader) { | 562 if (!reader) { |
556 ProgressPrinter retrievalProgress("Retrieving audio data..."); | 563 ProgressPrinter retrievalProgress("Retrieving audio data..."); |
557 FileSource fs(source, &retrievalProgress); | 564 FileSource fs(source, &retrievalProgress); |
558 fs.waitForData(); | 565 fs.waitForData(); |
559 reader = AudioFileReaderFactory::createReader | 566 reader = AudioFileReaderFactory::createReader(fs, m_sampleRate, |
560 (fs, m_sampleRate, false, &retrievalProgress); | 567 m_normalise, |
568 &retrievalProgress); | |
561 retrievalProgress.done(); | 569 retrievalProgress.done(); |
562 } | 570 } |
563 if (!reader) { | 571 if (!reader) { |
564 throw FailedToOpenFile(source); | 572 throw FailedToOpenFile(source); |
565 } | 573 } |