本文整理汇总了C++中keyfinder::AudioData::reduceToMono方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioData::reduceToMono方法的具体用法?C++ AudioData::reduceToMono怎么用?C++ AudioData::reduceToMono使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keyfinder::AudioData
的用法示例。
在下文中一共展示了AudioData::reduceToMono方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST (AudioDataTest, DownsamplerInsistsOnMonophonicAudio) {
KeyFinder::AudioData a;
a.setChannels(2);
a.setFrameRate(100);
a.addToSampleCount(10);
ASSERT_THROW(a.downsample(5), KeyFinder::Exception);
a.reduceToMono();
ASSERT_NO_THROW(a.downsample(5));
}
示例2:
TEST (LowPassFilterTest, InsistsOnMonophonicAudio) {
KeyFinder::AudioData a;
a.setChannels(2);
a.setFrameRate(frameRate);
a.addToSampleCount(frameRate);
KeyFinder::LowPassFilter* lpf = new KeyFinder::LowPassFilter(filterOrder, frameRate, cornerFrequency, filterFFT);
KeyFinder::Workspace w;
ASSERT_THROW(lpf->filter(a, w), KeyFinder::Exception);
a.reduceToMono();
ASSERT_NO_THROW(lpf->filter(a, w));
delete lpf;
}
示例3: keyDetectionProcess
KeyFinderResultWrapper keyDetectionProcess(const AsyncFileObject& object){
KeyFinderResultWrapper result;
result.batchRow = object.batchRow;
// initialise stream and decode file into it.
KeyFinder::AudioData* audio = NULL;
AudioFileDecoder* decoder = NULL;
try{
decoder = AudioFileDecoder::getDecoder();
}catch(KeyFinder::Exception& e){
delete decoder;
result.errorMessage = QString(e.what().c_str());
return result;
}
try{
audio = decoder->decodeFile(object.filePath);
delete decoder;
}catch(KeyFinder::Exception& e){
delete audio;
delete decoder;
result.errorMessage = QString(e.what().c_str());
return result;
}
// make audio stream monaural ahead of downsample to reduce load
audio->reduceToMono();
// downsample if necessary
if(object.prefs.getDFactor() > 1){
Downsampler* ds = Downsampler::getDownsampler(object.prefs.getDFactor(),audio->getFrameRate(),object.prefs.getLastFreq());
try{
audio = ds->downsample(audio,object.prefs.getDFactor());
}catch(KeyFinder::Exception& e){
delete audio;
delete ds;
result.errorMessage = QString(e.what().c_str());
return result;
}
delete ds;
}
KeyFinder::KeyFinder* kf = LibKeyFinderSingleton::getInstance()->getKeyFinder();
result.core = kf->findKey(*audio, object.prefs.core);
delete audio;
return result;
}