Пример #1
0
void QtSpeech::tell(QString text, QObject * obj, const char * slot) const
{
    if (obj != 0L && slot != 0L)
    {
        if (d->waitingFinish)
            throw LogicError(Where+"Already waiting to finish speech");

        d->onFinishObj = obj;
        d->onFinishSlot = slot;
        if (obj && slot)
            connect(const_cast<QtSpeech *>(this), SIGNAL(finished()), obj, slot);

        d->waitingFinish = true;
        const_cast<QtSpeech *>(this)->startTimer(100);
    }

    Private::WCHAR_Holder w_text(text);
    SysCall( d->voice->Speak( w_text.w, SPF_ASYNC | SPF_IS_NOT_XML | SPF_PURGEBEFORESPEAK, 0), LogicError);
}
Пример #2
0
void QtSpeech::tell(QString text, QObject * obj, const char * slot) const
{
    if (d->waitingFinish) {
        //throw LogicError(Where+"Already waiting to finish speech");
        //win api to stop any existing speech going
        HRESULT hr = d->voice->Speak( NULL, SPF_PURGEBEFORESPEAK, 0 );
            if (FAILED( hr )) qDebug() << "sapi51: stop is not completed";
    }

    d->onFinishObj = obj;
    d->onFinishSlot = slot;
    if (obj && slot)
        connect(const_cast<QtSpeech *>(this), SIGNAL(finished()), obj, slot);

    d->waitingFinish = true;
    const_cast<QtSpeech *>(this)->startTimer(100);

    Private::WCHAR_Holder w_text(text);
    SysCall( d->voice->Speak( w_text.w, SPF_ASYNC | SPF_IS_NOT_XML, 0), LogicError);
}
Пример #3
0
void QtSpeech::say(QString text) const
{
    Private::WCHAR_Holder w_text(text);
    SysCall( d->voice->Speak( w_text.w, SPF_IS_NOT_XML, 0), LogicError);
}