RPCConsole::~RPCConsole() { GUIUtil::saveWindowGeometry("nRPCConsoleWindow", this); emit stopExecutor(); delete ui; }
RPCConsole::~RPCConsole() { emit stopExecutor(); delete ui; }
void ExecutorInterface::sayOrEnqueue(const TextItem& textItem) { const std::string& outputName = textItem.getOutputName(); if (trim(outputName).empty()) { logMsg(LOG_WARNING, "Received text item to play, but output name is empty, ignoring..."); return; } if (!m_outputSet.hasOutput(outputName)) { logMsg(LOG_ERR, "Received text item, but output name is unknown (\'%s\'), ignoring...", outputName.c_str()); return; } if (m_pid == 0)//executor is not started; { logMsg(LOG_DEBUG, "Having text to say, but executor is not running, Launching it..."); runExecutor(); if (m_pid == 0) { logMsg(LOG_ERR, "Executor launch failed, probably there are problems! Text block will be ignored"); return; } } if (m_pipe == 0) { logMsg(LOG_ERR, "We are sure the executor is running, but pipe to it is not valid, stopping executor and waiting next text block."); stopExecutor(); return; } const std::string synthCommand = m_outputSet.prepareSynthCommand(outputName, textItem); const std::string playerCommand = m_outputSet.preparePlayerCommand(outputName, m_playerType, textItem); const std::string text = m_outputSet.prepareText(outputName, textItem); if (trim(synthCommand).empty()) { logMsg(LOG_WARNING, "Prepared synth command to be sent to executor is empty"); return; } if (trim(playerCommand).empty()) { logMsg(LOG_WARNING, "Prepared player command to be sent to executor is empty"); return; } logMsg(LOG_DEBUG, "Text and command line prepared to be sent to executor:"); logMsg(LOG_DEBUG, "Synth command line: %s;", synthCommand.c_str()); logMsg(LOG_DEBUG, "Player command line: %s;", playerCommand.c_str()); logMsg(LOG_DEBUG, "Text: %s.", text.c_str()); CommandHeader header; header.code = COMMAND_SAY; header.param1 = synthCommand.length() + 1;//+1 to reflect ending zero; header.param2 = playerCommand.length() + 1;//+1 to reflect ending zero; header.param3 = text.length() + 1;//+1 to reflect ending zero; if (!sendBlockToExecutor(&header, sizeof(CommandHeader), "\'SAY\' command header")) return; if (!sendBlockToExecutor(synthCommand.c_str(), synthCommand.length() + 1, "synth command")) return; if (!sendBlockToExecutor(playerCommand.c_str(), playerCommand.length() + 1, "player command")) return; if (!sendBlockToExecutor(text.c_str(), text.length() + 1, "text")) return; logMsg(LOG_DEBUG, "Command was successfully sent to executor!"); }