Partager via


SpObjectToken Interface (SAPI 5.3)

Microsoft Speech API 5.3

SpObjectToken

The SpObjectToken automation object represents an available resource of a type used by SAPI. The default interface for this object is ISpeechObjectTokens.

The Speech configuration database contains folders representing the resources on a computer that are used by SAPI 5.1 speech recognition (SR) and text-to-speech (TTS). These folders are organized into resource categories, such as voices, lexicons, and audio input devices. The SpObjectTokenCategory object provides access to a category of resources, and the SpObjectToken object provides access to a single resource.

Several Speech Automation objects support methods that return collections of resources from a specific category of available resources. Examples are SpVoice.GetAudioOutputs, SpVoice.GetVoices and SpSharedRecognizer.GetProfiles, as well as the SpObjectToken object's MatchesAttributes method. Each of these operations returns an ISpeechObjectTokens object variable containing a collection of SpObjectToken objects.

The read-only Id property of an SpObjectToken object is the path to the folder of the resource with which it is associated. The read-only DataKey property is a data key object providing read and write access to this folder. An SpObjectToken created with the New keyword has an empty Id property, and is therefore not associated with a resource. Before it can be used, a new SpObjectToken must be associated with a resource by means of its SetId method.

The SpObjectToken object also provides the ability to create and access storage files associated with a resource. The paths of data storage files created by an engine or by applications for a specific resource are stored in its object token.

See the SpObjectToken Example for a complete example and additional details.

Automation Interface Elements

The SpObjectToken automation interface contains the following elements:

Properties
Category Property
DataKey Property
Id Property
Methods
CreateInstance Method
DisplayUI Method
GetAttribute Method
GetDescription Method
GetStorageFileName Method
IsUISupported Method
MatchesAttributes Method
Remove Method
RemoveStorageFileName Method
SetId Method