You can implement new drivers for the pyttsx.Engine by:
All drivers must implement the following factory function and driver interface.
Instantiates delegate subclass declared in this module.
Parameters: | proxy – Proxy instance provided by a pyttsx.Engine instance. |
---|
Note
The DriverDelegate class is not actually declared in pyttsx.drivers and cannot server as a base class. It is only here for the purpose of documenting the interface all drivers must implement.
Constructor. Must store the proxy reference.
Parameters: | proxy – Proxy instance provided by the buildDriver() function. |
---|
Optional. Invoked by the pyttsx.driver.DriverProxy when it is being destroyed so this delegate can clean up any synthesizer resources. If not implemented, the proxy proceeds safely.
Immediately ends a running driver event loop.
Immediately gets the named property value. At least those properties listed in the pyttsx.Engine.getProperty() documentation must be supported.
Parameters: | name – Name of the property to query. |
---|---|
Returns: | Value of the property at the time of this invocation. |
Immediately speaks an utterance. The speech must be output according to the current property values applied at the time of this invocation. Before this method returns, it must invoke pyttsx.driver.DriverProxy.setBusy() with value True to stall further processing of the command queue until the output completes or is interrupted.
This method must trigger one and only one started-utterance notification when output begins, one started-word notification at the start of each word in the utterance, and a finished-utterance notification when output completes.
Parameters: |
|
---|
Immediately sets the named property value. At least those properties listed in the pyttsx.Engine.setProperty() documentation must be supported. After setting the property, the driver must invoke pyttsx.driver.DriverProxy.setBusy() with value False to pump the command queue.
Parameters: |
|
---|
Immediately starts an event loop. The loop is responsible for sending notifications about utterances and pumping the command queue by using methods on the pyttsx.driver.DriverProxy object given to the factory function that created this object.
Immediately stops the current utterance output. This method must trigger a finished-utterance notification if called during on-going output. It must trigger no notification if there is no ongoing output.
After stopping the output and sending any required notification, the driver must invoke pyttsx.driver.DriverProxy.setBusy() with value False to pump the command queue.
The pyttsx.drivers.buildDriver() factory receives an instance of a DriverProxy class and provides it to the pyttsx.drivers.DriverDelegate it constructs. The driver delegate can invoke the following public methods on the proxy instance. All other public methods found in the code are reserved for use by an pyttsx.Engine instance.
Gets if the proxy is busy and cannot process the next command in the queue or not.
Returns: | True means busy, False means idle. |
---|
Fires a notification.
Parameters: | topic – The name of the notification. |
---|---|
Kwargs : | Name/value pairs associated with the topic. |
Sets the proxy to busy so it cannot continue to pump the command queue or idle so it can process the next command.
Parameters: | busy – True to set busy, false to set idle |
---|