osVoiceSetWord osVoiceSetWord (function)

Registers words to the Voice Recognition System dictionary

Syntax

#include <ultra64.h> /* ultra64.h */

s32 osVoiceSetWord(OSVoiceHandle *hd, u8 *word);

Description

The osVoiceSetWord function is for registering words in the Voice Recognition System dictionary.

hd is the Voice Recognition System control structure. The Voice Recognition System must be initialized with the osVoiceInit function before the osVoiceSetWord function is called. The word (SJIS) to be registered is specified in "word." The word can be up to 17 characters long. Since calling the osVoiceSetWord function once registers one word, execute osVoiceSetWord multiple times to register multiple words. The number of words registered must match the number set by the osVoiceClearDictionary function. Please note that an error will be generated when the osVoiceStartReadData function is executed, if the number of words registered is greater than or less than the specified number of words.

The maximum number of words which can be registered in the dictionary is about 80 words, assuming 5 syllables per word. Therefore, while the maximum number of words which can be registered is set at 255, if there are several syllables per word, the dictionary may subsequently overflow the memory. In this case, voice recognition can be executed without an error being caused by the osVoiceStartReadData function even if the number of registered words is less than the number set by the osVoiceClearDictionary function.

The characters which can be registered and their codes are shown in the table below.

In addition, the following restrictions apply to character combinations when registering words. Use the osVoiceCheckWord function to check whether or not the word that you are trying to register can be registered in the Voice Recognition System. Use this in the case of game applications in which registered words will be input during debugging or by the game player.

Usage Character
No limitation on use
Can be used only after specified characters
(Combinable characters)
Cannot be used at the beginning of a word
Cannot be used at the end of a word
Cannot be used in front of "-"
Cannot be used after "tsu" or "tsu"
Combinations which cannot be used

The returned value is an error code. A 0 (zero) is returned when processing ends normally. If an error occurs, this function has the following error codes.

CONT_ERR_NO_CONTROLLER

Nothing is connected to the controller port.

CONT_ERR_DEVICE

Something other than the Voice Recognition System is connected to the controller port.

CONT_ERR_VOICE_NO_RESPONSE

There was no response from the Voice Recognition System. There may be a problem with the hardware.

CONT_ERR_CONTRFAIL

There was a data transmission failure. There is a problem in the Voice Recognition System connection.

CONT_ERR_INVALID

There is an error in the function call method or in the argument. This error will not occur if the function is being used correctly. This error will also be returned when you try to register a number of words more than the value specified in osVoiceClearDictionary

CONT_ERR_VOICE_WORD

A word containing improper characters has been registered. The set word is invalidated and the word number is not incremented. Execute the osVoiceSetWord function to register a proper word.

CONT_ERR_VOICE_MEMORY

Dictionary memory overflow. However, if the recognition command is executed in this condition, normal recognition processing can be performed even if the number of words which have been set is less than the number of words set by the osVoiceClearDictionaryfunction. When this error is generated, manage the number of words actually set on the application side.

See also

osVoiceCheckWord, osVoiceClearDictionary, osVoiceControlGain, osVoiceCountSyllables, osVoiceGetReadData, osVoiceInit, osVoiceMaskDictionary, osVoiceStartReadData, and osVoiceStopReadData

Revision History

1999/04/30 Changed Format