npSapi plugin

About this plugin

This plugin allow us to use the Microsoft SAPI from our applications and therefore reproduce text to speech. The plugin can retrieve the system available voices and allow us to reproduce text to speech using any of the available voices. Also the plugin inform us when the text to speech starts and when the text to speech ends using their provided events/subroutines.

Thirparty

This plugin are imposible without the aid of this people:

Thanks a lot!

Plugin actions index

npSapiCreate

Create a new instance of an Sapi object. The result variable store the numeric ID of the new created Sapi object instance. You need this ID on other plugins actions.

↑↑

npSapiDestroy

Destroy a previously created instanace of an Sapi object. The result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] contain information about the error.

↑↑

npSapiDestroyAll

Destroy all previously created instances of Sapi objects.

↑↑

npSapiPlay

Resume (if paused) or start to reproduce the provided text with the currently used voice.

↑↑

npSapiPause

Pause the current text to speech reproduction.

↑↑

npSapiStop

Stop the current text to speech reproduction.

↑↑

npSapiIsPaused

Find if the current text to speech reproduction is paused or not.

↑↑

npSapiGetVoices

Retrieve the system available voices to be used when reproduce text to speech.

↑↑

npSapiSetVoice

Set an specific voice to be used when reproduce text to speech.

↑↑

npOnSapiStart

Set a subroutine to be execute when a text to speech reproduction starts.

↑↑

npOnSapiEnd

Set a subroutine to be execute when a text to speech reproduction ends.

↑↑

Action errors subroutine

All the NeoPlugins deal with errors in the same way that NeoBook does: when the plugin found an action error the [LastError] variable store information about the error, so you can take care about this variable when execute an action.

But all the NeoPlugins also incorporate an advanced way to deal with possible action errors. You can define a subroutine named OnNeoPluginActionError in order to be executed when some action error are found and you can use this variables inside:

Note that this error handling subroutine are shared for all the NeoPlugins, so you no need to specify a subroutine for every plugin you use in your publication because the same subroutine are recognized and automagically used by every NeoPlugin. Below you can view a sample of this subroutine code:

:OnNeoPluginActionError
  AlertBox "NeoPlugin Error" "Error [LastError] in plugin: [PluginName]"
Return

Also note that the use of this NeoPlugins error handling subroutine is completelly optional. You can continue using the [LastError] variable as usual and even use the both methods at the same time.

↑↑