bool TTSFestival::start(QString* errStr) { qDebug() << "[Festival] Starting server with voice " << RbSettings::subValue("festival", RbSettings::TtsVoice).toString(); bool running = ensureServerRunning(); if (!RbSettings::subValue("festival",RbSettings::TtsVoice).toString().isEmpty()) { /* There's no harm in using both methods to set the voice .. */ QString voiceSelect = QString("(voice.select '%1)\n") .arg(RbSettings::subValue("festival", RbSettings::TtsVoice).toString()); queryServer(voiceSelect, 3000); if(prologFile.open()) { prologFile.write(voiceSelect.toAscii()); prologFile.close(); prologPath = QFileInfo(prologFile).absoluteFilePath(); qDebug() << "[Festival] Prolog created at " << prologPath; } } if (!running) (*errStr) = "Festival could not be started"; return running; }
QStringList TTSFestival::getVoiceList() { if(!configOk()) return QStringList(); if(voices.size() > 0) { qDebug() << "[Festival] Using voice cache"; return voices; } QString response = queryServer("(voice.list)", 10000); // get the 2nd line. It should be (<voice_name>, <voice_name>) response = response.mid(response.indexOf('\n') + 1, -1); response = response.left(response.indexOf('\n')).trimmed(); voices = response.mid(1, response.size()-2).split(' '); voices.sort(); if (voices.size() == 1 && voices[0].size() == 0) voices.removeAt(0); if (voices.size() > 0) qDebug() << "[Festival] Voices: " << voices; else qDebug() << "[Festival] No voices. Response was: " << response; return voices; }
bool TTSFestival::start(QString* errStr) { (void) errStr; ensureServerRunning(); if (!RbSettings::subValue("festival",RbSettings::TtsVoice).toString().isEmpty()) queryServer(QString("(voice.select '%1)") .arg(RbSettings::subValue("festival", RbSettings::TtsVoice).toString())); return true; }
// main function to start the white board admin. int main(int argc, char * argv[]) { CLIENT * clp = 0; int result = -1; if (argc < 4) goto error; char * cmd = argv[1]; if (cmd[0] != '-') goto error; char * host = argv[2]; int prognum = strtol(argv[3], 0, 16); printf("program number: %x\n", prognum); clp = clnt_create(host, prognum, WhiteBoardServerVersion, "tcp"); if (!clp) { fprintf(stderr, "%s %s : %d. \n", "Can't create client. ", __FILE__, __LINE__); printf("Maybe your server with given program number was not started.\n"); goto done; } switch (cmd[1]) { case 'q': result = queryServer(host, prognum, clp); break; case 'n': if (argc < 5) goto error; /* result == prog num of new server */ result = *(newserver_1(&argv[4], clp)); break; case 't': if (argc < 6) goto error; struct XferWBArg xa; strcpy(xa.boardnm, argv[4]); strcpy(xa.machinenm, argv[5]); xa.nprogram = strtol(argv[6], 0, 16); xa.nversion = WhiteBoardServerVersion; result = *(transferwhiteboard_1(&xa, clp)); break; default: goto error; } done: if (clp) clnt_destroy(clp); // printf("result %d\n", result); return result; error: /* more elaborate error reporting is better */ usage(); goto done; }
QString TTSFestival::getVoiceInfo(QString voice) { if(!configOk()) return ""; if(!getVoiceList().contains(voice)) return ""; if(voiceDescriptions.contains(voice)) return voiceDescriptions[voice]; QString response = queryServer(QString("(voice.description '%1)").arg(voice), 10000); if (response == "") { voiceDescriptions[voice]=tr("No description available"); } else { response = response.remove(QRegExp("(description \"*\")", Qt::CaseInsensitive, QRegExp::Wildcard)); qDebug() << "[Festival] voiceInfo w/o descr: " << response; response = response.remove(')'); QStringList responseLines = response.split('(', QString::SkipEmptyParts); responseLines.removeAt(0); // the voice name itself QString description; foreach(QString line, responseLines) { line = line.remove('('); line = line.simplified(); line[0] = line[0].toUpper(); // capitalize the key int firstSpace = line.indexOf(' '); if (firstSpace > 0) { // add a colon between the key and the value line = line.insert(firstSpace, ':'); // capitalize the value line[firstSpace+2] = line[firstSpace+2].toUpper(); } description += line + "\n"; } voiceDescriptions[voice] = description.trimmed(); }
void TTSFestival::startServer(QString path) { if(!configOk()) return; if(path == "") path = RbSettings::subValue("festival-server",RbSettings::TtsPath).toString(); serverProcess.start(QString("%1 --server").arg(path)); serverProcess.waitForStarted(); queryServer("(getpid)",300,path); if(serverProcess.state() == QProcess::Running) qDebug() << "Festival is up and running"; else qDebug() << "Festival failed to start"; }
int main(int argc, char *argv[]) /* Process command line. */ { char *command; optionInit(&argc, argv, options); if (argc < 2) usage(); port = optionInt("port", port); host = optionVal("host", host); penalty = optionInt("penalty", penalty); recovery = optionInt("recovery", recovery); subnet = optionVal("subnet", subnet); command = argv[1]; if (sameString(command, "start")) { if (argc != 2) usage(); forkOffServer(); } else if (sameString(command, "query")) { int count = 1; if (argc > 3) count = atoi(argv[3]); queryServer(argv[2], count); } else if (sameString(command, "list")) { listAll(); } else if (sameString(command, "set")) { if (argc != 4) usage(); setUser(argv[2], argv[3]); } else { usage(); } return 0; }
void EMailImapService::run() throw () { while(true) { _threadMutex.enter(); if(!_run) break; try { IBRCOMMON_LOGGER(info) << "EMail Convergence Layer: Looking for new bundles via IMAP" << IBRCOMMON_LOGGER_ENDL; queryServer(); }catch(vmime::exception &e) { if(_run) IBRCOMMON_LOGGER(error) << "EMail Convergence Layer: Error during IMAP fetch operation: " << e.what() << IBRCOMMON_LOGGER_ENDL; }catch(IMAPException &e) { if(_run) IBRCOMMON_LOGGER(error) << "EMail Convergence Layer: IMAP error: " << e.what() << IBRCOMMON_LOGGER_ENDL; } } }