FreeCalypso > hg > fc-magnetite
comparison src/cs/services/Audio/audio_api.h @ 0:945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
binary blobs and LCD demo files have been excluded,
all line endings are LF only
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Sep 2016 22:50:11 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:945cf7f506b2 |
---|---|
1 /****************************************************************************/ | |
2 /* */ | |
3 /* File Name: audio_api.h */ | |
4 /* */ | |
5 /* Purpose: This file contains data structures and functions prototypes */ | |
6 /* used to send events to the AUDIO SWE. */ | |
7 /* */ | |
8 /* Version 0.1 */ | |
9 /* */ | |
10 /* Date Modification */ | |
11 /* ------------------------------------ */ | |
12 /* 18 May 2001 Create */ | |
13 /* */ | |
14 /* Author Francois Mazard - Stephanie Gerthoux */ | |
15 /* */ | |
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ | |
17 /****************************************************************************/ | |
18 | |
19 | |
20 | |
21 #ifndef __AUDIO_API_H_ | |
22 #define __AUDIO_API_H_ | |
23 | |
24 #ifdef __cplusplus | |
25 extern "C" | |
26 { | |
27 #endif | |
28 | |
29 #define AUDIO_EVENTS_MASK (0x3000) | |
30 #define AUDIO_EVENT_EXTERN (0x0C00) | |
31 | |
32 /* Immediat return */ | |
33 typedef INT8 T_AUDIO_RET; | |
34 | |
35 /* possible values */ | |
36 #define AUDIO_OK (0) | |
37 #define AUDIO_ERROR (-1) | |
38 #define AUDIO_MODE_ERROR (-2) | |
39 /* Bad acquisition of the word. The word is too long or too short */ | |
40 #define AUDIO_BAD_ACQUISITION (-3) | |
41 /* The DSP task to acquire the word takes to much time */ | |
42 #define AUDIO_TIME_OUT (-4) | |
43 /* Bad update of the model. The model from the database is too different */ | |
44 /* than the model built during the acquisition. */ | |
45 #define AUDIO_BAD_UPDATE (-5) | |
46 /* This word is out of vocabulary or the best words are too close */ | |
47 #define AUDIO_BAD_RECOGNITION (-6) | |
48 /* A word generated by the CTO algorithm is the best word. */ | |
49 #define AUDIO_CTO_WORD (-7) | |
50 /* The best word isn't the word to update. */ | |
51 #define AUDIO_CHECK_ERROR (-8) | |
52 #define AUDIO_NOT_ENOUGH_OSCILLATOR (-9) | |
53 | |
54 /******************************* AUDIO DRIVER *****************************/ | |
55 #define AUDIO_VM_AMR_RECORD_SESSION_ID (10) | |
56 #define AUDIO_VM_AMR_PLAY_SESSION_ID (11) | |
57 #define AUDIO_MIDI_SESSION_ID (12) | |
58 | |
59 /******************************* KEY BEEP REGISTRATION *****************************/ | |
60 /* Definition of no_beep */ | |
61 #define NO_BEEP (0) | |
62 | |
63 /* Parameters */ | |
64 typedef struct | |
65 { | |
66 UINT16 frequency_beep[2]; /* Frequency of the 2 beeps */ | |
67 INT8 amplitude_beep[2]; /* Amplitude of the 2 beeps */ | |
68 UINT16 duration; | |
69 } T_AUDIO_KEYBEEP_PARAMETER; | |
70 | |
71 /* Prototype */ | |
72 T_AUDIO_RET audio_keybeep_start (T_AUDIO_KEYBEEP_PARAMETER parameter, | |
73 T_RV_RETURN return_path); | |
74 | |
75 /* Event return */ | |
76 #define AUDIO_KEYBEEP_STATUS_MSG (0x0001 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
77 typedef struct | |
78 { | |
79 T_RV_HDR os_hdr; | |
80 INT8 status; | |
81 } T_AUDIO_KEYBEEP_STATUS; | |
82 | |
83 /* Prototype */ | |
84 T_AUDIO_RET audio_keybeep_stop (T_RV_RETURN return_path); | |
85 | |
86 /******************************* TONES REGISTRATION *****************************/ | |
87 | |
88 /* Definition of no_tone and tone_infinite */ | |
89 #define NO_TONE (0) | |
90 #define TONE_INFINITE (0xFFFF) | |
91 | |
92 /* Parameters */ | |
93 typedef struct | |
94 { | |
95 UINT16 start_tone; /* start date of the tone */ | |
96 UINT16 stop_tone; /* stop date of the tone */ | |
97 UINT16 frequency_tone; /* frequency of the tone */ | |
98 INT8 amplitude_tone; /* amplitude of the tone */ | |
99 } T_AUDIO_TONE_DESC; | |
100 | |
101 typedef struct | |
102 { | |
103 T_AUDIO_TONE_DESC tones[3]; /* Description of the 3 tones */ | |
104 UINT16 frame_duration; /* Duration of the tones frame */ | |
105 UINT16 sequence_duration; /* Duration of the sequence */ | |
106 UINT16 period_duration; /* Duration of the period */ | |
107 UINT16 repetition; /* number of period */ | |
108 } T_AUDIO_TONES_PARAMETER; | |
109 | |
110 /* Prototype */ | |
111 T_AUDIO_RET audio_tones_start (T_AUDIO_TONES_PARAMETER* p_parameter, | |
112 T_RV_RETURN return_path); | |
113 | |
114 /* Event return */ | |
115 #define AUDIO_TONES_STATUS_MSG (0x0002 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
116 typedef struct | |
117 { | |
118 T_RV_HDR os_hdr; | |
119 INT8 status; | |
120 } T_AUDIO_TONES_STATUS; | |
121 | |
122 /* Prototype */ | |
123 T_AUDIO_RET audio_tones_stop (T_RV_RETURN return_path); | |
124 | |
125 /******************************* AUDIO DRIVER REGISTRATION ************************/ | |
126 | |
127 T_AUDIO_RET audio_driver_start_session(UINT8 channel_id, T_RV_RETURN notification_return_path); | |
128 | |
129 T_AUDIO_RET audio_driver_stop_session(UINT8 channel_id); | |
130 | |
131 T_AUDIO_RET audio_driver_free_session(UINT8 channel_id, T_RV_RETURN return_path); | |
132 | |
133 T_AUDIO_RET audio_driver_get_play_buffer(UINT8 channel_id, UINT8 **pp_buffer); | |
134 T_AUDIO_RET audio_driver_play_buffer(UINT8 channel_id, UINT8 *p_buffer); | |
135 | |
136 #define AUDIO_DRIVER_INIT_STATUS_MSG (0x0003 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
137 typedef struct | |
138 { | |
139 T_RV_HDR os_hdr; | |
140 INT8 status; | |
141 UINT8 channel_id; | |
142 UINT8 session_id; | |
143 } T_AUDIO_DRIVER_INIT_STATUS; | |
144 | |
145 #define AUDIO_DRIVER_NOTIFICATION_MSG (0x0004 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
146 typedef struct | |
147 { | |
148 T_RV_HDR header; | |
149 UINT8 channel_id; | |
150 UINT16 *p_buffer; | |
151 } | |
152 T_AUDIO_DRIVER_NOTIFICATION; | |
153 | |
154 #define AUDIO_DRIVER_LAST_NOTIFICATION_MSG (0x0005 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
155 typedef struct | |
156 { | |
157 T_RV_HDR header; | |
158 UINT8 channel_id; | |
159 UINT16 *p_buffer; | |
160 UINT32 recorded_size; | |
161 } | |
162 T_AUDIO_DRIVER_LAST_NOTIFICATION; | |
163 | |
164 #define AUDIO_DRIVER_STATUS_MSG (0x0006 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
165 typedef struct | |
166 { | |
167 T_RV_HDR os_hdr; | |
168 INT8 status; | |
169 UINT8 status_type; | |
170 UINT8 channel_id; | |
171 } T_AUDIO_DRIVER_STATUS; | |
172 | |
173 #define AUDIO_START_STATUS (1) | |
174 #define AUDIO_STOP_STATUS (2) | |
175 #define AUDIO_FREE_STATUS (3) | |
176 | |
177 typedef struct | |
178 { | |
179 UINT16 buffer_size; | |
180 UINT8 nb_buffer; | |
181 } T_AUDIO_DRIVER_PARAMETER; | |
182 | |
183 /******************************* MELODY AND VOICE MEMO REGISTRATION *****************************/ | |
184 /* Definition of the maximum size of the path name */ | |
185 #define AUDIO_PATH_NAME_MAX_SIZE (20) | |
186 /* Definition of the maximum number of instruments */ | |
187 #define AUDIO_MELODY_E2_MAX_NUMBER_OF_INSTRUMENT (128) | |
188 | |
189 /******************************* MELODY REGISTRATION *****************************/ | |
190 | |
191 /* Definition of loopback melody mode */ | |
192 #define AUDIO_MELODY_NO_LOOPBACK (0) | |
193 #define AUDIO_MELODY_LOOPBACK (1) | |
194 | |
195 /* Definition ofthe mode of melody */ | |
196 #define AUDIO_MELODY_GAME_MODE (0) | |
197 #define AUDIO_MELODY_NORMAL_MODE (1) | |
198 | |
199 /******** Melody E1 ********/ | |
200 | |
201 /* Parameters */ | |
202 typedef struct | |
203 { | |
204 char melody_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */ | |
205 BOOLEAN loopback; /* the melody is played indefinitely */ | |
206 BOOLEAN melody_mode; /* mode of the melody */ | |
207 } T_AUDIO_MELODY_E1_PARAMETER; | |
208 | |
209 typedef struct | |
210 { | |
211 char melody_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */ | |
212 } | |
213 T_AUDIO_MELODY_E1_STOP_PARAMETER; | |
214 | |
215 /* Prototype */ | |
216 T_AUDIO_RET audio_melody_E1_start (T_AUDIO_MELODY_E1_PARAMETER *parameter, | |
217 T_RV_RETURN return_path); | |
218 | |
219 /* Event return */ | |
220 #define AUDIO_MELODY_E1_STATUS_MSG (0x0007 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
221 typedef struct | |
222 { | |
223 T_RV_HDR os_hdr; | |
224 INT8 status; | |
225 } T_AUDIO_MELODY_E1_STATUS; | |
226 | |
227 /* Prototype */ | |
228 T_AUDIO_RET audio_melody_E1_stop (T_AUDIO_MELODY_E1_STOP_PARAMETER *parameter, | |
229 T_RV_RETURN return_path); | |
230 | |
231 /******** Melody E2 ********/ | |
232 | |
233 /* Parameters */ | |
234 typedef struct | |
235 { | |
236 char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */ | |
237 BOOLEAN E2_loopback; /* the melody is played indefinitely */ | |
238 BOOLEAN melody_E2_mode; /* mode of the melody (Game/Normal)*/ | |
239 } T_AUDIO_MELODY_E2_PARAMETER; | |
240 | |
241 typedef struct | |
242 { | |
243 char melody_E2_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */ | |
244 } T_AUDIO_MELODY_E2_STOP_PARAMETER; | |
245 | |
246 typedef struct | |
247 { | |
248 char melody_E2_file_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the melody */ | |
249 } T_AUDIO_MELODY_E2_LOAD_FILE_INSTR_PARAMETER; | |
250 | |
251 | |
252 /* Prototype */ | |
253 T_AUDIO_RET audio_melody_E2_load_file_instruments ( | |
254 T_AUDIO_MELODY_E2_LOAD_FILE_INSTR_PARAMETER *p_parameter); | |
255 | |
256 T_AUDIO_RET audio_melody_E2_start (T_AUDIO_MELODY_E2_PARAMETER *p_parameter, | |
257 T_RV_RETURN return_path); | |
258 T_AUDIO_RET audio_melody_E2_stop (T_AUDIO_MELODY_E2_STOP_PARAMETER *parameter, | |
259 T_RV_RETURN return_path); | |
260 | |
261 /* Event return */ | |
262 /* For melody_E2 */ | |
263 #define AUDIO_MELODY_E2_STATUS_MSG (0x0008 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
264 | |
265 typedef struct | |
266 { | |
267 T_RV_HDR os_hdr; | |
268 INT8 status; | |
269 } T_AUDIO_MELODY_E2_STATUS; | |
270 | |
271 | |
272 | |
273 /******************************* VOICE MEMO REGISTRATION *****************************/ | |
274 | |
275 /* ---------------------------- */ | |
276 /* Voice memo PLAY */ | |
277 /* ---------------------------- */ | |
278 | |
279 /* Parameters */ | |
280 typedef struct | |
281 { | |
282 char memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo play */ | |
283 } T_AUDIO_VM_PLAY_PARAMETER; | |
284 | |
285 /* Prototype */ | |
286 T_AUDIO_RET audio_vm_play_start(T_AUDIO_VM_PLAY_PARAMETER *p_parameter, | |
287 T_RV_RETURN return_path); | |
288 | |
289 /* Event return */ | |
290 #define AUDIO_VM_PLAY_STATUS_MSG (0x0009 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
291 typedef struct | |
292 { | |
293 T_RV_HDR os_hdr; | |
294 INT8 status; | |
295 } T_AUDIO_VM_PLAY_STATUS; | |
296 | |
297 /* Prototype */ | |
298 T_AUDIO_RET audio_vm_play_stop (T_RV_RETURN return_path); | |
299 | |
300 /* ---------------------------- */ | |
301 /* Voice memo RECORD */ | |
302 /* ---------------------------- */ | |
303 | |
304 /* Definition of compression mode */ | |
305 #define AUDIO_VM_NO_COMPRESSION_MODE (0) | |
306 #define AUDIO_VM_COMPRESSION_MODE (1) | |
307 | |
308 /* Parameters */ | |
309 typedef struct | |
310 { | |
311 char memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo play */ | |
312 UINT32 memo_duration; /* maximum duration of the voice memo */ | |
313 BOOL compression_mode; /* activate the compression */ | |
314 UINT16 microphone_gain; /* recording gain applies to microphone */ | |
315 UINT16 network_gain; /* gain applies to the network voice */ | |
316 } T_AUDIO_VM_RECORD_PARAMETER; | |
317 | |
318 /* Prototype */ | |
319 T_AUDIO_RET audio_vm_record_start( T_AUDIO_VM_RECORD_PARAMETER *p_record_parameter, | |
320 T_AUDIO_TONES_PARAMETER *p_tones_parameter, | |
321 T_RV_RETURN return_path); | |
322 | |
323 /* Event return */ | |
324 #define AUDIO_VM_RECORD_STATUS_MSG (0x000A | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
325 typedef struct | |
326 { | |
327 T_RV_HDR os_hdr; | |
328 INT8 status; | |
329 UINT16 recorded_duration; | |
330 } T_AUDIO_VM_RECORD_STATUS; | |
331 | |
332 /* Prototype */ | |
333 T_AUDIO_RET audio_vm_record_stop (T_RV_RETURN return_path); | |
334 | |
335 /******************************* VOICE MEMO DRIVER AMR REGISTRATION *****************************/ | |
336 | |
337 /* ---------------------------- */ | |
338 /* Voice memo AMR PLAY */ | |
339 /* ---------------------------- */ | |
340 | |
341 /* Parameters */ | |
342 typedef struct | |
343 { | |
344 char memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo AMR play */ | |
345 } T_AUDIO_AMR_PLAY_FROM_FFS_PARAMETER; | |
346 | |
347 typedef T_AUDIO_AMR_PLAY_FROM_FFS_PARAMETER T_AUDIO_MMS_PLAY_FROM_FFS_PARAMETER; | |
348 | |
349 typedef struct | |
350 { | |
351 UINT8 *p_buffer; /* pointer on buffer to copy from */ | |
352 UINT16 buffer_size; /* size of buffer */ | |
353 } T_AUDIO_AMR_PLAY_FROM_RAM_PARAMETER; | |
354 | |
355 #define AUDIO_AMR_PLAY_FROM_MEM_STATUS_MSG (0x000B | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
356 typedef struct | |
357 { | |
358 T_RV_HDR os_hdr; | |
359 INT8 status; | |
360 } T_AUDIO_AMR_PLAY_STATUS; | |
361 | |
362 /* Prototype */ | |
363 T_AUDIO_RET audio_amr_play_from_ffs_start (T_AUDIO_AMR_PLAY_FROM_FFS_PARAMETER *p_record_parameter, | |
364 T_RV_RETURN return_path); | |
365 T_AUDIO_RET audio_amr_play_from_ffs_stop (void); | |
366 | |
367 T_AUDIO_RET audio_mms_play_from_ffs_start (T_AUDIO_MMS_PLAY_FROM_FFS_PARAMETER *p_record_parameter, | |
368 T_RV_RETURN return_path); | |
369 T_AUDIO_RET audio_mms_play_from_ffs_stop (void); | |
370 | |
371 T_AUDIO_RET audio_amr_play_from_ram_start (T_AUDIO_AMR_PLAY_FROM_RAM_PARAMETER *p_record_parameter, | |
372 T_RV_RETURN return_path); | |
373 T_AUDIO_RET audio_amr_play_from_ram_stop (void); | |
374 | |
375 T_AUDIO_RET audio_driver_init_vm_amr_play_session(T_AUDIO_DRIVER_PARAMETER *p_driver_parameter, T_RV_RETURN return_path); | |
376 | |
377 /* ---------------------------- */ | |
378 /* Voice memo AMR RECORD */ | |
379 /* ---------------------------- */ | |
380 | |
381 /* Definition of compression mode */ | |
382 #define AUDIO_AMR_NO_COMPRESSION_MODE (0) | |
383 #define AUDIO_AMR_COMPRESSION_MODE (1) | |
384 | |
385 /* Definition of AMR vocoders */ | |
386 #define AUDIO_AMR_VOCODER_4_75 (0) | |
387 #define AUDIO_AMR_VOCODER_5_15 (1) | |
388 #define AUDIO_AMR_VOCODER_5_90 (2) | |
389 #define AUDIO_AMR_VOCODER_6_70 (3) | |
390 #define AUDIO_AMR_VOCODER_7_40 (4) | |
391 #define AUDIO_AMR_VOCODER_7_95 (5) | |
392 #define AUDIO_AMR_VOCODER_10_2 (6) | |
393 #define AUDIO_AMR_VOCODER_12_2 (7) | |
394 | |
395 /* Parameters */ | |
396 typedef struct | |
397 { | |
398 char memo_name[AUDIO_PATH_NAME_MAX_SIZE]; /* File name of the Voice Memo AMR play */ | |
399 UINT32 memo_duration; /* maximum duration of the voice memo */ | |
400 BOOL compression_mode; /* activate the compression */ | |
401 UINT16 microphone_gain; /* recording gain applies to microphone */ | |
402 UINT8 amr_vocoder; /* AMR codec */ | |
403 } T_AUDIO_AMR_RECORD_TO_FFS_PARAMETER; | |
404 | |
405 typedef T_AUDIO_AMR_RECORD_TO_FFS_PARAMETER T_AUDIO_MMS_RECORD_TO_FFS_PARAMETER; | |
406 | |
407 typedef struct | |
408 { | |
409 UINT8 *p_buffer; /* pointer on buffer to copy to, length must be > memo_duration */ | |
410 UINT32 memo_duration; /* maximum duration of the voice memo */ | |
411 BOOL compression_mode; /* activate the compression */ | |
412 UINT16 microphone_gain; /* recording gain applies to microphone */ | |
413 UINT8 amr_vocoder; /* AMR codec */ | |
414 } T_AUDIO_AMR_RECORD_TO_RAM_PARAMETER; | |
415 | |
416 /* Parameters */ | |
417 typedef struct | |
418 { | |
419 UINT32 memo_duration; /* maximum duration of the voice memo */ | |
420 BOOL compression_mode; /* activate the compression */ | |
421 UINT16 microphone_gain; /* recording gain applies to microphone */ | |
422 UINT8 amr_vocoder; /* AMR codec */ | |
423 } T_AUDIO_DRIVER_VM_AMR_RECORD_PARAMETER; | |
424 | |
425 #define AUDIO_AMR_RECORD_TO_MEM_STATUS_MSG (0x000C | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
426 typedef struct | |
427 { | |
428 T_RV_HDR os_hdr; | |
429 INT8 status; | |
430 UINT32 recorded_duration; | |
431 } T_AUDIO_AMR_RECORD_STATUS; | |
432 | |
433 /* Prototype */ | |
434 T_AUDIO_RET audio_amr_record_to_ffs_start (T_AUDIO_AMR_RECORD_TO_FFS_PARAMETER *p_record_parameter, | |
435 T_RV_RETURN return_path); | |
436 T_AUDIO_RET audio_amr_record_to_ffs_stop (void); | |
437 | |
438 T_AUDIO_RET audio_mms_record_to_ffs_start (T_AUDIO_MMS_RECORD_TO_FFS_PARAMETER *p_record_parameter, | |
439 T_RV_RETURN return_path); | |
440 T_AUDIO_RET audio_mms_record_to_ffs_stop (void); | |
441 | |
442 T_AUDIO_RET audio_amr_record_to_ram_start (T_AUDIO_AMR_RECORD_TO_RAM_PARAMETER *p_record_parameter, | |
443 T_RV_RETURN return_path); | |
444 T_AUDIO_RET audio_amr_record_to_ram_stop (void); | |
445 | |
446 T_AUDIO_RET audio_driver_init_vm_amr_record_session(T_AUDIO_DRIVER_VM_AMR_RECORD_PARAMETER *p_record_parameter, | |
447 T_AUDIO_DRIVER_PARAMETER *p_driver_parameter, | |
448 T_RV_RETURN return_path); | |
449 | |
450 /******************************* AUDIO SPEECH RECOGNITION REGISTRATION ************************/ | |
451 | |
452 /* ---------------------------- */ | |
453 /* Start Enrollment */ | |
454 /* ---------------------------- */ | |
455 | |
456 /* Symbolic constant */ | |
457 #define AUDIO_SR_RECORD_SPEECH (1) | |
458 #define AUDIO_SR_NO_RECORD_SPEECH (0) | |
459 | |
460 /* maximum number of vocabulary name */ | |
461 #define AUDIO_SR_MAX_VOCABULARY_NAME (10) | |
462 | |
463 /* Parameters */ | |
464 typedef struct { | |
465 char enroll_name[AUDIO_PATH_NAME_MAX_SIZE]; /* name and path of the word to enroll */ | |
466 BOOL record_speech; /* speech sample must be recorded or not */ | |
467 }T_AUDIO_SR_ENROLL_PARAMETER; | |
468 | |
469 /* Prototype */ | |
470 T_AUDIO_RET audio_sr_enroll_start (T_AUDIO_SR_ENROLL_PARAMETER *p_parameter, | |
471 T_RV_RETURN return_path); | |
472 | |
473 /* Event return */ | |
474 #define AUDIO_SR_ENROLL_STATUS_MSG (0x000D | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
475 typedef struct | |
476 { | |
477 T_RV_HDR os_hdr; | |
478 INT8 status; | |
479 } T_AUDIO_SR_ENROLL_STATUS; | |
480 | |
481 /* ---------------------------- */ | |
482 /* Stop Enrollment */ | |
483 /* ---------------------------- */ | |
484 | |
485 /* Symbolic constant */ | |
486 | |
487 /* Parameters */ | |
488 | |
489 /* Prototype */ | |
490 T_AUDIO_RET audio_sr_enroll_stop ( T_RV_RETURN return_path ); | |
491 | |
492 /* Event return */ | |
493 | |
494 /* ---------------------------- */ | |
495 /* Start Update */ | |
496 /* ---------------------------- */ | |
497 | |
498 /* Symbolic constant */ | |
499 | |
500 /* Parameters */ | |
501 typedef struct { | |
502 char update_name[AUDIO_PATH_NAME_MAX_SIZE]; /* name and path of the word to update */ | |
503 BOOL record_speech; /* speech sample must be recorded or not */ | |
504 }T_AUDIO_SR_UPDATE_PARAMETER; | |
505 | |
506 /* Prototype */ | |
507 T_AUDIO_RET audio_sr_update_start (T_AUDIO_SR_UPDATE_PARAMETER *p_parameter, | |
508 T_RV_RETURN return_path); | |
509 | |
510 /* Event return */ | |
511 #define AUDIO_SR_UPDATE_STATUS_MSG (0x000E | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
512 typedef struct | |
513 { | |
514 T_RV_HDR os_hdr; | |
515 INT8 status; | |
516 } T_AUDIO_SR_UPDATE_STATUS; | |
517 | |
518 /* ---------------------------- */ | |
519 /* Stop Update */ | |
520 /* ---------------------------- */ | |
521 | |
522 /* Symbolic constant */ | |
523 | |
524 /* Parameters */ | |
525 | |
526 /* Prototype */ | |
527 T_AUDIO_RET audio_sr_update_stop ( T_RV_RETURN return_path ); | |
528 | |
529 /* Event return */ | |
530 | |
531 /* ---------------------------- */ | |
532 /* Start Update */ | |
533 /* ---------------------------- */ | |
534 | |
535 /* Symbolic constant */ | |
536 | |
537 /* Parameters */ | |
538 typedef struct { | |
539 /* directory of the vocabulary database */ | |
540 char database_directory[AUDIO_PATH_NAME_MAX_SIZE]; | |
541 }T_AUDIO_SR_RECO_PARAMETER; | |
542 | |
543 /* Prototype */ | |
544 T_AUDIO_RET audio_sr_reco_start (T_AUDIO_SR_RECO_PARAMETER *p_parameter, | |
545 T_RV_RETURN return_path); | |
546 | |
547 /* Event return */ | |
548 #define AUDIO_SR_RECO_STATUS_MSG (0x000F | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
549 typedef struct { | |
550 T_RV_HDR os_hdr; | |
551 /* status about the recognition task */ | |
552 INT8 status; | |
553 /*path ofthe recognized word */ | |
554 char word_recognized[AUDIO_PATH_NAME_MAX_SIZE]; | |
555 } T_AUDIO_SR_RECO_STATUS; | |
556 | |
557 /* ---------------------------- */ | |
558 /* Stop reco */ | |
559 /* ---------------------------- */ | |
560 | |
561 /* Symbolic constant */ | |
562 | |
563 /* Parameters */ | |
564 | |
565 /* Prototype */ | |
566 T_AUDIO_RET audio_sr_reco_stop ( T_RV_RETURN return_path ); | |
567 | |
568 /* Event return */ | |
569 | |
570 | |
571 | |
572 /******************************* MIDI REGISTRATION *****************************/ | |
573 | |
574 // Parameters | |
575 typedef struct | |
576 { | |
577 char midi_name[AUDIO_PATH_NAME_MAX_SIZE]; // File name of the MIDI to play | |
578 } T_AUDIO_MIDI_PARAMETER; | |
579 | |
580 // Prototype | |
581 T_AUDIO_RET audio_midi_start(T_AUDIO_MIDI_PARAMETER *parameter, T_RV_RETURN *p_return_path); | |
582 | |
583 // Event return | |
584 #define AUDIO_MIDI_STATUS_MSG (0x0010 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
585 typedef struct | |
586 { | |
587 T_RV_HDR os_hdr; | |
588 INT8 status; | |
589 } T_AUDIO_MIDI_STATUS; | |
590 | |
591 // Prototype | |
592 T_AUDIO_RET audio_midi_stop(void); | |
593 | |
594 T_AUDIO_RET audio_driver_init_midi_session(T_AUDIO_DRIVER_PARAMETER *p_driver_parameter, T_RV_RETURN *p_return_path); | |
595 | |
596 | |
597 /******************************* AUDIO CONFIGURATION REGISTRATION *****************************/ | |
598 | |
599 /******************/ | |
600 /*** Voice path ***/ | |
601 /******************/ | |
602 | |
603 /* Parameters */ | |
604 | |
605 /* Voice path selection */ | |
606 #define AUDIO_GSM_VOICE_PATH (0) | |
607 #define AUDIO_BLUETOOTH_CORDLESS_VOICE_PATH (1) | |
608 #define AUDIO_BLUETOOTH_HEADSET (2) | |
609 #define AUDIO_DAI_ENCODER (12) | |
610 #define AUDIO_DAI_DECODER (11) | |
611 #define AUDIO_DAI_ACOUSTIC (14) | |
612 | |
613 /* Structure */ | |
614 /* audio path used */ | |
615 typedef UINT8 T_AUDIO_VOICE_PATH_SETTING; | |
616 | |
617 /********************************/ | |
618 /*** Microphone configuration ***/ | |
619 /********************************/ | |
620 | |
621 /* Parameters */ | |
622 /* Mode */ | |
623 #define AUDIO_MICROPHONE_HANDHELD (0) | |
624 #define AUDIO_MICROPHONE_HANDFREE (1) | |
625 #define AUDIO_MICROPHONE_HEADSET (2) | |
626 | |
627 /* gain */ | |
628 #define AUDIO_MICROPHONE_MUTE (13) | |
629 | |
630 /* output_bias */ | |
631 #define AUDIO_MICROPHONE_OUTPUT_BIAS_2_0V (0) | |
632 #define AUDIO_MICROPHONE_OUTPUT_BIAS_2_5V (1) | |
633 | |
634 /* extra gain */ | |
635 #define AUDIO_MICROPHONE_AUX_GAIN_28_2dB (0) | |
636 #define AUDIO_MICROPHONE_AUX_GAIN_4_6dB (1) | |
637 | |
638 /* Structure */ | |
639 typedef struct | |
640 { | |
641 UINT16 coefficient[31]; | |
642 } | |
643 T_AUDIO_FIR_COEF; | |
644 | |
645 typedef struct | |
646 { | |
647 /* gain of the microphone */ | |
648 INT8 gain; | |
649 /* microphone output bias */ | |
650 INT8 output_bias; | |
651 /* coefficients of the microphone FIR */ | |
652 T_AUDIO_FIR_COEF fir; | |
653 } | |
654 T_AUDIO_MICROPHONE_MODE_HANDHELD; | |
655 | |
656 typedef struct { | |
657 /* gain of the microphone */ | |
658 INT8 gain; | |
659 /* extra gain of the microphone */ | |
660 INT8 extra_gain; | |
661 /* microphone output bias */ | |
662 INT8 output_bias; | |
663 /* coefficients of the microphone FIR */ | |
664 T_AUDIO_FIR_COEF fir; | |
665 } | |
666 T_AUDIO_MICROPHONE_MODE_HANDFREE; | |
667 | |
668 typedef struct { | |
669 /* gain of the microphone */ | |
670 INT8 gain; | |
671 /* microphone output bias */ | |
672 INT8 output_bias; | |
673 /* coefficients of the microphone FIR */ | |
674 T_AUDIO_FIR_COEF fir; | |
675 } | |
676 T_AUDIO_MICROPHONE_MODE_HEADSET; | |
677 | |
678 typedef union | |
679 { | |
680 /* handheld mode parameters */ | |
681 T_AUDIO_MICROPHONE_MODE_HANDHELD handheld; | |
682 /* handfree mode parameters */ | |
683 T_AUDIO_MICROPHONE_MODE_HANDFREE handfree; | |
684 /* headset mode parameters */ | |
685 T_AUDIO_MICROPHONE_MODE_HEADSET headset; | |
686 } | |
687 T_AUDIO_MICROPHONE_MODE; | |
688 | |
689 typedef struct | |
690 { | |
691 /* mode of the microphone */ | |
692 INT8 mode; | |
693 /* Setting of the current mode */ | |
694 T_AUDIO_MICROPHONE_MODE setting; | |
695 } | |
696 T_AUDIO_MICROPHONE_SETTING; | |
697 | |
698 /*****************************/ | |
699 /*** Speaker configuration ***/ | |
700 /*****************************/ | |
701 | |
702 /* Paratemers */ | |
703 /* Mode*/ | |
704 #define AUDIO_SPEAKER_HANDHELD (0) | |
705 #define AUDIO_SPEAKER_HANDFREE (1) | |
706 #define AUDIO_SPEAKER_HEADSET (2) | |
707 #define AUDIO_SPEAKER_BUZZER (3) | |
708 #define AUDIO_SPEAKER_HANDHELD_HANDFREE (4) | |
709 | |
710 /* filter */ | |
711 #define AUDIO_SPEAKER_FILTER_ON (0) | |
712 #define AUDIO_SPEAKER_FILTER_OFF (1) | |
713 | |
714 /* Buzzer */ | |
715 #define AUDIO_SPEAKER_BUZZER_ON (0) | |
716 #define AUDIO_SPEAKER_BUZZER_OFF (1) | |
717 | |
718 /* Structure */ | |
719 typedef struct | |
720 { | |
721 /* gain of the speaker */ | |
722 INT8 gain; | |
723 /* use the audio filter */ | |
724 INT8 audio_filter; | |
725 /* coefficients of the speaker FIR */ | |
726 T_AUDIO_FIR_COEF fir; | |
727 } | |
728 T_AUDIO_SPEAKER_MODE_HANDHELD; | |
729 | |
730 typedef struct | |
731 { | |
732 /* gain of the speaker */ | |
733 INT8 gain; | |
734 /* use the audio filter */ | |
735 INT8 audio_filter; | |
736 /* coefficients of the speaker FIR */ | |
737 T_AUDIO_FIR_COEF fir; | |
738 } | |
739 T_AUDIO_SPEAKER_MODE_HANDFREE; | |
740 | |
741 typedef struct | |
742 { | |
743 /* gain of the speaker */ | |
744 INT8 gain; | |
745 /* use the audio filter */ | |
746 INT8 audio_filter; | |
747 /* coefficients of the speaker FIR */ | |
748 T_AUDIO_FIR_COEF fir; | |
749 } | |
750 T_AUDIO_SPEAKER_MODE_HEADSET; | |
751 | |
752 typedef struct | |
753 { | |
754 /* activate the buzzer */ | |
755 INT8 activate; | |
756 } | |
757 T_AUDIO_SPEAKER_MODE_BUZZER; | |
758 | |
759 typedef struct | |
760 { | |
761 /* gain of the speaker */ | |
762 INT8 gain; | |
763 /* use the audio filter */ | |
764 INT8 audio_filter; | |
765 /* coefficients of the speaker FIR */ | |
766 T_AUDIO_FIR_COEF fir; | |
767 } | |
768 T_AUDIO_SPEAKER_MODE_HANDHELD_HANDFREE; | |
769 | |
770 typedef union | |
771 { | |
772 /* handheld mode parameters */ | |
773 T_AUDIO_SPEAKER_MODE_HANDHELD handheld; | |
774 /* handfree mode parameters */ | |
775 T_AUDIO_SPEAKER_MODE_HANDFREE handfree; | |
776 /* headset mode parameters */ | |
777 T_AUDIO_SPEAKER_MODE_HEADSET headset; | |
778 /* buzzer mode parameters */ | |
779 T_AUDIO_SPEAKER_MODE_BUZZER buzzer; | |
780 /* handheld and handfree mode parameters */ | |
781 T_AUDIO_SPEAKER_MODE_HANDHELD_HANDFREE handheld_handfree; | |
782 } | |
783 T_AUDIO_SPEAKER_MODE; | |
784 | |
785 typedef struct | |
786 { | |
787 /* mode of the speaker */ | |
788 INT8 mode; | |
789 /* Setting of the current mode */ | |
790 T_AUDIO_SPEAKER_MODE setting; | |
791 } | |
792 T_AUDIO_SPEAKER_SETTING; | |
793 | |
794 /********************************************/ | |
795 /*** Mirophone-Speaker loop configuration ***/ | |
796 /********************************************/ | |
797 | |
798 /* sidetone */ | |
799 #define AUDIO_SIDETONE_OPEN (-26) | |
800 | |
801 /* AEC enable */ | |
802 #define AUDIO_AEC_ENABLE (0x0002) | |
803 #define AUDIO_AEC_DISABLE (0x0000) | |
804 | |
805 /* AEC visibility */ | |
806 #define AUDIO_AEC_VISIBILITY_ENABLE (0x0200) | |
807 #define AUDIO_AEC_VISIBILITY_DISABLE (0x0000) | |
808 | |
809 /* AEC mode */ | |
810 #define AUDIO_SHORT_ECHO (0x0200) | |
811 #define AUDIO_LONG_ECHO (0x0000) | |
812 | |
813 /* echo suppression level */ | |
814 #if (L1_NEW_AEC) | |
815 #define AUDIO_MAX_ECHO_0dB (0x7FFF) | |
816 #define AUDIO_MAX_ECHO_2dB (0x65AA) | |
817 #define AUDIO_MAX_ECHO_3dB (0x59AD) | |
818 #define AUDIO_MAX_ECHO_6dB (0x4000) | |
819 #define AUDIO_MAX_ECHO_12dB (0x1FFF) | |
820 #define AUDIO_MAX_ECHO_18dB (0x0FFF) | |
821 #define AUDIO_MAX_ECHO_24dB (0x07FF) | |
822 #else | |
823 #define AUDIO_ECHO_0dB (0x0000) | |
824 #define AUDIO_ECHO_6dB (0x0008) | |
825 #define AUDIO_ECHO_12dB (0x0010) | |
826 #define AUDIO_ECHO_18dB (0x0018) | |
827 #endif | |
828 | |
829 /* noise suppression enable */ | |
830 #define AUDIO_NOISE_SUPPRESSION_ENABLE (0x0004) | |
831 #define AUDIO_NOISE_SUPPRESSION_DISABLE (0x0000) | |
832 | |
833 /* noise suppression level */ | |
834 #define AUDIO_NOISE_NO_LIMITATION (0x0000) | |
835 #define AUDIO_NOISE_6dB (0x0020) | |
836 #define AUDIO_NOISE_12dB (0x0040) | |
837 #define AUDIO_NOISE_18dB (0x0060) | |
838 | |
839 typedef struct | |
840 { | |
841 /* Enable the AEC */ | |
842 UINT16 aec_enable; | |
843 #if (L1_NEW_AEC) | |
844 BOOL continuous_filtering; | |
845 UINT16 granularity_attenuation; | |
846 UINT16 smoothing_coefficient; | |
847 UINT16 max_echo_suppression_level; | |
848 UINT16 vad_factor; | |
849 UINT16 absolute_threshold; | |
850 UINT16 factor_asd_filtering; | |
851 UINT16 factor_asd_muting; | |
852 UINT16 aec_visibility; // UINT16 and not boolean because in L1, it is in aec_control | |
853 #else | |
854 /* Mode of the AEC */ | |
855 UINT16 aec_mode; | |
856 /* level of the echo cancellation */ | |
857 UINT16 echo_suppression_level; | |
858 #endif | |
859 /* enable the noise suppression */ | |
860 UINT16 noise_suppression_enable; | |
861 /* level of the noise suppression */ | |
862 UINT16 noise_suppression_level; | |
863 } | |
864 T_AUDIO_AEC_CFG; | |
865 | |
866 typedef struct | |
867 { | |
868 /* gain of the sidetone */ | |
869 INT8 sidetone_gain; | |
870 /* configuration of the acoustic echo cancellation */ | |
871 T_AUDIO_AEC_CFG aec; | |
872 } | |
873 T_AUDIO_MICROPHONE_SPEAKER_LOOP_SETTING; | |
874 | |
875 /****************************************/ | |
876 /* audio mode file struture */ | |
877 /* this file is in the folder /AUDCFG/ */ | |
878 /* and has the extention .CFG */ | |
879 /****************************************/ | |
880 typedef struct | |
881 { | |
882 /* group of setting to define the audio path used */ | |
883 T_AUDIO_VOICE_PATH_SETTING audio_path_setting; | |
884 /* group of setting to configure the audio path of the microphone */ | |
885 T_AUDIO_MICROPHONE_SETTING audio_microphone_setting; | |
886 /* group of setting to configure the audio path of the speaker */ | |
887 T_AUDIO_SPEAKER_SETTING audio_speaker_setting; | |
888 /* group of setting to configure the audio mode involved */ | |
889 /* in tr microhpone and speaker loop */ | |
890 T_AUDIO_MICROPHONE_SPEAKER_LOOP_SETTING audio_microphone_speaker_loop_setting; | |
891 } | |
892 T_AUDIO_MODE; | |
893 | |
894 /****************************************/ | |
895 /* audio volume file struture */ | |
896 /* this file is in the folder /AUDCFG/ */ | |
897 /* and has the extention .VOL */ | |
898 /****************************************/ | |
899 /* speaker volume action */ | |
900 #define AUDIO_SPEAKER_VOLUME_INCREASE (0) | |
901 #define AUDIO_SPEAKER_VOLUME_DECREASE (1) | |
902 #define AUDIO_SPEAKER_VOLUME_SET (2) | |
903 | |
904 /* speaker volume value */ | |
905 #define AUDIO_SPEAKER_VOLUME_MUTE (0) | |
906 #define AUDIO_SPEAKER_VOLUME_24dB (1) | |
907 #define AUDIO_SPEAKER_VOLUME_18dB (50) | |
908 #define AUDIO_SPEAKER_VOLUME_12dB (100) | |
909 #define AUDIO_SPEAKER_VOLUME_6dB (150) | |
910 #define AUDIO_SPEAKER_VOLUME_0dB (200) | |
911 typedef struct | |
912 { | |
913 /* volume of the audio speaker */ | |
914 UINT8 audio_speaker_level; | |
915 } | |
916 T_AUDIO_SPEAKER_LEVEL; | |
917 | |
918 /******************/ | |
919 /* MMI family API */ | |
920 /******************/ | |
921 | |
922 | |
923 /* structure */ | |
924 /* maximum number of number of the filname characters */ | |
925 #define AUDIO_MODE_FILENAME_MAX_SIZE (10) | |
926 | |
927 typedef struct | |
928 { | |
929 char audio_mode_filename[AUDIO_MODE_FILENAME_MAX_SIZE]; | |
930 } | |
931 T_AUDIO_MODE_LOAD; | |
932 | |
933 typedef struct | |
934 { | |
935 char audio_mode_filename[AUDIO_MODE_FILENAME_MAX_SIZE]; | |
936 } | |
937 T_AUDIO_MODE_SAVE; | |
938 | |
939 typedef struct | |
940 { | |
941 INT8 volume_action; | |
942 UINT8 value; | |
943 } | |
944 T_AUDIO_SPEAKER_VOLUME; | |
945 | |
946 /* Prototypes of MMI family*/ | |
947 T_AUDIO_RET audio_mode_load (T_AUDIO_MODE_LOAD *p_parameter, | |
948 T_RV_RETURN return_path); | |
949 | |
950 T_AUDIO_RET audio_mode_save (T_AUDIO_MODE_SAVE *p_parameter, | |
951 T_RV_RETURN return_path); | |
952 | |
953 T_AUDIO_RET audio_speaker_volume ( T_AUDIO_SPEAKER_VOLUME volume, | |
954 T_RV_RETURN return_path); | |
955 | |
956 /* Event return of the MMI family API*/ | |
957 #define AUDIO_MODE_LOAD_DONE (0x0010 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
958 typedef struct | |
959 { | |
960 T_RV_HDR os_hdr; | |
961 INT8 status; | |
962 } T_AUDIO_LOAD_DONE; | |
963 | |
964 #define AUDIO_MODE_SAVE_DONE (0x0011 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
965 typedef struct | |
966 { | |
967 T_RV_HDR os_hdr; | |
968 INT8 status; | |
969 } T_AUDIO_SAVE_DONE; | |
970 | |
971 #define AUDIO_SPEAKER_VOLUME_DONE (0x0012 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
972 typedef struct | |
973 { | |
974 T_RV_HDR os_hdr; | |
975 INT8 status; | |
976 } T_AUDIO_VOLUME_DONE; | |
977 | |
978 | |
979 /**********************/ | |
980 /* Full Access Family */ | |
981 /**********************/ | |
982 | |
983 /* structure */ | |
984 typedef struct | |
985 { | |
986 UINT8 variable_indentifier; | |
987 void *data; | |
988 } | |
989 T_AUDIO_FULL_ACCESS_WRITE; | |
990 | |
991 typedef struct | |
992 { | |
993 UINT8 variable_indentifier; | |
994 void *data; | |
995 } | |
996 T_AUDIO_FULL_ACCESS_READ; | |
997 | |
998 /* parameter */ | |
999 #define AUDIO_PATH_USED (0) | |
1000 #define AUDIO_MICROPHONE_MODE (1) | |
1001 #define AUDIO_MICROPHONE_GAIN (2) | |
1002 #define AUDIO_MICROPHONE_EXTRA_GAIN (3) | |
1003 #define AUDIO_MICROPHONE_OUTPUT_BIAS (4) | |
1004 #define AUDIO_MICROPHONE_FIR (5) | |
1005 #define AUDIO_SPEAKER_MODE (6) | |
1006 #define AUDIO_SPEAKER_GAIN (7) | |
1007 #define AUDIO_SPEAKER_FILTER (8) | |
1008 #define AUDIO_SPEAKER_FIR (9) | |
1009 #define AUDIO_SPEAKER_BUZZER_STATE (10) | |
1010 #define AUDIO_MICROPHONE_SPEAKER_LOOP_SIDETONE (11) | |
1011 #define AUDIO_MICROPHONE_SPEAKER_LOOP_AEC (12) | |
1012 #define AUDIO_SPEAKER_VOLUME_LEVEL (13) | |
1013 | |
1014 | |
1015 /* prototype */ | |
1016 T_AUDIO_RET audio_full_access_write (T_AUDIO_FULL_ACCESS_WRITE *p_parameter, | |
1017 T_RV_RETURN return_path); | |
1018 | |
1019 T_AUDIO_RET audio_full_access_read (T_AUDIO_FULL_ACCESS_READ *p_parameter); | |
1020 | |
1021 | |
1022 /* Event returned ofthe Full Access Family */ | |
1023 #define AUDIO_FULL_ACCESS_WRITE_DONE (0x0013 | AUDIO_EVENT_EXTERN | AUDIO_EVENTS_MASK) | |
1024 typedef struct | |
1025 { | |
1026 T_RV_HDR os_hdr; | |
1027 INT8 status; | |
1028 } T_AUDIO_FULL_ACCESS_WRITE_DONE; | |
1029 | |
1030 #ifdef __cplusplus | |
1031 } | |
1032 #endif | |
1033 | |
1034 #endif /* __AUDIO_API_H_ */ | |
1035 | |
1036 |