comparison src/g23m-aci/aci/ati_audio.c @ 292:85b38e37810b

AT@SPKR and AT@VPATH ported over to aci3
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 02 Sep 2017 17:05:04 +0000
parents 294c26c07561
children 8473cabf491d
comparison
equal deleted inserted replaced
291:21d128939204 292:85b38e37810b
64 #endif /*FF_ATI_BAT*/ 64 #endif /*FF_ATI_BAT*/
65 65
66 #include "audio/audio_api.h" 66 #include "audio/audio_api.h"
67 #include "audio.h" /* Condat */ 67 #include "audio.h" /* Condat */
68 68
69 #include "fc-target.cfg"
70 #include "armio.h"
71
72 #ifdef CONFIG_TARGET_FCDEV3B
73 /* AT@SPKR - turn loudspeaker amplifier on or off */
74 GLOBAL T_ATI_RSLT atAtSPKR ( char *cl, UBYTE srcId )
75 {
76 int state;
77
78 TRACE_FUNCTION("atAtSPKR()");
79
80 cl = parse(cl, "D", &state);
81 if (!cl)
82 return (ATI_FAIL);
83 if (state)
84 AI_SetBit(1);
85 else
86 AI_ResetBit(1);
87 return (ATI_CMPL);
88 }
89
90 GLOBAL T_ATI_RSLT queatAtSPKR (char *cl, UBYTE srcId)
91 {
92 char *me="@SPKR: ";
93 int state;
94
95 TRACE_FUNCTION("queatAtSPKR()");
96
97 state = AI_ReadBit(1);
98 sprintf(g_sa, "%s%d", me, state);
99
100 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
101
102 return (ATI_CMPL);
103 }
104 #endif
105
69 /* AT@SND - emit sound through Condat API */ 106 /* AT@SND - emit sound through Condat API */
70 GLOBAL T_ATI_RSLT atAtSND ( char *cl, UBYTE srcId ) 107 GLOBAL T_ATI_RSLT atAtSND ( char *cl, UBYTE srcId )
71 { 108 {
72 UBYTE sound_id = TONES_KEYBEEP; 109 UBYTE sound_id = TONES_KEYBEEP;
73 110
127 164
128 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); 165 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
129 166
130 return (ATI_CMPL); 167 return (ATI_CMPL);
131 } 168 }
169
170 #ifdef CONFIG_TARGET_FCDEV3B
171 /* AT@VPATH - configure digital voice path */
172 GLOBAL T_ATI_RSLT atAtVPATH ( char *cl, UBYTE srcId )
173 {
174 int vpath_int;
175 T_AUDIO_VOICE_PATH_SETTING vpath;
176 T_AUDIO_FULL_ACCESS_WRITE audio_param;
177 T_RV_RETURN return_path;
178
179 TRACE_FUNCTION("atAtVPATH()");
180
181 cl = parse(cl, "D", &vpath_int);
182 if (!cl)
183 return (ATI_FAIL);
184 vpath = vpath_int;
185 audio_param.variable_indentifier = AUDIO_PATH_USED;
186 audio_param.data = &vpath;
187
188 return_path.addr_id = NULL;
189 return_path.callback_func = audio_callback;
190 if (audio_full_access_write(&audio_param, return_path) == AUDIO_OK)
191 return (ATI_CMPL);
192 else
193 return (ATI_FAIL);
194 }
195
196 GLOBAL T_ATI_RSLT queatAtVPATH (char *cl, UBYTE srcId)
197 {
198 char *me="@VPATH: ";
199 T_AUDIO_VOICE_PATH_SETTING vpath;
200 T_AUDIO_FULL_ACCESS_READ audio_param;
201
202 TRACE_FUNCTION("queatAtVPATH()");
203
204 audio_param.variable_indentifier = AUDIO_PATH_USED;
205 audio_param.data = &vpath;
206 if (audio_full_access_read(&audio_param) != AUDIO_OK)
207 return (ATI_FAIL);
208
209 sprintf(g_sa, "%s%d", me, vpath);
210
211 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
212
213 return (ATI_CMPL);
214 }
215 #endif
132 216
133 /* AT@E1 - play an E1 format melody */ 217 /* AT@E1 - play an E1 format melody */
134 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId ) 218 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId )
135 { 219 {
136 T_AUDIO_MELODY_E1_PARAMETER e1_param; 220 T_AUDIO_MELODY_E1_PARAMETER e1_param;