void Object::speakOneLiner(Common::UString conv, Object *tokenTarget) { if (conv.empty()) conv = _conversation; if (conv.empty()) return; Common::UString text; Common::UString sound; try { Aurora::DLGFile dlg(conv, this); const Aurora::DLGFile::Line *line = dlg.getOneLiner(); if (line) { text = line->text.getString(); sound = line->sound; } } catch (Common::Exception &e) { e.add("Failed evaluating one-liner from conversation \"%s\"", conv.c_str()); Common::printException(e, "WARNING: "); } if (!text.empty()) speakString(text, 0); if (!sound.empty()) playSound(sound); }
void Object::speakOneLiner(Common::UString conv, Object *UNUSED(tokenTarget)) { if (conv.empty()) conv = _conversation; if (conv.empty()) return; Common::UString text; Common::UString sound; try { Aurora::DLGFile dlg(conv, this, true); const Aurora::DLGFile::Line *line = dlg.getOneLiner(); if (line) { text = line->text.getString(); sound = line->sound; } } catch (...) { Common::exceptionDispatcherWarning("Failed evaluating one-liner from conversation \"%s\"", conv.c_str()); } if (!text.empty()) speakString(text, 0); if (!sound.empty()) playSound(sound); }
static JSValueRef speakCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*) { JSRetainPtr<JSStringRef> speakString(Adopt, toAXElement(thisObject)->speak()); return JSValueMakeString(context, speakString.get()); }