app_dac.h
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#ifndef _APP_DAC_H_
#define _APP_DAC_H_
//#include "app_dec.h"
#include "fifo.h"
#define DOLBY_AC3_OUT_SAMPLE_PER_CH 256
#define MAX_DAC_BUFS 2
#define MP3_DEC_FRAME_SIZE 1152
#define MP3_ENC_FRAME_SAMPLE 1152
#if 0//def DOLBY_AC3_DEC
#ifdef DD_AC3_DEC_16BIT_OUT
//#define AUDIO_OUT_BUF_SIZE (256*1*2/2) //1 data's lines, 1*2 channels
//#define AUDIO_OUT_BUF_SIZE (256*3*2/2) //3 data's lines, 3*2 channels
#define AUDIO_OUT_BUF_SIZE (DOLBY_AC3_OUT_SAMPLE_PER_CH*3*2/2) //3 data's lines, 3*2 channels
#else
//#define AUDIO_OUT_BUF_SIZE (256*1*2*1) //1 data's lines, 1*2 channels
//#define AUDIO_OUT_BUF_SIZE (256*3*2*3) //3 data's lines, 3*2 channels
#define AUDIO_OUT_BUF_SIZE (DOLBY_AC3_OUT_SAMPLE_PER_CH*3*2) //3 data's lines, 3*2 channels
#endif
#else
#ifdef MP3_ENCODE_ENABLE
#ifdef AUDIO_OUT_BUF_IS_HALF_OF_MP3_ENC_FRAME_SAMPLE
#define AUDIO_OUT_BUF_SIZE (MP3_DEC_FRAME_SIZE*1)
#else
#define AUDIO_OUT_BUF_SIZE (MP3_DEC_FRAME_SIZE*2)
#endif
#else
//#define AUDIO_OUT_BUF_SIZE (640*2) //for calling
#define AUDIO_OUT_BUF_SIZE (1152)
#endif //MP3_ENCODE_ENABLE
#endif //DOLBY_AC3_DEC
#define MIN_DAC_DMA_Phase_2_SIZE 192 //byte
#define MIN_DAC_DMA_RESERVED_SIZE 1024 //byte
#if 1
#define SPDIF_FRAME_SIZE (192*4) //a block has 192 audio samples ((8/2) * 192 bytes)
#else
#define SPDIF_FRAME_SIZE (480*2)//(192*4*2) //a block has 192 audio samples ((8/2) * 192 bytes)
#endif
#define PCM_BLOCK (192*2)
#define EX_AUDIO_STREAM_THRESHOLD (SPDIF_FRAME_SIZE*4) //4 spdif frames
#ifdef USB_HOST_AUDIO_ENABLE
//#define MIC_FIFO_BUF_SIZE (1024*2)
#define MIC_FIFO_BUF_SIZE (1024*4)
extern U8 micFifo_buf[MIC_FIFO_BUF_SIZE];
#endif
typedef struct {
//U32 awOutSampleStore[2][640*2];
//U32 awOutSampleStore[2][AUDIO_OUT_BUF_SIZE/2];
U32 awOutSampleStore[2][AUDIO_OUT_BUF_SIZE];
} AWOUTSTORE;
extern AWOUTSTORE awOutStore;
typedef struct{
U16 awSize;
U8 awIndex;
} AWOUT_CONTRLS;
extern AWOUT_CONTRLS awOut_contrls;
typedef struct{
//U32 awInSampleStore1[2][SPDIF_FRAME_SIZE / 4];//for audio in
#if 0//def MIC_REVERB
U32 awInSampleStore1[2][1024 / 4];//for hfp in
#else
//U32 awInSampleStore1[2][240*6*8 / 4];//for hfp in
//U32 awInSampleStore1[2][1152*10/4];
U32 awInSampleStore1[2][480*4/4];
//U32 awInSampleStore1[2][1152*2 / 4];
//U32 awInSampleStore1[2][1152*1 / 4];
#endif
#if 0//def OPTEK_DSP_MX1
U32 awInSampleStore2[2][1024 / 4];//for mic in
#endif
} AWINSTORE;
extern AWINSTORE awInStore;
#define ADC_IN_FIFO_SIZE (sizeof(awInStore.awInSampleStore1))
extern U8 pcmRcvIndex;
extern BOOL uiDacMute;
extern BOOL uiCdservoMute;
extern U8 audio_iso_mute;
extern U8 aux_mute_timer;
extern U8 audio_out_mode;
extern FIFO AdcInFifo;
extern U8 pcmRcvFlag;
extern U32 *pMicInSampleStore;
extern U32 MicInSampleStoreSize;
extern FIFO MicInFifo;
extern FIFO MicEchoFifo;
void app_dac_init (void);
void app_dac_open (void);
void app_dac_close (void);
void app_dac_fini (void);
void app_dac_outbuf_init(void);
void app_dac_cdservo_enable (void);
BOOL app_dac_get_cdservo_mute_state (void);
void app_dac_mute_enable (void);
void app_dac_mute_disable (void);
void app_adc_mute_enable (void);
void app_adc_mute_disable(void);
void app_adc_receive_disable (void);
void app_dac_receive_pcm_enable(U8 con);
void app_audio_iso_rcv_enable (void);
void app_audio_iso_rcv_disable (void);
void Spdif_rcv_disable(void);
void mix1_init(void);
void app_output_reset (void);
void mix1_init_reuse_audio_in_buf(void);
#endif //_APP_DAC_H_