本文整理汇总了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;
}
示例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;
}