FreeCalypso > hg > fc-magnetite
annotate src/aci2/aci/ati_audio.c @ 268:f5c10ec9c5fd
init.c: module passes compilation,
Init_Drivers() and Init_Serial_Flows() functions are good,
Init_Target() and Init_Unmask_IT() need further work
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 06 Aug 2017 09:21:57 +0000 |
parents | 3edeadec6804 |
children | d85305a74518 |
rev | line source |
---|---|
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This ATI module and the AT commands implemented therein are a FreeCalypso |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * addition. The purpose of these AT commands is to exercise the audio |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * capabilities of the firmware - by using these commands, you should be |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * able to emit sounds from the speaker or record voice from the microphone |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * without needing to be in a call, and without bringing up GSM at all. |
245
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
7 * |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
8 * Our corrected implementation of the AT@AUL command (originally added |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
9 * by Openmoko) has been moved into this module as well. |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #ifndef ATI_AUDIO_C |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #define ATI_AUDIO_C |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "aci_all.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include <ctype.h> |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include <string.h> |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #include "aci_cmh.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #include "ati_cmd.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "aci_cmd.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "aci_io.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "aci_cmd.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "l4_tim.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "line_edit.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "aci_lst.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #include "pcm.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include "audio.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "aci.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "rx.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "pwr.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #include "l4_tim.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #ifdef GPRS |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 #ifdef DTI |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #include "dti.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 #include "dti_conn_mng.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #include "dti_cntrl_mng.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 #endif /* DTI */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 #include "gaci.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #include "gaci_cmh.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 #include "gaci_cmd.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 #endif /* GPRS */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 #include "aci_mem.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 #include "aci_prs.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 #include "ati_int.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 #ifndef _SIMULATION_ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 #include "ffs/ffs.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 #endif |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 #ifdef FF_ATI_BAT |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 #include "typedefs.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 #include "gdd.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 #include "bat.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 #include "ati_bat.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 #endif /*FF_ATI_BAT*/ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 #include "audio/audio_api.h" |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 #include "audio.h" /* Condat */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
264
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
69 #include "fc-target.cfg" |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
70 #include "armio.h" |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
71 |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
72 #ifdef CONFIG_TARGET_FCDEV3B |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
73 /* AT@SPKR - turn loudspeaker amplifier on or off */ |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
74 GLOBAL T_ATI_RSLT atAtSPKR ( char *cl, UBYTE srcId ) |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
75 { |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
76 int state; |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
77 |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
78 cl = parse(cl, "D", &state); |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
79 if (!cl) |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
80 return (ATI_FAIL); |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
81 if (state) |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
82 AI_SetBit(1); |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
83 else |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
84 AI_ResetBit(1); |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
85 return (ATI_CMPL); |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
86 } |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
87 #endif |
3edeadec6804
aci2: AT@SPKR command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
245
diff
changeset
|
88 |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 /* AT@SND - emit sound through Condat API */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 GLOBAL T_ATI_RSLT atAtSND ( char *cl, UBYTE srcId ) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 { |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 UBYTE sound_id = TONES_KEYBEEP; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 cl = parse(cl, "x", &sound_id); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 audio_PlaySoundID(AUDIO_SPEAKER, sound_id, 0, AUDIO_PLAY_ONCE); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 return (ATI_CMPL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 } |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 static void audio_callback(void *event_from_audio) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 { |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 /* do nothing at this time */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 } |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
245
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
104 /* |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
105 * PURPOSE : @AUL command (Audio table load) |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
106 */ |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
107 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
108 static char aul_name[AUDIO_MODE_FILENAME_MAX_SIZE]; |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
109 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
110 GLOBAL T_ATI_RSLT atAtAUL (char *cl, UBYTE srcId) |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
111 { |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
112 T_AUDIO_MODE_LOAD aul_param; |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
113 T_RV_RETURN return_path; |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
114 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
115 TRACE_FUNCTION("atAtAUL()"); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
116 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
117 cl = parse(cl, "S", (LONG)(sizeof(aul_param.audio_mode_filename)), |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
118 aul_param.audio_mode_filename); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
119 if (!cl || !aul_param.audio_mode_filename[0]) |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
120 return (ATI_FAIL); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
121 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
122 /* Openmoko backward compatibility */ |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
123 if (isdigit(aul_param.audio_mode_filename[0]) && |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
124 !aul_param.audio_mode_filename[1]) |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
125 sprintf(aul_param.audio_mode_filename, "para%c", |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
126 aul_param.audio_mode_filename[0]); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
127 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
128 return_path.addr_id = NULL; |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
129 return_path.callback_func = audio_callback; |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
130 if (audio_mode_load(&aul_param, return_path) == AUDIO_OK) { |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
131 strcpy(aul_name, aul_param.audio_mode_filename); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
132 return (ATI_CMPL); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
133 } else |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
134 return (ATI_FAIL); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
135 } |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
136 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
137 GLOBAL T_ATI_RSLT queatAtAUL (char *cl, UBYTE srcId) |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
138 { |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
139 char *me="@AUL: "; |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
140 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
141 TRACE_FUNCTION("queatAtAUL()"); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
142 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
143 if (aul_name[0]) |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
144 sprintf(g_sa, "%s/aud/%s.cfg", me, aul_name); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
145 else |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
146 sprintf(g_sa, "%s", me); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
147 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
148 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
149 |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
150 return (ATI_CMPL); |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
151 } |
3b8d291ed45a
aci2: AT@AUL reimplemented in the new FreeCalypso way
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
152 |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 /* AT@E1 - play an E1 format melody */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId ) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 { |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 T_AUDIO_MELODY_E1_PARAMETER e1_param; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 T_RV_RETURN return_path; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
159 cl = parse(cl, "S", (LONG)(sizeof(e1_param.melody_name)), |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 e1_param.melody_name); |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
161 if (!cl || !e1_param.melody_name[0]) |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 return (ATI_FAIL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 e1_param.loopback = AUDIO_MELODY_NO_LOOPBACK; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 e1_param.melody_mode = AUDIO_MELODY_NORMAL_MODE; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 return_path.addr_id = NULL; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 return_path.callback_func = audio_callback; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 if (audio_melody_E1_start(&e1_param, return_path) == AUDIO_OK) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 return (ATI_CMPL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 else |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 return (ATI_FAIL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 } |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 /* AT@E2 - play an E2 format melody */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 GLOBAL T_ATI_RSLT atAtE2 ( char *cl, UBYTE srcId ) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 { |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 T_AUDIO_MELODY_E2_PARAMETER e2_param; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 T_RV_RETURN return_path; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
180 cl = parse(cl, "S", (LONG)(sizeof(e2_param.melody_E2_name)), |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 e2_param.melody_E2_name); |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
182 if (!cl || !e2_param.melody_E2_name[0]) |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 return (ATI_FAIL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 e2_param.E2_loopback = AUDIO_MELODY_NO_LOOPBACK; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 e2_param.melody_E2_mode = AUDIO_MELODY_NORMAL_MODE; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 return_path.addr_id = NULL; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 return_path.callback_func = audio_callback; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 if (audio_melody_E2_start(&e2_param, return_path) == AUDIO_OK) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 return (ATI_CMPL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 else |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 return (ATI_FAIL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 } |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 /* AT@E2LSI - load melody E2 instrument list file */ |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 GLOBAL T_ATI_RSLT atAtE2LSI ( char *cl, UBYTE srcId ) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 { |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 T_AUDIO_MELODY_E2_LOAD_FILE_INSTR_PARAMETER e2_lsi_param; |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
200 cl = parse(cl, "S", (LONG)(sizeof(e2_lsi_param.melody_E2_file_name)), |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 e2_lsi_param.melody_E2_file_name); |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
202 if (!cl || !e2_lsi_param.melody_E2_file_name[0]) |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 return (ATI_FAIL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 if (audio_melody_E2_load_file_instruments(&e2_lsi_param) == AUDIO_OK) |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 return (ATI_CMPL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 else |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 return (ATI_FAIL); |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 } |
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 |
239
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
211 /* AT@TONE - exercise TONES through RiViera Audio Service API */ |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
212 GLOBAL T_ATI_RSLT atAtTONE ( char *cl, UBYTE srcId ) |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
213 { |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
214 int tone_start[3], tone_stop[3], tone_freq[3], tone_ampl[3]; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
215 int frame_dur, sequence_dur, period_dur, repetition; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
216 int i; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
217 T_AUDIO_TONES_PARAMETER t; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
218 T_RV_RETURN return_path; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
219 |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
220 cl = parse(cl, "DDDDDDDDDDDDDDDD", |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
221 &tone_start[0], &tone_stop[0], &tone_freq[0], &tone_ampl[0], |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
222 &tone_start[1], &tone_stop[1], &tone_freq[1], &tone_ampl[1], |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
223 &tone_start[2], &tone_stop[2], &tone_freq[2], &tone_ampl[2], |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
224 &frame_dur, &sequence_dur, &period_dur, &repetition); |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
225 if (!cl) |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
226 return (ATI_FAIL); |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
227 for (i = 0; i < 3; i++) { |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
228 t.tones[i].start_tone = tone_start[i]; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
229 t.tones[i].stop_tone = tone_stop[i]; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
230 t.tones[i].frequency_tone = tone_freq[i]; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
231 t.tones[i].amplitude_tone = -tone_ampl[i]; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
232 } |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
233 t.frame_duration = frame_dur; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
234 t.sequence_duration = sequence_dur; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
235 t.period_duration = period_dur; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
236 t.repetition = repetition; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
237 |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
238 return_path.addr_id = NULL; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
239 return_path.callback_func = audio_callback; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
240 if (audio_tones_start(&t, return_path) == AUDIO_OK) |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
241 return (ATI_CMPL); |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
242 else |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
243 return (ATI_FAIL); |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
244 } |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
245 |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
246 /* AT@TSTOP - stop tones started with AT@TONE */ |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
247 GLOBAL T_ATI_RSLT atAtTSTOP ( char *cl, UBYTE srcId ) |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
248 { |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
249 T_RV_RETURN return_path; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
250 |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
251 return_path.addr_id = NULL; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
252 return_path.callback_func = audio_callback; |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
253 if (audio_tones_stop(return_path) == AUDIO_OK) |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
254 return (ATI_CMPL); |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
255 else |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
256 return (ATI_FAIL); |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
257 } |
e0b9c21d7908
AT@TONE and AT@TSTOP audio test commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
226
diff
changeset
|
258 |
240
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
259 /* AT@VMP - play back a voice memo recording */ |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
260 GLOBAL T_ATI_RSLT atAtVMP ( char *cl, UBYTE srcId ) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
261 { |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
262 T_AUDIO_VM_PLAY_PARAMETER play_param; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
263 T_RV_RETURN return_path; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
264 |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
265 cl = parse(cl, "S", (LONG)(sizeof(play_param.memo_name)), |
240
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
266 play_param.memo_name); |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
267 if (!cl || !play_param.memo_name[0]) |
240
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
268 return (ATI_FAIL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
269 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
270 return_path.addr_id = NULL; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
271 return_path.callback_func = audio_callback; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
272 if (audio_vm_play_start(&play_param, return_path) == AUDIO_OK) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
273 return (ATI_CMPL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
274 else |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
275 return (ATI_FAIL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
276 } |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
277 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
278 /* AT@VMPS - stop VM play started with AT@VMP */ |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
279 GLOBAL T_ATI_RSLT atAtVMPS ( char *cl, UBYTE srcId ) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
280 { |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
281 T_RV_RETURN return_path; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
282 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
283 return_path.addr_id = NULL; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
284 return_path.callback_func = audio_callback; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
285 if (audio_vm_play_stop(return_path) == AUDIO_OK) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
286 return (ATI_CMPL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
287 else |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
288 return (ATI_FAIL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
289 } |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
290 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
291 static const T_AUDIO_TONES_PARAMETER recorder_warning_tone = { |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
292 0, 500, 1400, -5, |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
293 0, 500, 0, 0, |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
294 0, 500, 0, 0, |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
295 500, 500, 15000, TONE_INFINITE |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
296 }; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
297 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
298 /* AT@VMR - record a voice memo */ |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
299 GLOBAL T_ATI_RSLT atAtVMR ( char *cl, UBYTE srcId ) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
300 { |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
301 T_AUDIO_VM_RECORD_PARAMETER record_param; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
302 int duration = 0, compression = 0; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
303 LONG mic_gain = 0x100, network_gain = 0x100; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
304 T_RV_RETURN return_path; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
305 |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
306 cl = parse(cl, "Sddyy", (LONG)(sizeof(record_param.memo_name)), |
240
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
307 record_param.memo_name, &duration, &compression, |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
308 &mic_gain, &network_gain); |
244
bec9198fc306
aci2 ati_audio.c: my understanding of the 's' parser type was incorrect
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
309 if (!cl || !record_param.memo_name[0] || !duration) |
240
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
310 return (ATI_FAIL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
311 record_param.memo_duration = duration; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
312 record_param.compression_mode = compression; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
313 record_param.microphone_gain = mic_gain; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
314 record_param.network_gain = network_gain; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
315 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
316 return_path.addr_id = NULL; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
317 return_path.callback_func = audio_callback; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
318 if (audio_vm_record_start(&record_param, |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
319 (T_AUDIO_TONES_PARAMETER *) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
320 &recorder_warning_tone, |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
321 return_path) == AUDIO_OK) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
322 return (ATI_CMPL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
323 else |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
324 return (ATI_FAIL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
325 } |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
326 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
327 /* AT@VMRS - stop VM recording started with AT@VMR */ |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
328 GLOBAL T_ATI_RSLT atAtVMRS ( char *cl, UBYTE srcId ) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
329 { |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
330 T_RV_RETURN return_path; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
331 |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
332 return_path.addr_id = NULL; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
333 return_path.callback_func = audio_callback; |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
334 if (audio_vm_record_stop(return_path) == AUDIO_OK) |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
335 return (ATI_CMPL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
336 else |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
337 return (ATI_FAIL); |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
338 } |
9034c3a7267e
Voice memo recording and playback test AT commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
339 |
226
67fe1b3f4bd7
aci2: added some AT commands for exercising audio functions
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 #endif /* ATI_AUDIO_C */ |