Developer World
Spresense SDK Library v3.2.0-ebc0364
audio_high_level_api.h File Reference

CXD5602 Audio High Level API. More...

#include <sdk/config.h>
#include "audio/audio_command_id.h"
#include "audio/audio_common_defs.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  AudioCommandHeader
 
struct  AudioResultHeader
 
struct  SetMicMapParam
 
struct  InitMicGainParam
 
struct  InitI2SParam
 
struct  InitOutputSelectParam
 
struct  InitDNCParam
 
struct  InitClearStereoParam
 
struct  SetVolumeParam
 
struct  SetVolumeMuteParam
 
struct  SetBeepParam
 
struct  PowerOnParam
 
struct  SetRenderingClkParam
 
struct  InitSpDrvModeParam
 
struct  AsThroughPath
 
struct  AsSetThroughPathParam
 
struct  AsInitMixerParam
 
struct  AsPlayerClockRecovery
 
struct  AsInitMediaPlayerPost
 
struct  AsSetMediaPlayerPost
 
struct  AsInitMicFrontEnd
 
struct  AudioCommand
 
struct  NotifyStatus
 
struct  StatusChangedParam
 
struct  ErrorResponseParam
 
struct  AudioResult
 
struct  AudioSubSystemIDs
 

Macros

#define AS_ECODE_OK   0x00
 Response OK.
 
#define AS_ECODE_STATE_VIOLATION   0x01
 State Violation.
 
#define AS_ECODE_PACKET_LENGTH_ERROR   0x02
 Packet Length Error.
 
#define AS_ECODE_COMMAND_CODE_ERROR   0x03
 Command Code Error.
 
#define AS_ECODE_COMMAND_NOT_SUPPOT   0x04
 Not Suppot Command.
 
#define AS_ECODE_AUDIO_POWER_ON_ERROR   0x05
 Audio PowerOn Error.
 
#define AS_ECODE_AUDIO_POWER_OFF_ERROR   0x06
 Audio PowerOff Error.
 
#define AS_ECODE_DSP_LOAD_ERROR   0x07
 DSP Load Error.
 
#define AS_ECODE_DSP_UNLOAD_ERROR   0x08
 DSP Unload Error.
 
#define AS_ECODE_DSP_VERSION_ERROR   0x09
 DSP Version Error.
 
#define AS_ECODE_DSP_EXEC_ERROR   0x3b
 DSP Exec Error.
 
#define AS_ECODE_DSP_STOP_ERROR   0x3c
 DSP Stop Error.
 
#define AS_ECODE_DSP_SET_ERROR   0x3d
 DSP set Error.
 
#define AS_ECODE_SET_AUDIO_DATA_PATH_ERROR   0x0A
 Set Audio Data Path Error.
 
#define AS_ECODE_CLEAR_AUDIO_DATA_PATH_ERROR   0x0B
 Clear Audio Data Path Error.
 
#define AS_ECODE_NOT_AUDIO_DATA_PATH   0x0C
 Not Audio Data Path.
 
#define AS_ECODE_DECODER_LIB_INITIALIZE_ERROR   0x0D
 Decoder Library Initialize Error.
 
#define AS_ECODE_ENCODER_LIB_INITIALIZE_ERROR   0x0E
 Encoder Library Initialize Error.
 
#define AS_ECODE_FILTER_LIB_INITIALIZE_ERROR   0x0F
 Filter Library Initialize Error.
 
#define AS_ECODE_DUMP_INITIALIZE_ERROR   0x10
 Dump Initialize Error.
 
#define AS_ECODE_COMMAND_PARAM_CODEC_TYPE   0x11
 Parameter Codec Type Error.
 
#define AS_ECODE_COMMAND_PARAM_AREA_INSUFFICIENT   0x12
 Parameter Area Insufficient Error.
 
#define AS_ECODE_COMMAND_PARAM_CHANNEL_NUMBER   0x13
 Parameter Channel Number Error.
 
