| 1 | /****************************************************************************** |
|---|
| 2 | *_Copyright (c) 2009 Digital Stream Technology Inc. All Rights Reserved. |
|---|
| 3 | * |
|---|
| 4 | * Module: dsthalaud.h |
|---|
| 5 | * |
|---|
| 6 | * Description |
|---|
| 7 | * |
|---|
| 8 | * @author |
|---|
| 9 | * @version $Revision: 1.1 $ |
|---|
| 10 | * |
|---|
| 11 | ******************************************************************************/ |
|---|
| 12 | |
|---|
| 13 | #ifndef __DSTHAL_AUD_H__ |
|---|
| 14 | #define __DSTHAL_AUD_H__ |
|---|
| 15 | |
|---|
| 16 | /****************************************************************************** |
|---|
| 17 | * Audio Processor Type |
|---|
| 18 | ******************************************************************************/ |
|---|
| 19 | typedef enum { |
|---|
| 20 | DHL_AUDIO_STA323W = 1, |
|---|
| 21 | DHL_AUDIO_STA333W, |
|---|
| 22 | DHL_AUDIO_STA333BW |
|---|
| 23 | }DHL_AUD_PROC_TYPE; |
|---|
| 24 | |
|---|
| 25 | /****************************************************************************** |
|---|
| 26 | * DHL Headphone Callback Source |
|---|
| 27 | ******************************************************************************/ |
|---|
| 28 | typedef enum |
|---|
| 29 | { |
|---|
| 30 | HPCALLBACK_UNKNOWN=0, |
|---|
| 31 | HPCALLBACK_STATUS_CHANGE, /* Callback on acquisition start, DHL_FE_Start() */ |
|---|
| 32 | HPCALLBACK_MAX |
|---|
| 33 | } HPCallbackSource; |
|---|
| 34 | |
|---|
| 35 | typedef enum |
|---|
| 36 | { |
|---|
| 37 | HP_DETECT, |
|---|
| 38 | HP_UNDETECT |
|---|
| 39 | } HPNotificationState_t; |
|---|
| 40 | |
|---|
| 41 | typedef void (*P_DHL_HP_CALLBACK)(HPNotificationState_t eventSource, DS_U32 userArg); |
|---|
| 42 | |
|---|
| 43 | /****************************************************************************** |
|---|
| 44 | * DHL - Headphone Status/Configuration |
|---|
| 45 | ******************************************************************************/ |
|---|
| 46 | typedef struct tag_DHL_HP |
|---|
| 47 | { |
|---|
| 48 | /* Callback Functions */ |
|---|
| 49 | P_DHL_HP_CALLBACK fnHPCallback[HPCALLBACK_MAX-1]; |
|---|
| 50 | DS_U32 HPCallbackUserArg[HPCALLBACK_MAX-1]; |
|---|
| 51 | |
|---|
| 52 | DS_U32 hpThreadId; |
|---|
| 53 | volatile DS_BOOL bThreadActive; |
|---|
| 54 | HPNotificationState_t NotifyState; |
|---|
| 55 | |
|---|
| 56 | /* Platform/Project Specific fields */ |
|---|
| 57 | |
|---|
| 58 | } *P_DHL_HP, DHL_HP; |
|---|
| 59 | |
|---|
| 60 | /****************************************************************************** |
|---|
| 61 | * DHL Audio Configuration |
|---|
| 62 | ******************************************************************************/ |
|---|
| 63 | typedef struct tag_DHL_AUD_AUDIO |
|---|
| 64 | { |
|---|
| 65 | OS_MUTEX_ID Mutex; |
|---|
| 66 | |
|---|
| 67 | DS_U16 uVolLvl; // Audio Volume |
|---|
| 68 | DS_U16 uHPVolLvl; |
|---|
| 69 | int Balance; |
|---|
| 70 | int Treble; |
|---|
| 71 | int Bass; |
|---|
| 72 | DS_S32 iAudioDelay; // Audio Delay in msec. |
|---|
| 73 | |
|---|
| 74 | DS_BOOL bCurI2SMute; //current audio mixer mute |
|---|
| 75 | DS_BOOL bCurSpdifMute; //current spdif mute |
|---|
| 76 | DS_BOOL bCurAuxMute; |
|---|
| 77 | DHL_AUD_OUTPUT_FORMAT AudOutFormat; //audio output format - current audio output |
|---|
| 78 | DHL_AUD_OUTPUT_FORMAT AudOutFormatNxt; //audio output format - next audio output |
|---|
| 79 | |
|---|
| 80 | DS_BOOL bAudioHWInit; |
|---|
| 81 | |
|---|
| 82 | DHL_HP mHeadPhone; |
|---|
| 83 | } DHL_AUDIO_CONFIG, *P_DHL_AUDIO_CONFIG; |
|---|
| 84 | |
|---|
| 85 | #if defined __cplusplus |
|---|
| 86 | extern "C" { |
|---|
| 87 | #endif |
|---|
| 88 | |
|---|
| 89 | /****************************************************************************** |
|---|
| 90 | * Audio Output Common APIs |
|---|
| 91 | ******************************************************************************/ |
|---|
| 92 | DHL_RESULT DHL_AUD_Init(void); |
|---|
| 93 | DHL_RESULT DHL_AUD_Close(void); |
|---|
| 94 | DHL_RESULT DHL_AUD_PresetAudProcessor(DHL_AUD_PROC_TYPE type); |
|---|
| 95 | DHL_RESULT DHL_AUD_PresetAudOutput(P_DHL_AUDIO_CONFIG pAudConfig); |
|---|
| 96 | DHL_RESULT DHL_AUD_ChangeAudOutFormat(DHL_AUD_OUTPUT_FORMAT UserAudOutFmt); |
|---|
| 97 | DHL_AUD_OUTPUT_FORMAT DHL_AUD_GetAudOutFormat(void); |
|---|
| 98 | |
|---|
| 99 | /****************************************************************************** |
|---|
| 100 | * Audio Output Volume |
|---|
| 101 | ******************************************************************************/ |
|---|
| 102 | DHL_RESULT DHL_AUD_SetVolume(DS_U16 uVolLvl); |
|---|
| 103 | DHL_RESULT DHL_AUD_SetVolumeHP(DS_U16 uVolLvl); |
|---|
| 104 | DHL_RESULT DHL_AUD_GetVolume(DS_U16 *puVolLvl, DS_BOOL *pbMute); |
|---|
| 105 | DHL_RESULT DHL_AUD_SetAMPPower(int n); |
|---|
| 106 | DHL_RESULT DHL_AUD_VolumeFadeInOut_I2S(DS_BOOL bFadeOut); |
|---|
| 107 | DHL_RESULT DHL_AUD_VolumeFadeInOut_AMP(DS_BOOL bFadeOut); |
|---|
| 108 | |
|---|
| 109 | /****************************************************************************** |
|---|
| 110 | * Audio Output Mute |
|---|
| 111 | ******************************************************************************/ |
|---|
| 112 | DHL_RESULT DHL_AUD_MuteMain(DS_BOOL bMute); |
|---|
| 113 | DHL_RESULT DHL_AUD_MuteAUX(DS_BOOL bMute); |
|---|
| 114 | DHL_RESULT DHL_AUD_MuteSPDIF(DS_BOOL bMute); |
|---|
| 115 | DS_BOOL DHL_AUD_IsMainMuted(void); |
|---|
| 116 | DS_BOOL DHL_AUD_IsSpdifMuted(void); |
|---|
| 117 | DS_BOOL DHL_AUD_IsAuxMuted(void); |
|---|
| 118 | |
|---|
| 119 | /****************************************************************************** |
|---|
| 120 | * Audio Output - Headphone |
|---|
| 121 | ******************************************************************************/ |
|---|
| 122 | DHL_RESULT DHL_AUD_SetHPCallback( HPCallbackSource eventSource,P_DHL_HP_CALLBACK fn, DS_U32 userArg ); |
|---|
| 123 | |
|---|
| 124 | /****************************************************************************** |
|---|
| 125 | * Audio Processing APIs |
|---|
| 126 | ******************************************************************************/ |
|---|
| 127 | DHL_RESULT DHL_AUD_SetAudioDelay(DS_S32 offset); |
|---|
| 128 | DHL_RESULT DHL_AUD_SetBalance(int Balance); |
|---|
| 129 | DHL_RESULT DHL_AUD_GetBalance(int *pBalance); |
|---|
| 130 | DHL_RESULT DHL_AUD_SetTreble(int Treble); |
|---|
| 131 | DHL_RESULT DHL_AUD_GetTreble(int *pTreble); |
|---|
| 132 | DHL_RESULT DHL_AUD_SetBass(int Bass); |
|---|
| 133 | DHL_RESULT DHL_AUD_GetBass(int *pBass); |
|---|
| 134 | DHL_RESULT DHL_AUD_SetAVL(DS_BOOL Enable); |
|---|
| 135 | DHL_RESULT DHL_AUD_SetSRS(DS_BOOL Enable); |
|---|
| 136 | |
|---|
| 137 | #if defined __cplusplus |
|---|
| 138 | } |
|---|
| 139 | #endif |
|---|
| 140 | |
|---|
| 141 | #endif /* __DSTHAL_AUD_H__ */ |
|---|