Esempio n. 1
0
def _message_cb(bus, message, pipe):
    if message.type in (Gst.MessageType.EOS, Gst.MessageType.ERROR):
        pipe.set_state(Gst.State.NULL)
        if pipe is play_speaker[1]:
            speech.reset_cb()
    elif message.type == Gst.MessageType.ELEMENT and \
            message.get_structure().get_name() == 'espeak-mark':
        mark = message.get_structure().get_value('mark')
        speech.highlight_cb(int(mark))
Esempio n. 2
0
def _message_cb(bus, message, pipe):
    if message.type in (gst.MESSAGE_EOS, gst.MESSAGE_ERROR):
        pipe.set_state(gst.STATE_NULL)
        if pipe is play_speaker[1]:
            speech.reset_cb()
    elif message.type == gst.MESSAGE_ELEMENT and \
            message.structure.get_name() == 'espeak-mark':
        mark = message.structure['mark']
        speech.highlight_cb(int(mark))
Esempio n. 3
0
def _message_cb(bus, message, pipe):
    if message.type in (Gst.MessageType.EOS, Gst.MessageType.ERROR):
        pipe.set_state(Gst.State.NULL)
        if pipe is play_speaker[1]:
            speech.reset_cb()
    elif message.type == Gst.MessageType.ELEMENT and \
            message.get_structure().get_name() == 'espeak-mark':
        mark = message.get_structure().get_value('mark')
        speech.highlight_cb(int(mark))
def _message_cb(bus, message, pipe):
    if message.type == Gst.MessageType.EOS:
        pipe.set_state(Gst.State.NULL)
        if speech.end_text_cb is not None:
            speech.end_text_cb()
    if message.type == Gst.MessageType.ERROR:
        pipe.set_state(Gst.State.NULL)
        if pipe is play_speaker[1]:
            speech.reset_cb()
    elif message.type == Gst.MessageType.ELEMENT and \
            message.get_structure().get_name() == 'espeak-mark':
        mark = message.get_structure()['mark']
        speech.highlight_cb(int(mark))
 def next_word_cb(self, type, **kargs):
     if type == speechd.CallbackType.INDEX_MARK:
         mark = kargs['index_mark']
         word_count = int(mark)
         Gdk.threads_enter()
         speech.highlight_cb(word_count)
         Gdk.threads_leave()
     elif type == speechd.CallbackType.END:
         Gdk.threads_enter()
         speech.reset_cb()
         Gdk.threads_leave()
         global done
         done = True
Esempio n. 6
0
 def next_word_cb(self, type, **kargs):
     if type == speechd.CallbackType.INDEX_MARK:
         mark = kargs['index_mark']
         word_count = int(mark)
         Gdk.threads_enter()
         speech.highlight_cb(word_count)
         Gdk.threads_leave()
     elif type == speechd.CallbackType.END:
         Gdk.threads_enter()
         speech.reset_cb()
         Gdk.threads_leave()
         global done
         done = True
def _message_cb(bus, message, pipe):
    logging.error('gstreamer message %s', message)
    if message is None:
        return
    if message.type == Gst.Message.EOS:
        pipe.set_state(Gst.State.NULL)
        if speech.end_text_cb != None:
            speech.end_text_cb()
    if message.type == Gst.Message.ERROR:
        pipe.set_state(Gst.State.NULL)
        if pipe is play_speaker[1]:
            if speech.reset_cb is not None:
                speech.reset_cb()
            if speech.reset_buttons_cb is not None:
                speech.reset_buttons_cb()
    elif message.type == Gst.Message.ELEMENT and \
            message.structure.get_name() == 'espeak-mark':
        mark = message.structure['mark']
        speech.highlight_cb(int(mark))