#define AS_ECODE_COMMAND_PARAM_SAMPLING_RATE   0x14
 Parameter Sampling Rate Error.
 
#define AS_ECODE_COMMAND_PARAM_BIT_RATE   0x15
 Parameter Bit Rate Error.
 
#define AS_ECODE_COMMAND_PARAM_BIT_LENGTH   0x16
 Parameter Bit Length Error.
 
#define AS_ECODE_COMMAND_PARAM_COMPLEXITY   0x17
 Parameter Complexity Error.
 
#define AS_ECODE_COMMAND_PARAM_ACTIVE_PLAYER   0x18
 Parameter Active Player Error.
 
#define AS_ECODE_COMMAND_PARAM_INPUT_DEVICE   0x19
 Parameter Input Device Error.
 
#define AS_ECODE_COMMAND_PARAM_OUTPUT_DEVICE   0x1A
 ParameterOutput Device Error.
 
#define AS_ECODE_COMMAND_PARAM_INPUT_HANDLER   0x1B
 Parameter Input Handler Error.
 
#define AS_ECODE_COMMAND_PARAM_OUTPUT_HANDLER   0x1C
 Parameter Output Handler Error.
 
#define AS_ECODE_COMMAND_PARAM_CALLBACK   0x1D
 Parameter Callback Error.
 
#define AS_ECODE_COMMAND_PARAM_FUNCTION_ENABLE   0x1E
 Parameter Function Enable Error.
 
#define AS_ECODE_COMMAND_PARAM_CONFIG_TABLE   0x1F
 Parameter Config Table Error.
 
#define AS_ECODE_COMMAND_PARAM_WITH_MFE   0x20
 Parameter With MFE Error.
 
#define AS_ECODE_COMMAND_PARAM_WITH_MPP   0x21
 Parameter With MPP Error.
 
#define AS_ECODE_COMMAND_PARAM_OUTPUT_DATE   0x22
 Parameter Output Data Error.
 
#define AS_ECODE_COMMAND_PARAM_SELECT_MIC   0x23
 Parameter Select MIC Error.
 
#define AS_ECODE_COMMAND_PARAM_MIC_GAIN   0x24
 Parameter MIC Gain Error.
 
#define AS_ECODE_COMMAND_PARAM_I2S_ID   0x25
 Parameter I2S Id Error.
 
#define AS_ECODE_COMMAND_PARAM_BYPASS_MODE   0x26
 Parameter Bypass Mode Error.
 
#define AS_ECODE_COMMAND_PARAM_VOLLUME   0x27
 Parameter Vollume Error.
 
#define AS_ECODE_COMMAND_PARAM_INPUT_DB   0x28
 Parameter Input DB Error.
 
#define AS_ECODE_COMMAND_PARAM_MASTER_DB   0x29
 Parameter Master DB Error.
 
#define AS_ECODE_COMMAND_PARAM_BEEP_FREQ   0x2A
 Parameter Beep Freq Error

 
#define AS_ECODE_DMAC_INITIALIZE_ERROR   0x2B
 DMAC Initialize Error.
 
#define AS_ECODE_DMAC_READ_ERROR   0x2C
 DMAC Read Error.
 
#define AS_ECODE_DMAC_WRITE_ERROR   0x2D
 DMAC Write Error.
 
#define AS_ECODE_CHECK_MEMORY_POOL_ERROR   0x2E
 Check Memory Pool Error.
 
#define AS_ECODE_SIMPLE_FIFO_UNDERFLOW   0x2F
 SimpleFIFO Underflow.
 
#define AS_ECODE_SET_MIC_GAIN_ERROR   0x30
 Set Mic Gain Error.
 
#define AS_ECODE_SET_I2S_PARAM_ERROR   0x31
 Set I2S Param Error.
 
#define AS_ECODE_SET_OUTPUT_SELECT_ERROR   0x32
 Set Output Select Error.
 
