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


C++ Audio::playback方法代码示例

本文整理汇总了C++中Audio::playback方法的典型用法代码示例。如果您正苦于以下问题:C++ Audio::playback方法的具体用法?C++ Audio::playback怎么用?C++ Audio::playback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Audio的用法示例。


在下文中一共展示了Audio::playback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: decode

std::string decode()
{
  std::string er = "error";

	std::string fileLoc = "audio.raw"; 	//this is the location of the file we will be comparing against our langauge model

	std::string outputString;  //holds the decoded string

	if(listen.init()>0)
	{
		std::cerr<<"error on init"<<std::endl;
		return er;
	}
  
  listen.setKeyphrase();

  std::string keyword;

  while(keyword != "aries")
  {
    audio.recordAudio(2000000);
    keyword = listen.rawToString(fileLoc.c_str());
    remove ("audio.raw");
  }

  listen.unsetKeyphrase();

  audio.playback("sounds/beep.wav");

  audio.recordAudio(4000000);
  outputString = listen.rawToString(fileLoc.c_str());   //process the .raw file and store the string
  remove ("audio.raw");

  return outputString;
}
开发者ID:Aries3D,项目名称:ProjectAries,代码行数:35,代码来源:main.cpp

示例2: main

int main()
{
  std::string outputString;
  std::string speakString;

  audio.playback("sounds/beep.wav");

  while(outputString != "shutdown")
  {
   outputString = decode(); 

   if(outputString == "explain") audio.festival("I am a beta version of a software engine that is meant to add voice functionality to other code. My advantage over siri and other such programs is that I specialize in specific vocabulary. This makes me fast, accurate and moduler.");

   else if(outputString != "shutdown") 
    {
      speakString = action(outputString);

      audio.festival(speakString);
    }
  }

  audio.festival("Thank you, and goodbye");

	/*
	 *  The above sequance is very basic and linear. Ideas to increase the responsiveness of the program
	 *  is to create a thread that is always checking for new raw files and creates new threads appropriately
	 *  to carry out the various commands.
	 *
	 *  Also to minimize processor usage, have the device enter a "sleep mode" during times of low use, such as
	 *  during sleeping or school hours, or have it only begin recording after a specific gesture, "ok".
   *
	 */


	return 0;
}
开发者ID:Aries3D,项目名称:ProjectAries,代码行数:36,代码来源:main.cpp


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