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

📄 audio_api.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 3 页
字号:
      #define AUDIO_SPEAKER_HEADSET           (2)
      #define AUDIO_SPEAKER_BUZZER            (3)
      #define AUDIO_SPEAKER_HANDHELD_HANDFREE (4)

      /* filter */
      #define AUDIO_SPEAKER_FILTER_ON   (0)
      #define AUDIO_SPEAKER_FILTER_OFF  (1)

      /* Buzzer */
      #define AUDIO_SPEAKER_BUZZER_ON   (0)
      #define AUDIO_SPEAKER_BUZZER_OFF  (1)

      /* Structure */
      typedef struct
      {
        /* gain of the speaker */
        INT8  gain;
        /* use the audio filter */
        INT8  audio_filter;
        /* coefficients of the speaker FIR */
        T_AUDIO_FIR_COEF    fir;
      }
      T_AUDIO_SPEAKER_MODE_HANDHELD;

      typedef struct
      {
        /* gain of the speaker */
        INT8   gain;
        /* use the audio filter */
        INT8   audio_filter;
        /* coefficients of the speaker FIR */
        T_AUDIO_FIR_COEF    fir;
      }
      T_AUDIO_SPEAKER_MODE_HANDFREE;

      typedef struct
      {
        /* gain of the speaker */
        INT8   gain;
        /* use the audio filter */
        INT8   audio_filter;
        /* coefficients of the speaker FIR */
        T_AUDIO_FIR_COEF    fir;
      }
      T_AUDIO_SPEAKER_MODE_HEADSET;

      typedef struct
      {
        /* activate the buzzer */
        INT8  activate;
      }
      T_AUDIO_SPEAKER_MODE_BUZZER;

      typedef struct
      {
        /* gain of the speaker */
        INT8   gain;
        /* use the audio filter */
        INT8   audio_filter;
        /* coefficients of the speaker FIR */
        T_AUDIO_FIR_COEF    fir;
      }
      T_AUDIO_SPEAKER_MODE_HANDHELD_HANDFREE;

      typedef union
      {
        /* handheld mode parameters */
        T_AUDIO_SPEAKER_MODE_HANDHELD handheld;
        /* handfree mode parameters */
        T_AUDIO_SPEAKER_MODE_HANDFREE handfree;
        /* headset mode parameters */
        T_AUDIO_SPEAKER_MODE_HEADSET  headset;
        /* buzzer mode parameters */
        T_AUDIO_SPEAKER_MODE_BUZZER   buzzer;
        /* handheld and handfree mode parameters */
        T_AUDIO_SPEAKER_MODE_HANDHELD_HANDFREE handheld_handfree;
      }
      T_AUDIO_SPEAKER_MODE;

      typedef struct
      {
        /* mode of the speaker */
        INT8                      mode;
        /* Setting of the current mode */
        T_AUDIO_SPEAKER_MODE      setting;
      }
      T_AUDIO_SPEAKER_SETTING;

      /********************************************/
      /*** Mirophone-Speaker loop configuration ***/
      /********************************************/

      /* sidetone */
      #define AUDIO_SIDETONE_OPEN             (-26)

      /* AEC enable */
      #define AUDIO_AEC_ENABLE                (0x0002)
      #define AUDIO_AEC_DISABLE               (0x0000)

      /* AEC visibility */
      #define AUDIO_AEC_VISIBILITY_ENABLE     (0x0200)
      #define AUDIO_AEC_VISIBILITY_DISABLE    (0x0000)

      /* AEC mode */
      #define AUDIO_SHORT_ECHO                (0x0200)
      #define AUDIO_LONG_ECHO                 (0x0000)

      /* echo suppression level */
    #if (L1_NEW_AEC)
      #define AUDIO_MAX_ECHO_0dB              (0x7FFF)
      #define AUDIO_MAX_ECHO_2dB              (0x65AA)
      #define AUDIO_MAX_ECHO_3dB              (0x59AD)
      #define AUDIO_MAX_ECHO_6dB              (0x4000)
      #define AUDIO_MAX_ECHO_12dB             (0x1FFF)
      #define AUDIO_MAX_ECHO_18dB             (0x0FFF)
      #define AUDIO_MAX_ECHO_24dB             (0x07FF)
    #else
      #define AUDIO_ECHO_0dB                  (0x0000)
      #define AUDIO_ECHO_6dB                  (0x0008)
      #define AUDIO_ECHO_12dB                 (0x0010)
      #define AUDIO_ECHO_18dB                 (0x0018)
    #endif

      /* noise suppression enable */
      #define AUDIO_NOISE_SUPPRESSION_ENABLE  (0x0004)
      #define AUDIO_NOISE_SUPPRESSION_DISABLE (0x0000)

      /* noise suppression level */
      #define AUDIO_NOISE_NO_LIMITATION       (0x0000)
      #define AUDIO_NOISE_6dB                 (0x0020)
      #define AUDIO_NOISE_12dB                (0x0040)
      #define AUDIO_NOISE_18dB                (0x0060)

      typedef struct
      {
        /* Enable the AEC */
        UINT16    aec_enable;
      #if (L1_NEW_AEC)
        BOOL   continuous_filtering;
        UINT16 granularity_attenuation;
        UINT16 smoothing_coefficient;
        UINT16 max_echo_suppression_level;
        UINT16 vad_factor;
        UINT16 absolute_threshold;
        UINT16 factor_asd_filtering;
        UINT16 factor_asd_muting;
        UINT16 aec_visibility; // UINT16 and not boolean because in L1, it is in aec_control
      #else
        /* Mode of the AEC */
        UINT16    aec_mode;
        /* level of the echo cancellation */
        UINT16    echo_suppression_level;
      #endif
        /* enable the noise suppression */
        UINT16    noise_suppression_enable;
        /* level of the noise suppression */
        UINT16    noise_suppression_level;
      }
      T_AUDIO_AEC_CFG;

      typedef struct
      {
        /* gain of the sidetone */
        INT8                          sidetone_gain;
        /* configuration of the acoustic echo cancellation */
        T_AUDIO_AEC_CFG               aec;
      }
      T_AUDIO_MICROPHONE_SPEAKER_LOOP_SETTING;

      /****************************************/
      /*      audio mode file struture        */
      /* this file is in the folder /AUDCFG/  */
      /* and has the extention .CFG           */
      /****************************************/
      typedef struct
      {
        /* group of setting to define the audio path used */
        T_AUDIO_VOICE_PATH_SETTING              audio_path_setting;
        /* group of setting to configure the audio path of the microphone */
        T_AUDIO_MICROPHONE_SETTING              audio_microphone_setting;
        /* group of setting to configure the audio path of the speaker */
        T_AUDIO_SPEAKER_SETTING                 audio_speaker_setting;
        /* group of setting to configure the audio mode involved */
        /* in tr microhpone and speaker loop */
        T_AUDIO_MICROPHONE_SPEAKER_LOOP_SETTING audio_microphone_speaker_loop_setting;
      }
      T_AUDIO_MODE;

      /****************************************/
      /*      audio volume file struture      */
      /* this file is in the folder /AUDCFG/  */
      /* and has the extention .VOL           */
      /****************************************/
      /* speaker volume action */
      #define AUDIO_SPEAKER_VOLUME_INCREASE     (0)
      #define AUDIO_SPEAKER_VOLUME_DECREASE     (1)
      #define AUDIO_SPEAKER_VOLUME_SET          (2)

      /* speaker volume value */
      #define AUDIO_SPEAKER_VOLUME_MUTE         (0)
      #define AUDIO_SPEAKER_VOLUME_24dB         (1)
      #define AUDIO_SPEAKER_VOLUME_18dB         (50)
      #define AUDIO_SPEAKER_VOLUME_12dB         (100)
      #define AUDIO_SPEAKER_VOLUME_6dB          (150)
      #define AUDIO_SPEAKER_VOLUME_0dB          (200)
      typedef struct
      {
        /* volume of the audio speaker */
        UINT8      audio_speaker_level;
      }
      T_AUDIO_SPEAKER_LEVEL;

      /******************/
      /* MMI family API */
      /******************/


      /* structure */
      /* maximum number of number of the filname characters */
      #define AUDIO_MODE_FILENAME_MAX_SIZE    (10)

      typedef struct
      {
        char  audio_mode_filename[AUDIO_MODE_FILENAME_MAX_SIZE];
      }
      T_AUDIO_MODE_LOAD;

      typedef struct
      {
        char  audio_mode_filename[AUDIO_MODE_FILENAME_MAX_SIZE];
      }
      T_AUDIO_MODE_SAVE;

      typedef struct
      {
        INT8    volume_action;
        UINT8   value;
      }
      T_AUDIO_SPEAKER_VOLUME;

      /* Prototypes of MMI family*/
      T_AUDIO_RET audio_mode_load   (T_AUDIO_MODE_LOAD  *p_parameter,
                                     T_RV_RETURN        return_path);

      T_AUDIO_RET audio_mode_save   (T_AUDIO_MODE_SAVE  *p_parameter,
                                     T_RV_RETURN        return_path);

      T_AUDIO_RET audio_speaker_volume ( T_AUDIO_SPEAKER_VOLUME volume,
                                         T_RV_RETURN            return_path);

      /* Event return of the MMI family API*/
      #define AUDIO_MODE_LOAD_DONE              (0x0010 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
      } T_AUDIO_LOAD_DONE;

      #define AUDIO_MODE_SAVE_DONE              (0x0011 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
      } T_AUDIO_SAVE_DONE;

      #define AUDIO_SPEAKER_VOLUME_DONE         (0x0012 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
      } T_AUDIO_VOLUME_DONE;


      /**********************/
      /* Full Access Family */
      /**********************/

      /* structure */
      typedef struct
      {
        UINT8   variable_indentifier;
        void    *data;
      }
      T_AUDIO_FULL_ACCESS_WRITE;

      typedef struct
      {
        UINT8   variable_indentifier;
        void    *data;
      }
      T_AUDIO_FULL_ACCESS_READ;

      /* parameter */
      #define AUDIO_PATH_USED                         (0)
      #define AUDIO_MICROPHONE_MODE                   (1)
      #define AUDIO_MICROPHONE_GAIN                   (2)
      #define AUDIO_MICROPHONE_EXTRA_GAIN             (3)
      #define AUDIO_MICROPHONE_OUTPUT_BIAS            (4)
      #define AUDIO_MICROPHONE_FIR                    (5)
      #define AUDIO_SPEAKER_MODE                      (6)
      #define AUDIO_SPEAKER_GAIN                      (7)
      #define AUDIO_SPEAKER_FILTER                    (8)
      #define AUDIO_SPEAKER_FIR                       (9)
      #define AUDIO_SPEAKER_BUZZER_STATE              (10)
      #define AUDIO_MICROPHONE_SPEAKER_LOOP_SIDETONE  (11)
      #define AUDIO_MICROPHONE_SPEAKER_LOOP_AEC       (12)
      #define AUDIO_SPEAKER_VOLUME_LEVEL              (13)


      /* prototype */
      T_AUDIO_RET audio_full_access_write (T_AUDIO_FULL_ACCESS_WRITE  *p_parameter,
                                            T_RV_RETURN                           return_path);

      T_AUDIO_RET audio_full_access_read (T_AUDIO_FULL_ACCESS_READ    *p_parameter);


      /* Event returned ofthe Full Access Family */
      #define AUDIO_FULL_ACCESS_WRITE_DONE              (0x0013 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK)
      typedef struct
      {
        T_RV_HDR  os_hdr;
        INT8      status;
      } T_AUDIO_FULL_ACCESS_WRITE_DONE;

    #ifdef __cplusplus
      }
    #endif

  #endif /* __AUDIO_API_H_ */


⌨️ 快捷键说明

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