diff options
Diffstat (limited to 'firmware/export/audio.h')
-rw-r--r-- | firmware/export/audio.h | 99 |
1 files changed, 3 insertions, 96 deletions
diff --git a/firmware/export/audio.h b/firmware/export/audio.h index 5ed9c706a4..c2c23dfd5c 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h | |||
@@ -18,8 +18,8 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #ifndef AUDIO_H | 21 | #ifndef __AUDIO_H |
22 | #define AUDIO_H | 22 | #define __AUDIO_H |
23 | 23 | ||
24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
25 | #include <string.h> /* size_t */ | 25 | #include <string.h> /* size_t */ |
@@ -27,13 +27,11 @@ | |||
27 | /* These must always be included with audio.h for this to compile under | 27 | /* These must always be included with audio.h for this to compile under |
28 | cetain conditions. Do it here or else spread the complication around to | 28 | cetain conditions. Do it here or else spread the complication around to |
29 | many files. */ | 29 | many files. */ |
30 | #if CONFIG_CODEC == SWCODEC | ||
31 | #include "pcm_sampr.h" | 30 | #include "pcm_sampr.h" |
32 | #include "pcm.h" | 31 | #include "pcm.h" |
33 | #ifdef HAVE_RECORDING | 32 | #ifdef HAVE_RECORDING |
34 | #include "enc_base.h" | 33 | #include "enc_base.h" |
35 | #endif /* HAVE_RECORDING */ | 34 | #endif /* HAVE_RECORDING */ |
36 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
37 | 35 | ||
38 | #define AUDIO_STATUS_PLAY 0x0001 | 36 | #define AUDIO_STATUS_PLAY 0x0001 |
39 | #define AUDIO_STATUS_PAUSE 0x0002 | 37 | #define AUDIO_STATUS_PAUSE 0x0002 |
@@ -75,44 +73,9 @@ void audio_error_clear(void); | |||
75 | int audio_get_file_pos(void); | 73 | int audio_get_file_pos(void); |
76 | void audio_beep(int duration); | 74 | void audio_beep(int duration); |
77 | 75 | ||
78 | #if CONFIG_CODEC == SWCODEC | ||
79 | void audio_next_dir(void); | 76 | void audio_next_dir(void); |
80 | void audio_prev_dir(void); | 77 | void audio_prev_dir(void); |
81 | 78 | ||
82 | #else /* hwcodec only */ | ||
83 | struct audio_debug | ||
84 | { | ||
85 | int audiobuflen; | ||
86 | int audiobuf_write; | ||
87 | int audiobuf_swapwrite; | ||
88 | int audiobuf_read; | ||
89 | |||
90 | int last_dma_chunk_size; | ||
91 | |||
92 | bool dma_on; | ||
93 | bool playing; | ||
94 | bool play_pending; | ||
95 | bool is_playing; | ||
96 | bool filling; | ||
97 | bool dma_underrun; | ||
98 | |||
99 | int unplayed_space; | ||
100 | int playable_space; | ||
101 | int unswapped_space; | ||
102 | |||
103 | int low_watermark_level; | ||
104 | int lowest_watermark_level; | ||
105 | }; | ||
106 | |||
107 | void audio_get_debugdata(struct audio_debug *dbgdata); | ||
108 | /* unsigned int audio_error(void); - unused function */ | ||
109 | void audio_init_playback(void); | ||
110 | |||
111 | #define audio_next_dir() ({ }) | ||
112 | #define audio_prev_dir() ({ }) | ||
113 | |||
114 | #endif | ||
115 | |||
116 | /* channel modes */ | 79 | /* channel modes */ |
117 | enum rec_channel_modes | 80 | enum rec_channel_modes |
118 | { | 81 | { |
@@ -124,12 +87,10 @@ enum rec_channel_modes | |||
124 | CHN_NUM_MODES | 87 | CHN_NUM_MODES |
125 | }; | 88 | }; |
126 | 89 | ||
127 | #if CONFIG_CODEC == SWCODEC | ||
128 | /* channel mode capability bits */ | 90 | /* channel mode capability bits */ |
129 | #define CHN_CAP_STEREO (1 << CHN_MODE_STEREO) | 91 | #define CHN_CAP_STEREO (1 << CHN_MODE_STEREO) |
130 | #define CHN_CAP_MONO (1 << CHN_MODE_MONO) | 92 | #define CHN_CAP_MONO (1 << CHN_MODE_MONO) |
131 | #define CHN_CAP_ALL (CHN_CAP_STEREO | CHN_CAP_MONO) | 93 | #define CHN_CAP_ALL (CHN_CAP_STEREO | CHN_CAP_MONO) |
132 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
133 | 94 | ||
134 | /* the enums below must match prestr[] in recording.c */ | 95 | /* the enums below must match prestr[] in recording.c */ |
135 | enum audio_sources | 96 | enum audio_sources |
@@ -164,7 +125,6 @@ enum rec_sources | |||
164 | }; | 125 | }; |
165 | #endif /* HAVE_RECORDING */ | 126 | #endif /* HAVE_RECORDING */ |
166 | 127 | ||
167 | #if CONFIG_CODEC == SWCODEC | ||
168 | /* selects a source to monitor for recording or playback */ | 128 | /* selects a source to monitor for recording or playback */ |
169 | #define SRCF_PLAYBACK 0x0000 /* default */ | 129 | #define SRCF_PLAYBACK 0x0000 /* default */ |
170 | #define SRCF_RECORDING 0x1000 | 130 | #define SRCF_RECORDING 0x1000 |
@@ -173,7 +133,6 @@ enum rec_sources | |||
173 | #define SRCF_FMRADIO_PLAYING 0x0000 /* default */ | 133 | #define SRCF_FMRADIO_PLAYING 0x0000 /* default */ |
174 | #define SRCF_FMRADIO_PAUSED 0x2000 | 134 | #define SRCF_FMRADIO_PAUSED 0x2000 |
175 | #endif | 135 | #endif |
176 | #endif | ||
177 | 136 | ||
178 | #ifdef HAVE_RECORDING | 137 | #ifdef HAVE_RECORDING |
179 | /* parameters for audio_set_recording_options */ | 138 | /* parameters for audio_set_recording_options */ |
@@ -183,14 +142,9 @@ struct audio_recording_options | |||
183 | int rec_frequency; | 142 | int rec_frequency; |
184 | int rec_channels; | 143 | int rec_channels; |
185 | int rec_prerecord_time; | 144 | int rec_prerecord_time; |
186 | #if CONFIG_CODEC == SWCODEC | ||
187 | int rec_mono_mode; | 145 | int rec_mono_mode; |
188 | int rec_source_flags; /* for rec_set_source */ | 146 | int rec_source_flags; /* for rec_set_source */ |
189 | struct encoder_config enc_config; | 147 | struct encoder_config enc_config; |
190 | #else | ||
191 | int rec_quality; | ||
192 | bool rec_editable; | ||
193 | #endif | ||
194 | }; | 148 | }; |
195 | 149 | ||
196 | /* audio recording functions */ | 150 | /* audio recording functions */ |
@@ -206,15 +160,10 @@ void audio_set_recording_gain(int left, int right, int type); | |||
206 | unsigned long audio_recorded_time(void); | 160 | unsigned long audio_recorded_time(void); |
207 | unsigned long audio_num_recorded_bytes(void); | 161 | unsigned long audio_num_recorded_bytes(void); |
208 | 162 | ||
209 | #if CONFIG_CODEC == SWCODEC | ||
210 | /* SWCODEC recording functions */ | ||
211 | unsigned long audio_prerecorded_time(void); | 163 | unsigned long audio_prerecorded_time(void); |
212 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
213 | 164 | ||
214 | #endif /* HAVE_RECORDING */ | 165 | #endif /* HAVE_RECORDING */ |
215 | 166 | ||
216 | #if CONFIG_CODEC == SWCODEC | ||
217 | /* SWCODEC misc. audio functions */ | ||
218 | #if INPUT_SRC_CAPS != 0 | 167 | #if INPUT_SRC_CAPS != 0 |
219 | /* audio.c */ | 168 | /* audio.c */ |
220 | void audio_set_input_source(int source, unsigned flags); | 169 | void audio_set_input_source(int source, unsigned flags); |
@@ -223,7 +172,6 @@ void audio_set_input_source(int source, unsigned flags); | |||
223 | void audio_input_mux(int source, unsigned flags); | 172 | void audio_input_mux(int source, unsigned flags); |
224 | void audio_set_output_source(int source); | 173 | void audio_set_output_source(int source); |
225 | #endif /* INPUT_SRC_CAPS */ | 174 | #endif /* INPUT_SRC_CAPS */ |
226 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
227 | 175 | ||
228 | #ifdef HAVE_SPDIF_IN | 176 | #ifdef HAVE_SPDIF_IN |
229 | /* returns index into rec_master_sampr_list */ | 177 | /* returns index into rec_master_sampr_list */ |
@@ -247,11 +195,9 @@ enum track_event_flags | |||
247 | { | 195 | { |
248 | TEF_NONE = 0x0, /* no flags are set */ | 196 | TEF_NONE = 0x0, /* no flags are set */ |
249 | TEF_CURRENT = 0x1, /* event is for the current track */ | 197 | TEF_CURRENT = 0x1, /* event is for the current track */ |
250 | #if CONFIG_CODEC == SWCODEC | ||
251 | TEF_AUTO_SKIP = 0x2, /* event is sent in context of auto skip */ | 198 | TEF_AUTO_SKIP = 0x2, /* event is sent in context of auto skip */ |
252 | TEF_REWIND = 0x4, /* interpret as rewind, id3->elapsed is the | 199 | TEF_REWIND = 0x4, /* interpret as rewind, id3->elapsed is the |
253 | position before the seek back to 0 */ | 200 | position before the seek back to 0 */ |
254 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
255 | }; | 201 | }; |
256 | 202 | ||
257 | struct track_event | 203 | struct track_event |
@@ -260,43 +206,4 @@ struct track_event | |||
260 | struct mp3entry *id3; /* pointer to mp3entry describing track */ | 206 | struct mp3entry *id3; /* pointer to mp3entry describing track */ |
261 | }; | 207 | }; |
262 | 208 | ||
263 | #if CONFIG_CODEC != SWCODEC | 209 | #endif /* __AUDIO_H */ |
264 | /* subscribe to one or more audio event(s) by OR'ing together the desired */ | ||
265 | /* event IDs (defined below); a handler is called with a solitary event ID */ | ||
266 | /* (so switch() is okay) and possibly some useful data (depending on the */ | ||
267 | /* event); a handler must return one of the return codes defined below */ | ||
268 | |||
269 | typedef int (*AUDIO_EVENT_HANDLER)(unsigned short event, unsigned long data); | ||
270 | |||
271 | void audio_register_event_handler(AUDIO_EVENT_HANDLER handler, unsigned short mask); | ||
272 | |||
273 | /***********************************************************************/ | ||
274 | /* handler return codes */ | ||
275 | |||
276 | #define AUDIO_EVENT_RC_IGNORED 200 | ||
277 | /* indicates that no action was taken or the event was not recognized */ | ||
278 | |||
279 | #define AUDIO_EVENT_RC_HANDLED 201 | ||
280 | /* indicates that the event was handled and some action was taken which renders | ||
281 | the original event invalid; USE WITH CARE!; this return code aborts all further | ||
282 | processing of the given event */ | ||
283 | |||
284 | /***********************************************************************/ | ||
285 | /* audio event IDs */ | ||
286 | |||
287 | #define AUDIO_EVENT_POS_REPORT (1<<0) | ||
288 | /* sends a periodic song position report to handlers; a report is sent on | ||
289 | each kernal tick; the number of ticks per second is defined by HZ; on each | ||
290 | report the current song position is passed in 'data'; if a handler takes an | ||
291 | action that changes the song or the song position it must return | ||
292 | AUDIO_EVENT_RC_HANDLED which suppresses the event for any remaining handlers */ | ||
293 | |||
294 | #define AUDIO_EVENT_END_OF_TRACK (1<<1) | ||
295 | /* generated when the end of the currently playing track is reached; no | ||
296 | data is passed; if the handler implements some alternate end-of-track | ||
297 | processing it should return AUDIO_EVENT_RC_HANDLED which suppresses the | ||
298 | event for any remaining handlers as well as the normal end-of-track | ||
299 | processing */ | ||
300 | |||
301 | #endif | ||
302 | #endif | ||