#define AS_ECODE_INIT_CLEAR_STEREO_ERROR   0x33
 Init Clear Stereo Error.
 
#define AS_ECODE_SET_VOLUME_ERROR   0x34
 Set Volume Error.
 
#define AS_ECODE_SET_VOLUME_MUTE_ERROR   0x35
 Set Volume Mute Error.
 
#define AS_ECODE_SET_BEEP_ERROR   0x36
 Set Beep Error.
 
#define AS_ECODE_QUEUE_OPERATION_ERROR   0x37
 Internal Queue Operation Error.
 
#define AS_ECODE_INTERNAL_COMMAND_CODE_ERROR   0x38
 Internal Command Code Error.
 
#define AS_ECODE_COMMAND_PARAM_RENDERINGCLK   0x39
 Parameter RenderingClk Error.
 
#define AS_ECODE_SET_RENDERINGCLK_ERROR   0x3A
 Set Rendering Clock Error.
 
#define AS_ECODE_COMMAND_PARAM_INITSPDRVMODE   0x3B
 Parameter InitSpDrvMode Error.
 
#define AS_ECODE_COMMAND_PARAM_SETSPDRVMODE   AS_ECODE_COMMAND_PARAM_INITSPDRVMODE
 
#define AS_ECODE_SET_MICMAP_ERROR   0x3D
 Set Mic Map Error.
 
#define AS_ECODE_OBJECT_NOT_AVAILABLE_ERROR   0x3E
 Audio SW object cannot available Error.
 
#define AS_ECODE_OSCILLATOR_LIB_INITIALIZE_ERROR   0x3F
 Oscillator Library Initialize Error.
 
#define SetSpDrvModeParam   InitSpDrvModeParam /* old command name */
 
Reslt Code Packet length
#define LENGTH_AUDRLT   2
 
#define LENGTH_AUDRLT_ERRORRESPONSE_MAX   8
 
#define LENGTH_AUDRLT_ERRORRESPONSE_MIN   5
 
Packet length of command
#define LENGTH_GETSTATUS   2
 GetStatus command (AUDCMD_GETSTATUS) packet length.
 
#define LENGTH_SET_PLAYER_STATUS   6
 SetPlayerStaus command (AUDCMD_SETPLAYERSTATUS) packet length.
 
#define LENGTH_SET_RECORDER_STATUS   4
 SetRecorderStatus command (AUDCMD_SETRECORDERSTATUS) packet length.
 
#define LENGTH_SET_RECOGNIZER_STATUS   4
 SetRecorderStatus command (AUDCMD_SETRECOGNIZERSTATUS) packet length.
 
#define LENGTH_SET_BASEBAND_STATUS   9
 SetBaseBandStatus command (AUDCMD_SETBASEBANDSTATUS) packet length.
 
#define LENGTH_SET_THROUGH_STATUS   3
 SetThroughStatus command (AUDCMD_SETTHROUGHSTATUS) packet length.
 
#define LENGTH_SET_READY_STATUS   2
 SetReadyStatus command (AUDCMD_SETREADYSTATUS) packet length.
 
#define LENGTH_POWERON   2
 PowerOn command (AUDCMD_POWERON) packet length.
 
#define LENGTH_SET_POWEROFF_STATUS   2
 PowerOn command (AUDCMD_SETPOWEROFFSTATUS) packet length.
 
#define LENGTH_SETMICMAP   4
 SetMicMap command (AUDCMD_SETMICMAP) packet length.
 
#define LENGTH_INITMICGAIN   5
 InitMicGain command (AUDCMD_INITMICGAIN) packet length.
 
#define LENGTH_INITI2SPARAM   3
 InitI2SParam command (AUDCMD_INITI2SPARAM) packet length.
 
#define LENGTH_INITDEQPARAM   8
 InitDEQParam command (AUDCMD_INITDEQPARAM) packet length.
 
