osVoiceInit osVoiceInit (function)

Initializes Voice Recognition System control structure and hardware

Syntax

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

s32 osVoiceInit(OSMesgQueue *siMessegeQ, OSVoiceHandle *hd, int channel);

Description

The osVoiceInit function initializes the Voice Recognition System. It initializes both the hardware and the Voice Recognition System control structure. Consequently, there is no need to initialize the hd structure on the application side. Call this function first when using the Voice Recognition System.

It is recommended that you check to see which device is connected to a particular port prior to initialization. Standard controllers and peripheral devices other than the Voice Recognition System may be inserted into the controller ports as well. This check can be accomplished with the osContStartQuery function and the osContGetQuery function. The Voice Recognition System is connected if the value of the member variable "errno" of the OSContStatus structure is 0 (zero), and if the AND (logical product) of the value for type and CONT_TYPE_MASK is CONT_TYPE_VOICE.

siMessageQ is the message queue initialized in connection with OS_EVENT_SI. Please refer to the osSetEventMesg function in the "N64 Function Reference Manual," regarding how to establish this connection. channel is the channel number of the controller port to which the Voice Recognition Unit is connected. It is a value 0-3.

The Voice Recognition System control structure OSVoiceHandle is configured as follows.

typedef struct {
  OSMesgQueue   *__mq;          /* SI message queue */
  int           __channel;      /* Controller port No. */
  s32           __mode;         /* Used within the OS */
  u8            cmd_status;     /* Command status */
} OSVoiceHandle;

Do not change the values of these various members in the application. In addition, the only member variable which is referred to and which has any meaning is cmd_status. The member variables other than cmd_status are used by the system and therefore do not need to be referred to by the application.

The member variable cmd_status indicates the voice recognition command status. When the voice recognition command status is checked within the osVoiceGetReadData function's voice recognition library, that value is kept in cmd_status. The following values can be handled by cmd_status.

Definition Name Value Description
VOICE_STATUS_READY 0 Stop/End
VOICE_STATUS_START 1 Voice Undetected (no voice input)
VOICE_STATUS_CANCEL 3 Cancel (cancel extraneous noise)
VOICE_STATUS_BUSY 5 Detected/Detecting (voice being input, recognition processing under way)
VOICE_STATUS_END 7 End recognition processing (enable execution of Get Recognition Results command)


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.

See also

osContInit, osContStartQuery, osContGetQuery, osVoiceCheckWord, osVoiceClearDictionary, osVoiceControlGain, osVoiceCountSyllables, osVoiceGetReadData, osVoiceInit, osVoiceMaskDictionary, osVoiceSetWord, osVoiceStartReadData, and osVoiceStopReadData

Revision History

1999/04/30 Changed Format