本文整理汇总了C++中AudioPlayer::getOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioPlayer::getOptions方法的具体用法?C++ AudioPlayer::getOptions怎么用?C++ AudioPlayer::getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioPlayer
的用法示例。
在下文中一共展示了AudioPlayer::getOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ex_pitchdirection
void ex_pitchdirection () {
//general
ITheFramework *frame = Factory::GetFramework ();
Decorator *decorator = ssi_create (Decorator, 0, true);
frame->AddDecorator(decorator);
ITheEventBoard *board = Factory::GetEventBoard ();
ssi_pcast (TheEventBoard, board)->getOptions()->update = 250;
// audio sensor
#ifndef SIMULATE
Audio *audio = ssi_create (Audio, "audio", true);
audio->getOptions()->scale = true;
ITransformable *audio_p = frame->AddProvider(audio, SSI_AUDIO_PROVIDER_NAME);
#else
WavReader *audio = ssi_create (WavReader, 0, true);
audio->getOptions()->setPath("audio.wav");
audio->getOptions()->scale = true;
ITransformable *audio_p = frame->AddProvider(audio, SSI_WAVREADER_PROVIDER_NAME);
#endif
frame->AddSensor(audio);
OSPitchChain * pitch = ssi_create (OSPitchChain, "pitch", true);
pitch->getOSPitchSmoother()->getOptions()->F0final = true;
pitch->getOSPitchSmoother()->getOptions()->F0finalEnv = true;
double frameSize = audio_p->getSampleRate() * 0.01;
double deltaSize = audio_p->getSampleRate() * 0.04;
pitch->getOSTransformFFT()->getOptions()->nfft = smileMath_ceilToNextPowOf2(frameSize + deltaSize); //we set the FFT frame size so it's a power of 2 but can also fit all the samples
pitch->getOSPitchShs()->getOptions()->baseSr = audio_p->getSampleRate();
ssi::ITransformable *pitch_p = frame->AddTransformer(audio_p, pitch, "0.01s", "0.04s");
OSEnergy * energy = ssi_create (OSEnergy, 0, true);
energy->getOptions()->type = OSEnergy::TYPE::RMS;
ssi::ITransformable *energy_p = frame->AddTransformer(audio_p, energy, "0.01s");
OSPitchDirection * dir = ssi_create (OSPitchDirection, 0, true);
ssi::ITransformable * xtra_src[1] = {energy_p};
ssi::ITransformable *dir_p = frame->AddTransformer(pitch_p, 1, xtra_src, dir, "0.01s");
board->RegisterSender(*dir);
SignalPainter *audio_plot = ssi_create_id (SignalPainter, 0, "plot");
audio_plot->getOptions()->setTitle("audio");
audio_plot->getOptions()->size = 10.0;
audio_plot->getOptions()->type = PaintSignalType::AUDIO;
frame->AddConsumer(audio_p, audio_plot, "0.2s");
SignalPainter *pitch_plot = ssi_create_id (SignalPainter, 0, "plot");
pitch_plot->getOptions()->setTitle("pitch");
pitch_plot->getOptions()->size = 10.0;
pitch_plot->getOptions()->type = PaintSignalType::SIGNAL;
frame->AddConsumer(pitch_p, pitch_plot, "0.2s");
SignalPainter *energy_plot = ssi_create_id (SignalPainter, 0, "plot");
energy_plot->getOptions()->setTitle("energy");
energy_plot->getOptions()->size = 10.0;
energy_plot->getOptions()->type = PaintSignalType::SIGNAL;
frame->AddConsumer(energy_p, energy_plot, "0.2s");
SignalPainter *dir_plot = ssi_create_id (SignalPainter, 0, "plot");
dir_plot->getOptions()->setTitle("direction");
dir_plot->getOptions()->size = 10.0;
dir_plot->getOptions()->type = PaintSignalType::SIGNAL;
frame->AddConsumer(dir_p, dir_plot, "0.2s");
EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, dir->getEventAddress());
#ifdef SIMULATE
AudioPlayer *player = ssi_create (AudioPlayer, "player", true);
player->getOptions()->bufferSize = 0.2;
player->getOptions()->remember = true;
frame->AddConsumer(audio_p, player, "0.01s");
#endif
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
}