Package pyTTS :: Module sapi :: Class VoiceEventManager
[show private | hide private]
[frames | no frames]

Class VoiceEventManager


Dispatches events to the registered callbacks.
Method Summary
  __init__(self)
Initializes an instance.
  ConnectHandler(self, kind, func)
Subscribes a callback for an event of the given type.
  DisconnectHandler(self, kind)
Unsubscribes a callback for the event of the given type.
  OnAudioLevel(self, stream_number, stream_position, audio_level)
Fires when the audio level changes in a speech stream.
  OnBookmark(self, stream_number, stream_position, bookmark, bookmark_id)
Fires when an XML bookmark is encountered in a speech stream.
  OnEndStream(self, stream_number, stream_position)
Fires when a speech stream finishes.
  OnEnginePrivate(self, stream_number, stream_position, engine_data)
Fires when a private message from the speech engine is encountered in a speech stream.
  OnPhoneme(self, stream_number, stream_position, duration, next_phone_id, feature, current_phone_id)
Fires when a phoneme is encountered in a speech stream.
  OnSentence(self, stream_number, stream_position, character_position, length)
Fires when a new sentence is encountered in a speech stream.
  OnStartStream(self, stream_number, stream_position)
Fires when a speech stream starts.
  OnViseme(self, stream_number, stream_position, duration, next_viseme_id, feature, current_viseme_id)
Fires when a viseme is encountered in a speech stream.
  OnVoiceChange(self, stream_number, stream_position, voice_obj_token)
Fires when a voice changes in a speech stream.
  OnWord(self, stream_number, stream_position, character_position, length)
Fires when a phoneme is encountered in a speech stream.

Instance Variable Summary
dictionary of callables handlers: Registered event handlers

Method Details

__init__(self)
(Constructor)

Initializes an instance.

ConnectHandler(self, kind, func)

Subscribes a callback for an event of the given type.
Parameters:
kind - Kind of event
           (type=integer)
func - Callback function
           (type=callable)

DisconnectHandler(self, kind)

Unsubscribes a callback for the event of the given type.
Parameters:
kind - Kind of event
           (type=integer)

OnAudioLevel(self, stream_number, stream_position, audio_level)

Fires when the audio level changes in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
audio_level - Value of the new audio level
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, AudioLevel)

OnBookmark(self, stream_number, stream_position, bookmark, bookmark_id)

Fires when an XML bookmark is encountered in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
bookmark - Value of the bookmark mark field
           (type=string)
bookmark_id - Leftmost numeric characters in the mark field
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, Bookmark, BookmarkID)

OnEndStream(self, stream_number, stream_position)

Fires when a speech stream finishes.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition)

OnEnginePrivate(self, stream_number, stream_position, engine_data)

Fires when a private message from the speech engine is encountered in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
engine_data - Engine-specific value
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, EngineData)

OnPhoneme(self, stream_number, stream_position, duration, next_phone_id, feature, current_phone_id)

Fires when a phoneme is encountered in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
duration - Duration of the phoneme in milliseconds
           (type=integer)
next_phone_id - ID of the next phoneme
           (type=integer)
feature - Indicates the phoneme is normal, stressed, or emphasized (0,1,2)
           (type=integer @param current_phone_id)
current_phone_id
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, Duration, NextID, Feature, CurrentID)

OnSentence(self, stream_number, stream_position, character_position, length)

Fires when a new sentence is encountered in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
character_position - Position of the start of the sentence in the stream
           (type=integer)
length - Length of the sentence in characters
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, CharacterPosition, Length)

OnStartStream(self, stream_number, stream_position)

Fires when a speech stream starts.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition)

OnViseme(self, stream_number, stream_position, duration, next_viseme_id, feature, current_viseme_id)

Fires when a viseme is encountered in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
duration - Duration of the viseme in milliseconds
           (type=integer)
next_viseme_id - ID of the next viseme
           (type=integer)
feature - Indicates the viseme is normal, stressed, or emphasized (0,1,2)
           (type=integer)
current_viseme_id - ID of the current viseme
           (type=integer)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, Duration, NextID, Feature, CurrentID)

OnVoiceChange(self, stream_number, stream_position, voice_obj_token)

Fires when a voice changes in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
voice_obj_token - New voice object
           (type=SAPI.SpVoiceToken)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, VoiceObjectToken)

OnWord(self, stream_number, stream_position, character_position, length)

Fires when a phoneme is encountered in a speech stream.
Parameters:
stream_number - Position of the stream in the queue of streams to speak
           (type=integer)
stream_position - Byte offset at which the event occurred
           (type=integer)
character_position - Position of the start of the sentence in the stream
           (type=integer)
length - Length of the word in characters
           (type=type)

Note: VoiceEvent(Kind, StreamNumber, StreamPosition, CharacterPosition, Length)


Instance Variable Details

handlers

Registered event handlers
Type:
dictionary of callables

Generated by Epydoc 2.1 on Fri Feb 18 13:59:27 2005 http://epydoc.sf.net