C++ example (static link)
See full example cpp/sound4.bigvoice.cl-pipe-cxx.cpp
Setup and sanity checks
instance.
SetParam(
"ADMIN_USER",
"admin");
instance.
SetParam(
"ADMIN_SECRET",
"admin");
void SetParam(const std::string &name, const std::string &value)
static void SetLogSeverity(LogSeverity severity)
static void SetLoggerCallback(log_cb_t cb)
void MyLogger(sound4::bigvoice::LogSeverity severity, const std::string &msg)
Sample to create the processing instance
if (!instance.
Create(LoginKey, RadioName, KeyId, AccessKey, store_path)) {
std::cerr << "Failed to create the processing instance" << std::endl;
return 1;
}
bool Create(const std::string &LoginKey, const std::string &RadioName, const std::string &Access_Key_ID, const std::string &Access_Key_Secret, const std::filesystem::path &save_path, int json_port=0, unsigned int frames_per_chunk=12)
Communicating with the instance
- See also
- jsonsyntax
auto answer = client->ProcessJson(R"JSON({"get":{"processorname":null}})JSON");
std::cerr << "Request for processor name returned "<<answer<<std::endl;
std::shared_ptr< CClient > NewClient()
Starting a web-server
std::cerr << "Failed to create the web server on port " << listen_port << std::endl;
return 1;
}
bool StartWebServer(int http_port, int https_port=0)
Sample processing loop
while (!stopthread)
{
std::cerr << "ProcessLoop: input stopped"<< std::endl;
stopthread=true;
break;
}
if (stopthread) break;
std::cerr << "Failed to write audio output" << std::endl;
stopthread=true;
}
}
std::array< float, OutputSampleSize > & GetBufferOut()
std::array< float, InputSampleSize > & GetBufferIn()
const size_t OutputSampleSize
const size_t InputSampleSize