📄 audio_api.h
字号:
/****************************************************************************/
/* */
/* File Name: audio_api.h */
/* */
/* Purpose: This file contains data structures and functions prototypes */
/* used to send events to the AUDIO SWE. */
/* */
/* Version 0.1 */
/* */
/* Date Modification */
/* ------------------------------------ */
/* 18 May 2001 Create */
/* */
/* Author Francois Mazard - Stephanie Gerthoux */
/* */
/* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
/****************************************************************************/
#ifndef __AUDIO_API_H_
#define __AUDIO_API_H_
#ifdef __cplusplus
extern "C"
{
#endif
#define AUDIO_EVENTS_MASK (0x3000)
#define AUDIO_EVENT_EXTERN (0x0C00)
/* Immediat return */
typedef INT8 T_AUDIO_RET;
/* possible values */
#define AUDIO_OK (0)
#define AUDIO_ERROR (-1)
#define AUDIO_MODE_ERROR (-2)
/* Bad acquisition of the word. The word is too long or too short */
#define AUDIO_BAD_ACQUISITION (-3)
/* The DSP task to acquire the word takes to much time */
#define AUDIO_TIME_OUT (-4)
/* Bad update of the model. The model from the database is too different */
/* than the model built during the acquisition. */
#define AUDIO_BAD_UPDATE (-5)
/* This word is out of vocabulary or the best words are too close */
#define AUDIO_BAD_RECOGNITION (-6)
/* A word generated by the CTO algorithm is the best word. */
#define AUDIO_CTO_WORD (-7)
/* The best word isn't the word to update. */
#define AUDIO_CHECK_ERROR (-8)
#define AUDIO_NOT_ENOUGH_OSCILLATOR (-9)
/******************************* KEY BEEP REGISTRATION *****************************/
/* Definition of no_beep */
#define NO_BEEP (0)
/* Parameters */
typedef struct
{
UINT16 frequency_beep[2]; /* Frequency of the 2 beeps */
INT8 amplitude_beep[2]; /* Amplitude of the 2 beeps */
UINT16 duration;
} T_AUDIO_KEYBEEP_PARAMETER;
/* Prototype */
T_AUDIO_RET audio_keybeep_start (T_AUDIO_KEYBEEP_PARAMETER parameter,
T_RV_RETURN return_path);
/* Event return */
#define AUDIO_KEYBEEP_STATUS_MSG (0x0001 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
} T_AUDIO_KEYBEEP_STATUS;
/* Prototype */
T_AUDIO_RET audio_keybeep_stop (T_RV_RETURN return_path);
/******************************* TONES REGISTRATION *****************************/
/* Definition of no_tone and tone_infinite */
#define NO_TONE (0)
#define TONE_INFINITE (0xFFFF)
/* Parameters */
typedef struct
{
UINT16 start_tone; /* start date of the tone */
UINT16 stop_tone; /* stop date of the tone */
UINT16 frequency_tone; /* frequency of the tone */
INT8 amplitude_tone; /* amplitude of the tone */
} T_AUDIO_TONE_DESC;
typedef struct
{
T_AUDIO_TONE_DESC tones[3]; /* Description of the 3 tones */
UINT16 frame_duration; /* Duration of the tones frame */
UINT16 sequence_duration; /* Duration of the sequence */
UINT16 period_duration; /* Duration of the period */
UINT16 repetition; /* number of period */
} T_AUDIO_TONES_PARAMETER;
/* Prototype */
T_AUDIO_RET audio_tones_start (T_AUDIO_TONES_PARAMETER* p_parameter,
T_RV_RETURN return_path);
/* Event return */
#define AUDIO_TONES_STATUS_MSG (0x0002 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
} T_AUDIO_TONES_STATUS;
/* Prototype */
T_AUDIO_RET audio_tones_stop (T_RV_RETURN return_path);
/******************************* AUDIO DRIVER REGISTRATION ************************/
T_AUDIO_RET audio_driver_start_session(UINT8 channel_id, T_RV_RETURN notification_return_path);
T_AUDIO_RET audio_driver_stop_session(UINT8 channel_id);
T_AUDIO_RET audio_driver_free_session(UINT8 channel_id, T_RV_RETURN return_path);
T_AUDIO_RET audio_driver_get_play_buffer(UINT8 channel_id, UINT8 **pp_buffer);
T_AUDIO_RET audio_driver_play_buffer(UINT8 channel_id, UINT8 *p_buffer);
#define AUDIO_DRIVER_INIT_STATUS_MSG (0x0003 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
UINT8 channel_id;
UINT8 session_id;
} T_AUDIO_DRIVER_INIT_STATUS;
#define AUDIO_VM_AMR_RECORD_SESSION_ID (10)
#define AUDIO_VM_AMR_PLAY_SESSION_ID (11)
#define AUDIO_DRIVER_NOTIFICATION_MSG (0x0004 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR header;
UINT8 channel_id;
UINT16 *p_buffer;
}
T_AUDIO_DRIVER_NOTIFICATION;
#define AUDIO_DRIVER_LAST_NOTIFICATION_MSG (0x0005 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR header;
UINT8 channel_id;
UINT16 *p_buffer;
UINT32 recorded_size;
}
T_AUDIO_DRIVER_LAST_NOTIFICATION;
#define AUDIO_DRIVER_STATUS_MSG (0x0006 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
UINT8 status_type;
UINT8 channel_id;
} T_AUDIO_DRIVER_STATUS;
#define AUDIO_START_STATUS (1)
#define AUDIO_STOP_STATUS (2)
#define AUDIO_FREE_STATUS (3)
typedef struct
{
UINT16 buffer_size;
UINT8 nb_buffer;
} T_AUDIO_DRIVER_PARAMETER;
/******************************* MELODY AND VOICE MEMO REGISTRATION *****************************/
/* Definition of the maximum size of the path name */
#define AUDIO_PATH_NAME_MAX_SIZE (20)
/* Definition of the maximum number of instruments */
#define AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT (128)
/******************************* MELODY REGISTRATION *****************************/
/* Definition of loopback melody mode */
#define AUDIO_MELODY_NO_LOOPBACK (0)
#define AUDIO_MELODY_LOOPBACK (1)
/* Definition ofthe mode of melody */
#define AUDIO_MELODY_GAME_MODE (0)
#define AUDIO_MELODY_NORMAL_MODE (1)
/******** Melody E1 ********/
/* Parameters */
typedef struct
{
char melody_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */
BOOLEAN loopback; /* the melody is played indefinitely */
BOOLEAN melody_mode; /* mode of the melody */
} T_AUDIO_MELODY_E1_PARAMETER;
typedef struct
{
char melody_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */
}
T_AUDIO_MELODY_E1_STOP_PARAMETER;
/* Prototype */
T_AUDIO_RET audio_melody_E1_start (T_AUDIO_MELODY_E1_PARAMETER *parameter,
T_RV_RETURN return_path);
/* Event return */
#define AUDIO_MELODY_E1_STATUS_MSG (0x0007 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
} T_AUDIO_MELODY_E1_STATUS;
/* Prototype */
T_AUDIO_RET audio_melody_E1_stop (T_AUDIO_MELODY_E1_STOP_PARAMETER *parameter,
T_RV_RETURN return_path);
/******** Melody E2 ********/
/* Parameters */
typedef struct
{
char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */
BOOLEAN E2_loopback; /* the melody is played indefinitely */
BOOLEAN melody_E2_mode; /* mode of the melody (Game/Normal)*/
} T_AUDIO_MELODY_E2_PARAMETER;
typedef struct
{
char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */
} T_AUDIO_MELODY_E2_STOP_PARAMETER;
typedef struct
{
char melody_E2_file_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */
} T_AUDIO_MELODY_E2_LOAD_FILE_INSTR_PARAMETER;
/* Prototype */
T_AUDIO_RET audio_melody_E2_load_file_instruments (
T_AUDIO_MELODY_E2_LOAD_FILE_INSTR_PARAMETER *p_parameter);
T_AUDIO_RET audio_melody_E2_start (T_AUDIO_MELODY_E2_PARAMETER *p_parameter,
T_RV_RETURN return_path);
T_AUDIO_RET audio_melody_E2_stop (T_AUDIO_MELODY_E2_STOP_PARAMETER *parameter,
T_RV_RETURN return_path);
/* Event return */
/* For melody_E2 */
#define AUDIO_MELODY_E2_STATUS_MSG (0x0008 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
} T_AUDIO_MELODY_E2_STATUS;
/******************************* VOICE MEMO REGISTRATION *****************************/
/* ---------------------------- */
/* Voice memo PLAY */
/* ---------------------------- */
/* Parameters */
typedef struct
{
char memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo play */
} T_AUDIO_VM_PLAY_PARAMETER;
/* Prototype */
T_AUDIO_RET audio_vm_play_start(T_AUDIO_VM_PLAY_PARAMETER *p_parameter,
T_RV_RETURN return_path);
/* Event return */
#define AUDIO_VM_PLAY_STATUS_MSG (0x0009 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
} T_AUDIO_VM_PLAY_STATUS;
/* Prototype */
T_AUDIO_RET audio_vm_play_stop (T_RV_RETURN return_path);
/* ---------------------------- */
/* Voice memo RECORD */
/* ---------------------------- */
/* Definition of compression mode */
#define AUDIO_VM_NO_COMPRESSION_MODE (0)
#define AUDIO_VM_COMPRESSION_MODE (1)
/* Parameters */
typedef struct
{
char memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo play */
UINT32 memo_duration; /* maximum duration of the voice memo */
BOOL compression_mode; /* activate the compression */
UINT16 microphone_gain; /* recording gain applies to microphone */
UINT16 network_gain; /* gain applies to the network voice */
} T_AUDIO_VM_RECORD_PARAMETER;
/* Prototype */
T_AUDIO_RET audio_vm_record_start( T_AUDIO_VM_RECORD_PARAMETER *p_record_parameter,
T_AUDIO_TONES_PARAMETER *p_tones_parameter,
T_RV_RETURN return_path);
/* Event return */
#define AUDIO_VM_RECORD_STATUS_MSG (0x000A | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
typedef struct
{
T_RV_HDR os_hdr;
INT8 status;
UINT16 recorded_duration;
} T_AUDIO_VM_RECORD_STATUS;
/* Prototype */
T_AUDIO_RET audio_vm_record_stop (T_RV_RETURN return_path);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -