void QGCAudioWorker::say(QString inText, int severity) { #ifdef __android__ Q_UNUSED(inText); Q_UNUSED(severity); #else static bool threadInit = false; if (!threadInit) { threadInit = true; init(); } if (!muted) { QString text = fixTextMessageForAudio(inText); // Prepend high priority text with alert beep if (severity < GAudioOutput::AUDIO_SEVERITY_CRITICAL) { beep(); } #ifdef QGC_NOTIFY_TUNES_ENABLED // Wait for the last sound to finish while (!sound->isFinished()) { QGC::SLEEP::msleep(100); } #endif #if defined _MSC_VER && defined QGC_SPEECH_ENABLED HRESULT hr = pVoice->Speak(text.toStdWString().c_str(), SPF_DEFAULT, NULL); if (FAILED(hr)) { qDebug() << "Speak failed, HR:" << QString("%1").arg(hr, 0, 16); } #elif defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED // Set size of string for espeak: +1 for the null-character unsigned int espeak_size = strlen(text.toStdString().c_str()) + 1; espeak_Synth(text.toStdString().c_str(), espeak_size, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, NULL); #elif (defined __macos__) && defined QGC_SPEECH_ENABLED macSpeech.say(text.toStdString().c_str()); #elif (defined __ios__) && defined QGC_SPEECH_ENABLED iOSSpeak(text); #else // Make sure there isn't an unused variable warning when speech output is disabled Q_UNUSED(inText); #endif } #endif // __android__ }
void QGCAudioWorker::say(QString inText) { #ifdef __android__ Q_UNUSED(inText); #else static bool threadInit = false; if (!threadInit) { threadInit = true; init(); } if (!muted) { QString text = fixTextMessageForAudio(inText); #if defined _MSC_VER && defined QGC_SPEECH_ENABLED HRESULT hr = pVoice->Speak(text.toStdWString().c_str(), SPF_DEFAULT, NULL); if (FAILED(hr)) { qDebug() << "Speak failed, HR:" << QString("%1").arg(hr, 0, 16); } #elif defined Q_OS_LINUX && defined QGC_SPEECH_ENABLED // Set size of string for espeak: +1 for the null-character unsigned int espeak_size = strlen(text.toStdString().c_str()) + 1; espeak_Synth(text.toStdString().c_str(), espeak_size, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, NULL); #elif (defined __macos__) && defined QGC_SPEECH_ENABLED macSpeech.say(text.toStdString().c_str()); #elif (defined __ios__) && defined QGC_SPEECH_ENABLED iOSSpeak(text); #else // Make sure there isn't an unused variable warning when speech output is disabled Q_UNUSED(inText); #endif } #endif // __android__ }