N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## osVoiceInit

Syntax

    #include <ultra64.h>

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

Explanation
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. Please see the N64 Online Programming Manual, Section 26.8.4.2, "Status When Voice Recognition is Running," for details on each 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_ERRO_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. Write your program so that this error does not occur when development is completed.

See Also
osContInit
osVoiceCheckWord
osVoiceClearDictionary
osVoiceControlGain
osVoiceCountSyllables
osVoiceGetReadData
osVoiceMaskDictionary
osVoiceSetWord
osVoiceStartReadData
osVoiceStopReadData

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998