#define LENGTH_INITOUTPUTSELECT   2
 InitOutputSelect command (AUDCMD_INITOUTPUTSELECT) packet length.
 
#define LENGTH_INITDNCPARAM   2
 InitDNCParam command (AUDCMD_INITDNCPARAM) packet length.
 
#define LENGTH_INITCLEARSTEREO   2
 InitClearStereo command (AUDCMD_INITCLEARSTEREO) packet length.
 
#define LENGTH_SETVOLUME   3
 SetVolume command (AUDCMD_SETVOLUME) packet length.
 
#define LENGTH_SETVOLUMEMUTE   2
 SetVolumeMute command (AUDCMD_SETVOLUMEMUTE) packet length.
 
#define LENGTH_SETBEEPPARAM   3
 SetBeep command (AUDCMD_SETBEEPPARAM) packet length.
 
#define LENGTH_SETRENDERINGCLK   2
 SetRenderingClk command ("AUDCMD_SETRENDERINGCLK)packet length.
 
#define LENGTH_INIT_SOUNDEFFECT   3
 InitSoundEffect command ("AUDCMD_INITSOUNDEFFECT)packet length.
 
#define LENGTH_START_SOUNDEFFECT   2
 StartSoundEffect command ("AUDCMD_STARTSOUNDEFFECT)packet length.
 
#define LENGTH_STOP_SOUNDEFFECT   2
 StopSoundEffect command ("AUDCMD_STOPSOUNDEFFECT)packet length.
 
#define LENGTH_SET_THROUGH_PATH   4
 SetThroughPath command ("AUDCMD_SETTHROUGHPATH)packet length.
 
#define LENGTH_INITSPDRVMODE   2
 InitSpDrvMode command ("AUDCMD_INITSPDRVMODE)packet length.
 
#define LENGTH_SETSPDRVMODE   LENGTH_INITSPDRVMODE /* old command name */
 

Enumerations

enum  AsI2sId { AS_I2S1 , AS_I2S2 }
 
enum  AsI2SBypassMode { AS_I2S_BYPASS_MODE_DISABLE , AS_I2S_BYPASS_MODE_ENABLE }
 
enum  AsOutDevice { AS_OUT_OFF , AS_OUT_SP , AS_OUT_I2S }
 
enum  AsDncMode { AS_DNC_MODE_A , AS_DNC_MODE_B , AS_DNC_MODE_C }
 InitDNCParam Command (AUDCMD_INITDNCPARAM) parameter. More...
 
enum  AsClkMode { AS_CLKMODE_NORMAL , AS_CLKMODE_HIRES }
 
enum  AsEnableSoundEffectFunc { AS_DISABLE_SOUNDEFFECT = 0 , AS_ENABLE_SOUNDEFFECT , AS_SOUNDEFFECT_NUM }
 
enum  AsStartSoundEffectMode { AS_STARTSOUNDEFFECT_NORMAL = 0 , AS_STARTSOUNDEFFECT_INFINITE , AS_STARTSOUNDEFFECT_MODE_NUM }
 
enum  AsThroughPathIn {
  AS_THROUGH_PATH_IN_MIC = 0 , AS_THROUGH_PATH_IN_I2S1 , AS_THROUGH_PATH_IN_I2S2 , AS_THROUGH_PATH_IN_MIXER ,
  AS_THROUGH_PATH_IN_NUM
}
 
enum  AsThroughPathOut {
  AS_THROUGH_PATH_OUT_MIXER1 = 0 , AS_THROUGH_PATH_OUT_MIXER2 , AS_THROUGH_PATH_OUT_I2S1 , AS_THROUGH_PATH_OUT_I2S2 ,
  AS_THROUGH_PATH_OUT_NUM
}
 
enum  AsSpDrvMode {
  AS_SP_DRV_MODE_LINEOUT = 0 , AS_SP_DRV_MODE_1DRIVER , AS_SP_DRV_MODE_2DRIVER , AS_SP_DRV_MODE_4DRIVER ,
  AS_SP_DRV_MODE_NUM
}
 
enum  AsFrontendDataDest { AsMicFrontendDataToRecorder = 0 , AsMicFrontendDataToRecognizer }
 
enum  AsMngStatus {
  AS_MNG_STATUS_READY = 0 , AS_MNG_STATUS_BASEBAND , AS_MNG_STATUS_PLAYER , AS_MNG_STATUS_RECORDER ,
  AS_MNG_STATUS_RECOGNIZER , AS_MNG_STATUS_POWEROFF , AS_MNG_STATUS_THROUGH , AS_MNG_STATUS_NUM
}
 
enum  AsMngSubStatus {
  AS_MNG_SUB_STATUS_NONE = 0 , AS_MNG_SUB_STATUS_PLAYREADY , AS_MNG_SUB_STATUS_PLAYACTIVE , AS_MNG_SUB_STATUS_PLAYPAUSE ,
  AS_MNG_SUB_STATUS_RECORDERREADY , AS_MNG_SUB_STATUS_RECORDERACTIVE , AS_MNG_SUB_STATUS_RECOGNIZERREADY , AS_MNG_SUB_STATUS_RECOGNIZERACTIVE ,
  AS_MNG_SUB_STATUS_BASEBANDREADY , AS_MNG_SUB_STATUS_BASEBANDACTIVE , AS_MNG_SUB_STATUS_WAITCMDWORD , AS_MNG_SUB_STATUS_NUM
}
 
enum  AsVadStatus { AS_VAD_STATUS_OUT_OF_VOICE_SECTION = 0 , AS_VAD_STATUS_INSIDE_VOICE_SECTION , AS_VAD_STATUS_NUM }
 
enum  AsStatusChangedSts {
  AS_STATUS_CHANGED_STS_READY = 0 , AS_STATUS_CHANGED_STS_BASEBAND , AS_STATUS_CHANGED_STS_PLAYER , AS_STATUS_CHANGED_STS_RECODER ,
  AS_STATUS_CHANGED_STS_POWEROFF , AS_STATUS_CHANGED_STS_THROUGH , AS_STATUS_CHANGED_STS_NUM
}
 
enum  AsErrorCode_e { AS_ERR_CODE_OK = 0 , AS_ERR_CODE_TASK_CREATE = -1 , AS_ERR_CODE_ILLEGAL_STATE = -2 }
 
enum  AsVolumeMute { AS_VOLUMEMUTE_HOLD , AS_VOLUMEMUTE_UNMUTE , AS_VOLUMEMUTE_MUTE , AS_VOLUMEMUTE_NUM }
 
enum  asBeepEn { AS_BEEPEN_DISABLE , AS_BEEPEN_ENABLE , AS_BEEPEN_NUM }
 

Functions

int AS_SendAudioCommand (AudioCommand *packet)
 Send Audio Command. More...
 
int AS_ReceiveAudioResult (AudioResult *packet)
 Receive Audio Result. More...
 
int AS_ReceiveAudioResult (FAR AudioResult *packet, uint8_t id, uint32_t tmo)
 Receive Audio Result for multithread. More...
 
int AS_CreateAudioManager (AudioSubSystemIDs ids, AudioAttentionCb att_cb)
 Activate AudioSubSystem. More...
 
 __attribute__ ((deprecated("\nDeprecated attention callback type is used. \ \nPlease use \"AudioAttentionCb\" as callback type. \ \n"))) int AS_CreateAudioManager(AudioSubSystemIDs ids
 Activate AudioSubSystem[Deprecated] This API is to make it compatible with old application. Will delete most application seems to migrate to new API. More...
 
int AS_DeleteAudioManager (void)
 Deactivate AudioSubSystem. More...
 

Variables

obs_AudioAttentionCb obs_att_cb
 

Detailed Description

CXD5602 Audio High Level API.

Author
CXD5602 Audio SW Team