当前位置: 首页>>代码示例>>C++>>正文


C++ AudioData::reduceToMono方法代码示例

本文整理汇总了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));
}
开发者ID:PimpinFou,项目名称:libKeyFinder,代码行数:10,代码来源:audiodatatest.cpp

示例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;
}
开发者ID:Quadrophone,项目名称:libKeyFinder,代码行数:13,代码来源:lowpassfiltertest.cpp

示例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;
}
开发者ID:b0m0x,项目名称:is_KeyFinder,代码行数:50,代码来源:asynckeyprocess.cpp


注:本文中的keyfinder::AudioData::reduceToMono方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。