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


C++ AudioPlayer::getOptions方法代码示例

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


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