⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 audio_api.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 3 页
字号:
      /******************************* VOICE MEMO DRIVER AMR REGISTRATION *****************************/

      /* ---------------------------- */
      /*     Voice memo AMR PLAY      */
      /* ---------------------------- */

      /* Parameters */
      typedef struct
      {
        char    memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo AMR play */
      } T_AUDIO_AMR_PLAY_FROM_FFS_PARAMETER;

      typedef struct
      {
        UINT8  *p_buffer; /* pointer on buffer to copy from */
		UINT16 buffer_size; /* size of buffer */
      } T_AUDIO_AMR_PLAY_FROM_RAM_PARAMETER;

      #define AUDIO_AMR_PLAY_FROM_MEM_STATUS_MSG            (0x000B | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
      } T_AUDIO_AMR_PLAY_STATUS;

      /* Prototype */
      T_AUDIO_RET audio_amr_play_from_ffs_start (T_AUDIO_AMR_PLAY_FROM_FFS_PARAMETER *p_record_parameter,
                                                 T_RV_RETURN return_path);
      T_AUDIO_RET audio_amr_play_from_ffs_stop  (void);

      T_AUDIO_RET audio_amr_play_from_ram_start (T_AUDIO_AMR_PLAY_FROM_RAM_PARAMETER *p_record_parameter,
                                                 T_RV_RETURN return_path);
      T_AUDIO_RET audio_amr_play_from_ram_stop  (void);

      T_AUDIO_RET audio_driver_init_vm_amr_play_session(T_AUDIO_DRIVER_PARAMETER *p_driver_parameter, T_RV_RETURN return_path);

      /* ---------------------------- */
      /*     Voice memo AMR RECORD    */
      /* ---------------------------- */

      /* Definition of compression mode */
      #define AUDIO_AMR_NO_COMPRESSION_MODE       (0)
      #define AUDIO_AMR_COMPRESSION_MODE          (1)

      /* Definition of AMR vocoders */
      #define AUDIO_AMR_VOCODER_4_75              (0)
      #define AUDIO_AMR_VOCODER_5_15              (1)
      #define AUDIO_AMR_VOCODER_5_90              (2)
      #define AUDIO_AMR_VOCODER_6_70              (3)
      #define AUDIO_AMR_VOCODER_7_40              (4)
      #define AUDIO_AMR_VOCODER_7_95              (5)
      #define AUDIO_AMR_VOCODER_10_2              (6)
      #define AUDIO_AMR_VOCODER_12_2              (7)

      /* Parameters */
      typedef struct
      {
        char    memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo AMR play */
        UINT32  memo_duration;    /* maximum duration of the voice memo */
        BOOL    compression_mode; /* activate the compression */
        UINT16  microphone_gain;  /* recording gain applies to microphone */
        UINT8   amr_vocoder;      /* AMR codec */
      } T_AUDIO_AMR_RECORD_TO_FFS_PARAMETER;

      typedef struct
      {
        UINT8   *p_buffer; /* pointer on buffer to copy to, length must be > memo_duration */
        UINT32  memo_duration;    /* maximum duration of the voice memo */
        BOOL    compression_mode; /* activate the compression */
        UINT16  microphone_gain;  /* recording gain applies to microphone */
        UINT8   amr_vocoder;      /* AMR codec */
      } T_AUDIO_AMR_RECORD_TO_RAM_PARAMETER;

      /* Parameters */
      typedef struct
      {
        UINT32  memo_duration;    /* maximum duration of the voice memo */
        BOOL    compression_mode; /* activate the compression */
        UINT16  microphone_gain;  /* recording gain applies to microphone */
        UINT8   amr_vocoder;      /* AMR codec */
      } T_AUDIO_DRIVER_VM_AMR_RECORD_PARAMETER;

      #define AUDIO_AMR_RECORD_TO_MEM_STATUS_MSG               (0x000C | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
        UINT32    recorded_duration;
      } T_AUDIO_AMR_RECORD_STATUS;

      /* Prototype */
      T_AUDIO_RET audio_amr_record_to_ffs_start (T_AUDIO_AMR_RECORD_TO_FFS_PARAMETER *p_record_parameter,
                                                 T_RV_RETURN return_path);
      T_AUDIO_RET audio_amr_record_to_ffs_stop  (void);

      T_AUDIO_RET audio_amr_record_to_ram_start (T_AUDIO_AMR_RECORD_TO_RAM_PARAMETER *p_record_parameter,
                                                 T_RV_RETURN return_path);
      T_AUDIO_RET audio_amr_record_to_ram_stop  (void);

      T_AUDIO_RET audio_driver_init_vm_amr_record_session(T_AUDIO_DRIVER_VM_AMR_RECORD_PARAMETER *p_record_parameter,
                                                          T_AUDIO_DRIVER_PARAMETER *p_driver_parameter,
                                                          T_RV_RETURN return_path);

      /******************************* AUDIO SPEECH RECOGNITION REGISTRATION ************************/

      /* ---------------------------- */
      /*     Start Enrollment         */
      /* ---------------------------- */

      /* Symbolic constant */
      #define AUDIO_SR_RECORD_SPEECH      (1)
      #define AUDIO_SR_NO_RECORD_SPEECH   (0)

      /* maximum number of vocabulary name */
      #define AUDIO_SR_MAX_VOCABULARY_NAME    (10)

      /* Parameters */
      typedef struct {
        char  enroll_name[AUDIO_PATH_NAME_MAX_SIZE];  /* name and path of the word to enroll */
        BOOL  record_speech;  /* speech sample must be recorded or not */
      }T_AUDIO_SR_ENROLL_PARAMETER;

      /* Prototype */
      T_AUDIO_RET audio_sr_enroll_start (T_AUDIO_SR_ENROLL_PARAMETER *p_parameter,
                                         T_RV_RETURN return_path);

      /* Event return */
      #define AUDIO_SR_ENROLL_STATUS_MSG              (0x000D | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
      } T_AUDIO_SR_ENROLL_STATUS;

      /* ---------------------------- */
      /*     Stop Enrollment          */
      /* ---------------------------- */

      /* Symbolic constant */

      /* Parameters */

      /* Prototype */
      T_AUDIO_RET audio_sr_enroll_stop ( T_RV_RETURN return_path );

      /* Event return */

      /* ---------------------------- */
      /*     Start Update             */
      /* ---------------------------- */

      /* Symbolic constant */

      /* Parameters */
      typedef struct {
        char  update_name[AUDIO_PATH_NAME_MAX_SIZE];  /* name and path of the word to update */
        BOOL  record_speech;  /* speech sample must be recorded or not */
      }T_AUDIO_SR_UPDATE_PARAMETER;

      /* Prototype */
      T_AUDIO_RET audio_sr_update_start (T_AUDIO_SR_UPDATE_PARAMETER *p_parameter,
                                         T_RV_RETURN return_path);

      /* Event return */
      #define AUDIO_SR_UPDATE_STATUS_MSG              (0x000E | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
      } T_AUDIO_SR_UPDATE_STATUS;

      /* ---------------------------- */
      /*     Stop Update              */
      /* ---------------------------- */

      /* Symbolic constant */

      /* Parameters */

      /* Prototype */
      T_AUDIO_RET audio_sr_update_stop ( T_RV_RETURN return_path );

      /* Event return */

      /* ---------------------------- */
      /*     Start Update             */
      /* ---------------------------- */

      /* Symbolic constant */

      /* Parameters */
      typedef struct {
        /* directory of the vocabulary database */
        char  database_directory[AUDIO_PATH_NAME_MAX_SIZE];
      }T_AUDIO_SR_RECO_PARAMETER;

      /* Prototype */
      T_AUDIO_RET audio_sr_reco_start (T_AUDIO_SR_RECO_PARAMETER *p_parameter,
                                         T_RV_RETURN return_path);

      /* Event return */
      #define AUDIO_SR_RECO_STATUS_MSG              (0x000F | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct {
        T_RV_HDR  os_hdr;
        /* status about the recognition task */
        INT8      status;
        /*path ofthe recognized word */
        char word_recognized[AUDIO_PATH_NAME_MAX_SIZE];
      } T_AUDIO_SR_RECO_STATUS;

      /* ---------------------------- */
      /*     Stop reco                */
      /* ---------------------------- */

      /* Symbolic constant */

      /* Parameters */

      /* Prototype */
      T_AUDIO_RET audio_sr_reco_stop ( T_RV_RETURN return_path );

      /* Event return */

      /******************************* AUDIO CONFIGURATION REGISTRATION *****************************/

      /******************/
      /*** Voice path ***/
      /******************/

      /* Parameters */

      /* Voice path selection */
      #define AUDIO_GSM_VOICE_PATH                (0)
      #define AUDIO_BLUETOOTH_CORDLESS_VOICE_PATH (1)
      #define AUDIO_BLUETOOTH_HEADSET             (2)
      #define AUDIO_DAI_ENCODER                   (12)
      #define AUDIO_DAI_DECODER                   (11)
      #define AUDIO_DAI_ACOUSTIC                  (14)

      /* Structure */
      /* audio path used */
      typedef UINT8 T_AUDIO_VOICE_PATH_SETTING;

      /********************************/
      /*** Microphone configuration ***/
      /********************************/

      /* Parameters */
      /* Mode */
      #define AUDIO_MICROPHONE_HANDHELD   (0)
      #define AUDIO_MICROPHONE_HANDFREE   (1)
      #define AUDIO_MICROPHONE_HEADSET    (2)

      /* gain */
      #define AUDIO_MICROPHONE_MUTE       (13)

      /* output_bias */
      #define AUDIO_MICROPHONE_OUTPUT_BIAS_2_0V  (0)
      #define AUDIO_MICROPHONE_OUTPUT_BIAS_2_5V  (1)

      /* extra gain */
      #define AUDIO_MICROPHONE_AUX_GAIN_28_2dB   (0)
      #define AUDIO_MICROPHONE_AUX_GAIN_4_6dB    (1)

      /* Structure */
      typedef struct
      {
        UINT16 coefficient[31];
      }
      T_AUDIO_FIR_COEF;

      typedef struct
      {
        /* gain of the microphone */
        INT8    gain;
        /* microphone output bias */
        INT8    output_bias;
        /* coefficients of the microphone FIR */
        T_AUDIO_FIR_COEF    fir;
      }
      T_AUDIO_MICROPHONE_MODE_HANDHELD;

      typedef struct {
        /* gain of the microphone */
        INT8    gain;
        /* extra gain of the microphone */
        INT8    extra_gain;
        /* microphone output bias */
        INT8    output_bias;
        /* coefficients of the microphone FIR */
        T_AUDIO_FIR_COEF    fir;
      }
      T_AUDIO_MICROPHONE_MODE_HANDFREE;

      typedef struct {
        /* gain of the microphone */
        INT8    gain;
        /* microphone output bias */
        INT8    output_bias;
        /* coefficients of the microphone FIR */
        T_AUDIO_FIR_COEF    fir;
      }
      T_AUDIO_MICROPHONE_MODE_HEADSET;

      typedef union
      {
        /* handheld mode parameters */
        T_AUDIO_MICROPHONE_MODE_HANDHELD handheld;
        /* handfree mode parameters */
        T_AUDIO_MICROPHONE_MODE_HANDFREE handfree;
        /* headset mode parameters */
        T_AUDIO_MICROPHONE_MODE_HEADSET  headset;
      }
      T_AUDIO_MICROPHONE_MODE;

      typedef struct
      {
        /* mode of the microphone */
        INT8                     mode;
        /* Setting of the current mode */
        T_AUDIO_MICROPHONE_MODE  setting;
      }
      T_AUDIO_MICROPHONE_SETTING;

      /*****************************/
      /*** Speaker configuration ***/
      /*****************************/

      /* Paratemers */
      /* Mode*/
      #define AUDIO_SPEAKER_HANDHELD          (0)
      #define AUDIO_SPEAKER_HANDFREE          (1)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -