FreeCalypso > hg > tcs211-fcmodem
comparison chipsetsw/services/Audio/audio_compatibilities.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /****************************************************************************/ | |
2 /* */ | |
3 /* File Name: audio_compatibilities.c */ | |
4 /* */ | |
5 /* Purpose: This file contains all the functions used to manage the audio */ | |
6 /* feature compatibilites */ | |
7 /* */ | |
8 /* Version 0.1 */ | |
9 /* */ | |
10 /* Date Modification */ | |
11 /* ------------------------------------------------------------------------*/ | |
12 /* 12 November 2001 Create */ | |
13 /* */ | |
14 /* Author Francois Mazard */ | |
15 /* */ | |
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ | |
17 /****************************************************************************/ | |
18 | |
19 #include "rv/rv_defined_swe.h" | |
20 | |
21 #ifdef RVM_AUDIO_MAIN_SWE | |
22 #ifndef _WINDOWS | |
23 #include "config/swconfig.cfg" | |
24 #include "config/sys.cfg" | |
25 #include "config/chipset.cfg" | |
26 #endif | |
27 | |
28 | |
29 #include "l1_confg.h" | |
30 #include "rvf/rvf_api.h" | |
31 #include "rv/rv_general.h" | |
32 #include "rvm/rvm_gen.h" | |
33 #include "audio/audio_api.h" | |
34 #include "audio/audio_env_i.h" | |
35 #include "audio/audio_ffs_i.h" | |
36 #include "audio/audio_structs_i.h" | |
37 #include "audio/audio_macro_i.h" | |
38 #include "rvf/rvf_target.h" | |
39 #include "audio/audio_const_i.h" | |
40 #include "audio/audio_var_i.h" | |
41 #include "audio/audio_error_hdlr_i.h" | |
42 #include "audio/audio_messages_i.h" | |
43 #include "audio/audio_compatibilities.h" | |
44 #include "ffs/ffs_api.h" | |
45 | |
46 #if (L1_GTT == 1) | |
47 #include "tty/tty_i.h" | |
48 #endif | |
49 #if (L1_GTT == 1) | |
50 extern void tty_send_status (T_AUDIO_RET status, T_RV_RETURN return_path); | |
51 extern T_TTY_ENV_CTRL_BLK *tty_env_ctrl_blk_p; | |
52 #endif | |
53 /* Audio compatibilities table described in the annex of thespec S916 */ | |
54 /* 0: uncompatible */ | |
55 /* 1: compatible */ | |
56 /* Note the melody is compatible with a melody: GAME mode */ | |
57 #if (DSP == 36) | |
58 T_AUDIO_COMPATIBILITES audio_feature_compatibilities_table[AUDIO_NUMBER_OF_FEATURES] = | |
59 { | |
60 /* keybeep Tones Melody E1 VM play VM record enroll update reco MelodyE2 TTY VMA pl VMA rec MIDI*/ | |
61 /* Keybeep */ {0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1}, | |
62 /* Tone */ {1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1}, | |
63 /* Melody E1*/ {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
64 /* VM play */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
65 /* VM record*/ {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
66 /* SR enroll*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
67 /* SR update*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
68 /* SR reco */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
69 /* Melody E2*/ {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, | |
70 /* TTY */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
71 /* VMA play */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
72 /* VMA rec */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
73 /* MIDI */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
74 }; | |
75 #endif /* DSP=36 */ | |
76 #if (DSP == 34) | |
77 T_AUDIO_COMPATIBILITES audio_feature_compatibilities_table[AUDIO_NUMBER_OF_FEATURES] = | |
78 { | |
79 /* keybeep Tones Melody E1 VM play VM record enroll update reco MelodyE2 TTY VMA pl VMA rec MIDI */ | |
80 /* Keybeep */ {0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0}, | |
81 /* Tone */ {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0}, | |
82 /* Melody E1*/ {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
83 /* VM play */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
84 /* VM record*/ {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
85 /* SR enroll*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
86 /* SR update*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
87 /* SR reco */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
88 /* Melody E2*/ {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, | |
89 /* TTY */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
90 /* VMA play */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
91 /* VMA rec */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
92 /* MIDI */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
93 }; | |
94 #endif | |
95 #if ((DSP == 32) || (DSP == 33)) | |
96 T_AUDIO_COMPATIBILITES audio_feature_compatibilities_table[AUDIO_NUMBER_OF_FEATURES] = | |
97 { | |
98 /* keybeep Tones Melody E1 VM play VM record enroll update reco MelodyE2 TTY VMA pl VMA rec MIDI */ | |
99 /* Keybeep */ {0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0}, | |
100 /* Tone */ {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
101 /* Melody E1 */ {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
102 /* VM play */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
103 /* VM record */ {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
104 /* SR enroll */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
105 /* SR update */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
106 /* SR reco */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
107 /* Melody E2 */ {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, | |
108 /* TTY */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
109 /* VMA play */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
110 /* VMA rec */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
111 /* MIDI */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
112 }; | |
113 #endif /* DSP=32 or 33 */ | |
114 | |
115 #if (DSP == 17) | |
116 T_AUDIO_COMPATIBILITES audio_feature_compatibilities_table[AUDIO_NUMBER_OF_FEATURES] = | |
117 { | |
118 /* keybeep Tones Melody E1 VM play VM record enroll update reco MelodyE2 TTY VMA pl VMA rec MIDI */ | |
119 /* Keybeep */ {0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0}, | |
120 /* Tone */ {1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
121 /* Melody E1*/ {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
122 /* VM play */ {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
123 /* VM record*/ {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
124 /* SR enroll*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
125 /* SR update*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
126 /* SR reco */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
127 /* Melody E2*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
128 /* TTY */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
129 /* VMA play */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
130 /* VMA rec */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
131 /* MIDI */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | |
132 }; | |
133 #endif /* DSP=17 */ | |
134 | |
135 /********************************************************************************/ | |
136 /* */ | |
137 /* Function Name: audio_compatibilities_feature_id */ | |
138 /* */ | |
139 /* Purpose: Return the identifier of the feature to start. */ | |
140 /* */ | |
141 /* Input Parameters: */ | |
142 /* start message from any audio features */ | |
143 /* */ | |
144 /* Output Parameters: */ | |
145 /* identifier of the audio features or AUDIO_NO_START_MESSAGE if it */ | |
146 /* isn't a starting message. */ | |
147 /* */ | |
148 /* Note: */ | |
149 /* None. */ | |
150 /* */ | |
151 /* Revision History: */ | |
152 /* None. */ | |
153 /* */ | |
154 /********************************************************************************/ | |
155 INT8 audio_compatibilities_feature_id (T_RV_HDR *p_message) | |
156 { | |
157 switch(p_message->msg_id) | |
158 { | |
159 #if (KEYBEEP) | |
160 case AUDIO_KEYBEEP_START_REQ: | |
161 { | |
162 return (AUDIO_KEYBEEP_FEATURE); | |
163 } | |
164 #endif | |
165 #if (TONE) | |
166 case AUDIO_TONES_START_REQ: | |
167 { | |
168 return (AUDIO_TONES_FEATURE); | |
169 } | |
170 #endif | |
171 #if (MELODY_E1) | |
172 case AUDIO_MELODY_E1_START_REQ: | |
173 { | |
174 return (AUDIO_MELODY_E1_FEATURE); | |
175 } | |
176 #endif | |
177 #if (VOICE_MEMO) | |
178 case AUDIO_VM_PLAY_START_REQ: | |
179 { | |
180 return (AUDIO_VOICE_MEMO_PLAY_FEATURE); | |
181 } | |
182 case AUDIO_VM_RECORD_START_REQ: | |
183 { | |
184 return (AUDIO_VOICE_MEMO_RECORD_FEATURE); | |
185 } | |
186 #endif | |
187 #if (L1_VOICE_MEMO_AMR) | |
188 case AUDIO_VM_AMR_PLAY_FROM_FFS_START_REQ: | |
189 case AUDIO_VM_AMR_PLAY_FROM_RAM_START_REQ: | |
190 { | |
191 return (AUDIO_VOICE_MEMO_AMR_PLAY_FEATURE); | |
192 } | |
193 case AUDIO_VM_AMR_RECORD_TO_FFS_START_REQ: | |
194 case AUDIO_VM_AMR_RECORD_TO_RAM_START_REQ: | |
195 { | |
196 return (AUDIO_VOICE_MEMO_AMR_RECORD_FEATURE); | |
197 } | |
198 #endif | |
199 #if (SPEECH_RECO) | |
200 case AUDIO_SR_ENROLL_START_REQ: | |
201 { | |
202 return (AUDIO_SR_ENROLL_FEATURE); | |
203 } | |
204 case AUDIO_SR_UPDATE_START_REQ: | |
205 { | |
206 return (AUDIO_SR_UPDATE_FEATURE); | |
207 } | |
208 #endif | |
209 #if (MELODY_E2) | |
210 case AUDIO_MELODY_E2_START_REQ: | |
211 { | |
212 return (AUDIO_MELODY_E2_FEATURE); | |
213 } | |
214 #endif | |
215 #if (L1_GTT == 1) | |
216 case TTY_START_REQ: | |
217 { | |
218 return (AUDIO_TTY_FEATURE); | |
219 } | |
220 #endif | |
221 #if (L1_MIDI==1) | |
222 case AUDIO_MIDI_START_REQ: | |
223 { | |
224 return (AUDIO_MIDI_FEATURE); | |
225 } | |
226 #endif | |
227 default: | |
228 { | |
229 return (AUDIO_NO_START_MESSAGE); | |
230 } | |
231 } | |
232 } | |
233 | |
234 /********************************************************************************/ | |
235 /* */ | |
236 /* Function Name: audio_compatibilities_feature_active */ | |
237 /* */ | |
238 /* Purpose: Return the list of the active feature. */ | |
239 /* */ | |
240 /* Input Parameters: */ | |
241 /* An empty table. */ | |
242 /* */ | |
243 /* Output Parameters: */ | |
244 /* List of the current audio feature actif. */ | |
245 /* */ | |
246 /* Note: */ | |
247 /* None. */ | |
248 /* */ | |
249 /* Revision History: */ | |
250 /* None. */ | |
251 /* */ | |
252 /********************************************************************************/ | |
253 void audio_compatibilities_feature_active (T_AUDIO_ACTIVE_FEATURE *p_audio_feature_active) | |
254 { | |
255 #if (KEYBEEP) | |
256 p_audio_feature_active->feature[AUDIO_KEYBEEP_FEATURE] = | |
257 (p_audio_gbl_var->keybeep.state > AUDIO_KEYBEEP_IDLE); | |
258 #else | |
259 p_audio_feature_active->feature[AUDIO_KEYBEEP_FEATURE] = 0; | |
260 #endif | |
261 | |
262 #if (TONE) | |
263 p_audio_feature_active->feature[AUDIO_TONES_FEATURE] = | |
264 (p_audio_gbl_var->tones.state > AUDIO_TONES_IDLE); | |
265 #else | |
266 p_audio_feature_active->feature[AUDIO_TONES_FEATURE] = 0; | |
267 #endif | |
268 | |
269 #if (MELODY_E1) | |
270 p_audio_feature_active->feature[AUDIO_MELODY_E1_FEATURE] = | |
271 ((p_audio_gbl_var->melody_E1_0.state > AUDIO_MELODY_E1_IDLE) || | |
272 (p_audio_gbl_var->melody_E1_1.state > AUDIO_MELODY_E1_IDLE)); | |
273 #else | |
274 p_audio_feature_active->feature[AUDIO_MELODY_E1_FEATURE] = 0; | |
275 #endif | |
276 | |
277 #if (VOICE_MEMO) | |
278 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_PLAY_FEATURE] = | |
279 (p_audio_gbl_var->vm_play.state > AUDIO_VM_PLAY_IDLE); | |
280 | |
281 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_RECORD_FEATURE] = | |
282 (p_audio_gbl_var->vm_record.state > AUDIO_VM_RECORD_IDLE); | |
283 #else | |
284 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_PLAY_FEATURE] = 0; | |
285 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_RECORD_FEATURE] = 0; | |
286 #endif | |
287 #if (L1_VOICE_MEMO_AMR) && (AUDIO_MEM_MANAGER) | |
288 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_AMR_PLAY_FEATURE] = | |
289 (p_audio_gbl_var->audio_vm_amr_play.state > AUDIO_IDLE); | |
290 | |
291 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_AMR_RECORD_FEATURE] = | |
292 (p_audio_gbl_var->audio_vm_amr_record.state > AUDIO_IDLE); | |
293 #else | |
294 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_AMR_PLAY_FEATURE] = 0; | |
295 p_audio_feature_active->feature[AUDIO_VOICE_MEMO_AMR_RECORD_FEATURE] = 0; | |
296 #endif | |
297 | |
298 #if (SPEECH_RECO) | |
299 p_audio_feature_active->feature[AUDIO_SR_ENROLL_FEATURE] = | |
300 (p_audio_gbl_var->speech_reco.sr_enroll.state > AUDIO_SR_ENROLL_IDLE); | |
301 p_audio_feature_active->feature[AUDIO_SR_UPDATE_FEATURE] = | |
302 (p_audio_gbl_var->speech_reco.sr_update.state > AUDIO_SR_UPDATE_IDLE); | |
303 p_audio_feature_active->feature[AUDIO_SR_RECO_FEATURE] = | |
304 (p_audio_gbl_var->speech_reco.sr_reco.state > AUDIO_SR_RECO_IDLE); | |
305 #else | |
306 p_audio_feature_active->feature[AUDIO_SR_ENROLL_FEATURE] = 0; | |
307 p_audio_feature_active->feature[AUDIO_SR_UPDATE_FEATURE] = 0; | |
308 p_audio_feature_active->feature[AUDIO_SR_RECO_FEATURE] = 0; | |
309 #endif | |
310 | |
311 #if (MELODY_E2) | |
312 p_audio_feature_active->feature[AUDIO_MELODY_E2_FEATURE] = | |
313 ((p_audio_gbl_var->melody_E2_0.state > AUDIO_MELODY_E2_IDLE) || | |
314 (p_audio_gbl_var->melody_E2_1.state > AUDIO_MELODY_E2_IDLE)); | |
315 #else | |
316 p_audio_feature_active->feature[AUDIO_MELODY_E2_FEATURE] = 0; | |
317 #endif | |
318 | |
319 #if (L1_GTT == 1) | |
320 p_audio_feature_active->feature[AUDIO_TTY_FEATURE] = | |
321 (tty_env_ctrl_blk_p->state > TTY_IDLE); | |
322 #else | |
323 p_audio_feature_active->feature[AUDIO_TTY_FEATURE] = 0; | |
324 #endif | |
325 | |
326 #if (L1_MIDI==1) | |
327 p_audio_feature_active->feature[AUDIO_MIDI_FEATURE] = | |
328 (p_audio_gbl_var->midi.state>AUDIO_IDLE); | |
329 #else | |
330 p_audio_feature_active->feature[AUDIO_MIDI_FEATURE] = 0; | |
331 #endif | |
332 } | |
333 | |
334 /********************************************************************************/ | |
335 /* */ | |
336 /* Function Name: audio_compatibilities_manager */ | |
337 /* */ | |
338 /* Purpose: manage the compatibilities between the audio fatures. */ | |
339 /* */ | |
340 /* Input Parameters: */ | |
341 /* The message of the start request. */ | |
342 /* */ | |
343 /* Output Parameters: */ | |
344 /* Flag to indicate if the task can be start or not. */ | |
345 /* Note: this manager send automatically the status message */ | |
346 /* corresponding to the audio feature. */ | |
347 /* */ | |
348 /* Note: */ | |
349 /* None. */ | |
350 /* */ | |
351 /* Revision History: */ | |
352 /* None. */ | |
353 /* */ | |
354 /********************************************************************************/ | |
355 BOOLEAN audio_compatibilities_manager (T_RV_HDR *p_message) | |
356 { | |
357 T_AUDIO_ACTIVE_FEATURE active_list; | |
358 INT8 feature_to_start, i; | |
359 BOOLEAN feature_can_start = TRUE; | |
360 | |
361 /* Find the features to start */ | |
362 feature_to_start = audio_compatibilities_feature_id(p_message); | |
363 | |
364 /* if the message is a start message */ | |
365 if (feature_to_start != AUDIO_NO_START_MESSAGE) | |
366 { | |
367 /* List the current active feature */ | |
368 audio_compatibilities_feature_active(&active_list); | |
369 | |
370 i = -1; | |
371 while ((feature_can_start) && | |
372 (++i < AUDIO_NUMBER_OF_FEATURES)) | |
373 { | |
374 feature_can_start = (!(active_list.feature[i]) | | |
375 audio_feature_compatibilities_table[feature_to_start].compatibilities_flag[i]); | |
376 } | |
377 | |
378 /* send the status message if the feature can't start */ | |
379 if (feature_can_start == FALSE) | |
380 { | |
381 switch (feature_to_start) | |
382 { | |
383 #if (KEYBEEP) | |
384 case AUDIO_KEYBEEP_FEATURE: | |
385 { | |
386 audio_keybeep_send_status (AUDIO_ERROR, ((T_AUDIO_KEYBEEP_START *)(p_message))->return_path); | |
387 AUDIO_SEND_TRACE(" AUDIO ERROR: Keybeep isn't compatible with a running task", | |
388 RV_TRACE_LEVEL_ERROR); | |
389 p_audio_gbl_var->message_processed = TRUE; | |
390 break; | |
391 } | |
392 #endif | |
393 #if (TONE) | |
394 case AUDIO_TONES_FEATURE: | |
395 { | |
396 audio_tones_send_status (AUDIO_ERROR, ((T_AUDIO_TONES_START *)(p_message))->return_path); | |
397 AUDIO_SEND_TRACE(" AUDIO ERROR: Tone isn't compatible with a running task", | |
398 RV_TRACE_LEVEL_ERROR); | |
399 p_audio_gbl_var->message_processed = TRUE; | |
400 break; | |
401 } | |
402 #endif | |
403 #if (VOICE_MEMO) | |
404 case AUDIO_VOICE_MEMO_PLAY_FEATURE: | |
405 { | |
406 /* close the file opened */ | |
407 #ifndef _WINDOWS | |
408 if ( ffs_close(((T_AUDIO_VM_PLAY_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
409 { | |
410 audio_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
411 } | |
412 #endif | |
413 audio_vm_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_PLAY_START *)(p_message))->return_path); | |
414 AUDIO_SEND_TRACE(" AUDIO ERROR: VM play isn't compatible with a running task", | |
415 RV_TRACE_LEVEL_ERROR); | |
416 p_audio_gbl_var->message_processed = TRUE; | |
417 break; | |
418 } | |
419 case AUDIO_VOICE_MEMO_RECORD_FEATURE: | |
420 { | |
421 /* close the file opened */ | |
422 #ifndef _WINDOWS | |
423 if ( ffs_close(((T_AUDIO_VM_RECORD_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
424 { | |
425 audio_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
426 } | |
427 #endif | |
428 audio_vm_record_send_status (AUDIO_ERROR, 0, ((T_AUDIO_VM_RECORD_START *)(p_message))->return_path); | |
429 AUDIO_SEND_TRACE(" AUDIO ERROR: VM record isn't compatible with a running task", | |
430 RV_TRACE_LEVEL_ERROR); | |
431 p_audio_gbl_var->message_processed = TRUE; | |
432 break; | |
433 } | |
434 #endif | |
435 #if (L1_VOICE_MEMO_AMR) | |
436 case AUDIO_VOICE_MEMO_AMR_PLAY_FEATURE: | |
437 { | |
438 switch (p_message->msg_id) | |
439 { | |
440 #if (AUDIO_NEW_FFS_MANAGER) | |
441 case AUDIO_VM_AMR_PLAY_FROM_FFS_START_REQ: | |
442 /* close the file opened */ | |
443 if ( ffs_close(((T_AUDIO_VM_AMR_PLAY_FROM_FFS_START *)p_message)->audio_ffs_fd) != EFFS_OK ) | |
444 { | |
445 audio_new_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
446 } | |
447 audio_vm_amr_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_AMR_PLAY_FROM_FFS_START *)p_message)->return_path); | |
448 break; | |
449 #endif | |
450 #if (AUDIO_RAM_MANAGER) | |
451 case AUDIO_VM_AMR_PLAY_FROM_RAM_START_REQ: | |
452 audio_vm_amr_play_send_status (AUDIO_ERROR, ((T_AUDIO_VM_AMR_PLAY_FROM_RAM_START *)p_message)->return_path); | |
453 break; | |
454 #endif | |
455 } | |
456 #if (AUDIO_MEM_MANAGER) | |
457 AUDIO_SEND_TRACE(" AUDIO ERROR: VM AMR play isn't compatible with a running task", | |
458 RV_TRACE_LEVEL_ERROR); | |
459 #endif | |
460 p_audio_gbl_var->message_processed = TRUE; | |
461 } | |
462 break; | |
463 case AUDIO_VOICE_MEMO_AMR_RECORD_FEATURE: | |
464 { | |
465 switch (p_message->msg_id) | |
466 { | |
467 #if (AUDIO_NEW_FFS_MANAGER) | |
468 case AUDIO_VM_AMR_RECORD_TO_FFS_START_REQ: | |
469 /* close the file opened */ | |
470 if ( ffs_close(((T_AUDIO_VM_AMR_RECORD_TO_FFS_START *)p_message)->audio_ffs_fd) != EFFS_OK ) | |
471 { | |
472 audio_new_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
473 } | |
474 audio_vm_amr_record_send_status (AUDIO_ERROR, 0, ((T_AUDIO_VM_AMR_RECORD_TO_FFS_START *)p_message)->return_path); | |
475 break; | |
476 #endif | |
477 #if (AUDIO_RAM_MANAGER) | |
478 case AUDIO_VM_AMR_RECORD_TO_RAM_START_REQ: | |
479 audio_vm_amr_record_send_status (AUDIO_ERROR, 0, ((T_AUDIO_VM_AMR_RECORD_TO_RAM_START *)p_message)->return_path); | |
480 break; | |
481 #endif | |
482 } | |
483 #if (AUDIO_MEM_MANAGER) | |
484 AUDIO_SEND_TRACE(" AUDIO ERROR: VM AMR record isn't compatible with a running task", | |
485 RV_TRACE_LEVEL_ERROR); | |
486 #endif | |
487 p_audio_gbl_var->message_processed = TRUE; | |
488 } | |
489 break; | |
490 #endif | |
491 #if (MELODY_E1) | |
492 case AUDIO_MELODY_E1_FEATURE: | |
493 { | |
494 /* close the file opened */ | |
495 #ifndef _WINDOWS | |
496 if ( ffs_close(((T_AUDIO_MELODY_E1_START *)(p_message))->audio_ffs_fd) != EFFS_OK ) | |
497 { | |
498 audio_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
499 } | |
500 #endif | |
501 audio_melody_E1_send_status (AUDIO_ERROR, ((T_AUDIO_MELODY_E1_START *)(p_message))->return_path); | |
502 AUDIO_SEND_TRACE(" AUDIO ERROR: MELODY E1 isn't compatible with a running task", | |
503 RV_TRACE_LEVEL_ERROR); | |
504 p_audio_gbl_var->message_processed = TRUE; | |
505 break; | |
506 } | |
507 #endif | |
508 #if (SPEECH_RECO) | |
509 case AUDIO_SR_ENROLL_FEATURE: | |
510 { | |
511 /* close the model file */ | |
512 /* close the voice sample file if it exists*/ | |
513 #ifndef _WINDOWS | |
514 ffs_close(((T_AUDIO_SR_ENROLL_START *)(p_message))->sr_ffs_fd); | |
515 if ( ((T_AUDIO_SR_ENROLL_START *)(p_message))->voice_ffs_fd != AUDIO_SR_NO_RECORD_SPEECH) | |
516 { | |
517 ffs_close(((T_AUDIO_SR_ENROLL_START *)(p_message))->voice_ffs_fd); | |
518 } | |
519 #endif | |
520 | |
521 /* event error - send an error message*/ | |
522 audio_sr_enroll_send_status (AUDIO_ERROR, | |
523 ((T_AUDIO_SR_ENROLL_START *)(p_message))->return_path); | |
524 AUDIO_SEND_TRACE(" AUDIO ERROR: SR Enroll isn't compatible with a running task", | |
525 RV_TRACE_LEVEL_ERROR); | |
526 p_audio_gbl_var->message_processed = TRUE; | |
527 break; | |
528 } | |
529 case AUDIO_SR_UPDATE_FEATURE: | |
530 { | |
531 /* Free the database buffer */ | |
532 rvf_free_buf( (T_RVF_BUFFER *)(((T_AUDIO_SR_UPDATE_START *)(p_message))->p_database) ); | |
533 | |
534 /* event error - send an error message*/ | |
535 audio_sr_update_send_status (AUDIO_ERROR, | |
536 ((T_AUDIO_SR_UPDATE_START *)(p_message))->return_path); | |
537 AUDIO_SEND_TRACE(" AUDIO ERROR: SR upate isn't compatible with a running task", | |
538 RV_TRACE_LEVEL_ERROR); | |
539 p_audio_gbl_var->message_processed = TRUE; | |
540 break; | |
541 } | |
542 case AUDIO_SR_RECO_FEATURE: | |
543 { | |
544 /* Free the database buffer */ | |
545 rvf_free_buf( (T_RVF_BUFFER *)(((T_AUDIO_SR_RECO_START *)(p_message))->p_database) ); | |
546 | |
547 /* event error - send an error message*/ | |
548 audio_sr_reco_send_status (AUDIO_ERROR, 0, | |
549 ((T_AUDIO_SR_RECO_START *)(p_message))->return_path); | |
550 AUDIO_SEND_TRACE(" AUDIO ERROR: SR reco isn't compatible with a running task", | |
551 RV_TRACE_LEVEL_ERROR); | |
552 p_audio_gbl_var->message_processed = TRUE; | |
553 break; | |
554 } | |
555 #endif | |
556 #if (MELODY_E2) | |
557 case AUDIO_MELODY_E2_FEATURE: | |
558 { | |
559 /* close the file opened */ | |
560 #ifndef _WINDOWS | |
561 if ( ffs_close(((T_AUDIO_MELODY_E2_START *)(p_message))->audio_E2_ffs_fd) != EFFS_OK ) | |
562 { | |
563 audio_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
564 } | |
565 #endif | |
566 audio_melody_E2_send_status (AUDIO_ERROR, ((T_AUDIO_MELODY_E2_START *)(p_message))->return_path); | |
567 AUDIO_SEND_TRACE(" AUDIO ERROR: MELODY E2 isn't compatible with a running task", | |
568 RV_TRACE_LEVEL_ERROR); | |
569 p_audio_gbl_var->message_processed = TRUE; | |
570 break; | |
571 } | |
572 #endif | |
573 #if (L1_GTT == 1) | |
574 case AUDIO_TTY_FEATURE: | |
575 { | |
576 tty_send_status (AUDIO_ERROR, ((T_TTY_START *)(p_message))->return_path); | |
577 AUDIO_SEND_TRACE(" AUDIO ERROR: TTY isn't compatible with a running task", | |
578 RV_TRACE_LEVEL_ERROR); | |
579 p_audio_gbl_var->message_processed = TRUE; | |
580 break; | |
581 } | |
582 #endif | |
583 #if (L1_MIDI==1) | |
584 case AUDIO_MIDI_FEATURE: | |
585 { | |
586 audio_midi_send_status(AUDIO_ERROR,&((T_AUDIO_MIDI_START *)p_message)->return_path); | |
587 AUDIO_SEND_TRACE(" AUDIO ERROR: MIDI isn't compatible with a running task", | |
588 RV_TRACE_LEVEL_ERROR); | |
589 p_audio_gbl_var->message_processed = TRUE; | |
590 break; | |
591 } | |
592 #endif | |
593 } | |
594 } /* feature_can_start == FALSE */ | |
595 } | |
596 return (feature_can_start); | |
597 } | |
598 #endif /* RVM_AUDIO_MAIN_SWE */ |