comparison SDL_sound_internal.h @ 306:c97be6e1bd27

Added framework for Sound_Seek() support.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 21 Apr 2002 18:39:47 +0000
parents ca43129df299
children 31cc49d7d0ce
comparison
equal deleted inserted replaced
305:c345a40a8a99 306:c97be6e1bd27
175 * The decoder is responsible for calling seek() on the associated 175 * The decoder is responsible for calling seek() on the associated
176 * SDL_RWops. A failing call to seek() should be the ONLY reason that 176 * SDL_RWops. A failing call to seek() should be the ONLY reason that
177 * this method should ever fail! 177 * this method should ever fail!
178 */ 178 */
179 int (*rewind)(Sound_Sample *sample); 179 int (*rewind)(Sound_Sample *sample);
180
181 /*
182 * Reposition the decoding to an arbitrary point. Nonzero on
183 * success, zero on failure.
184 *
185 * The purpose of this method is to allow for higher efficiency than
186 * an application could get by just rewinding the sample and
187 * decoding to a given point.
188 *
189 * The decoder is responsible for calling seek() on the associated
190 * SDL_RWops.
191 *
192 * If there is an error, try to recover so that the next read will
193 * continue as if nothing happened.
194 */
195 int (*seek)(Sound_Sample *sample, Uint32 ms);
180 } Sound_DecoderFunctions; 196 } Sound_DecoderFunctions;
181 197
182 198
183 /* A structure to hold a set of audio conversion filters and buffers */ 199 /* A structure to hold a set of audio conversion filters and buffers */
184 200
223 #define ERR_PAST_EOF "Past end of file" 239 #define ERR_PAST_EOF "Past end of file"
224 #define ERR_IO_ERROR "I/O error" 240 #define ERR_IO_ERROR "I/O error"
225 #define ERR_COMPRESSION "(De)compression error" 241 #define ERR_COMPRESSION "(De)compression error"
226 #define ERR_PREV_ERROR "Previous decoding already caused an error" 242 #define ERR_PREV_ERROR "Previous decoding already caused an error"
227 #define ERR_PREV_EOF "Previous decoding already triggered EOF" 243 #define ERR_PREV_EOF "Previous decoding already triggered EOF"
244 #define ERR_CANNOT_SEEK "Sample is not seekable"
228 245
229 /* 246 /*
230 * Call this to set the message returned by Sound_GetError(). 247 * Call this to set the message returned by Sound_GetError().
231 * Please only use the ERR_* constants above, or add new constants to the 248 * Please only use the ERR_* constants above, or add new constants to the
232 * above group, but I want these all in one place. 249 * above group, but I want these all in one place.
233 * 250 *
234 * Calling this with a NULL argument is a safe no-op. 251 * Calling this with a NULL argument is a safe no-op.
235 */ 252 */
236 void Sound_SetError(const char *err); 253 void __Sound_SetError(const char *err);
237 254
255 /* !!! FIXME: Clean up elsewhere and get rid of this. */
256 #define Sound_SetError __Sound_SetError
257
258 /*
259 * Call this to convert milliseconds to an actual byte position, based on
260 * audio data characteristics.
261 */
262 Uint32 __Sound_convertMsToBytePos(Sound_AudioInfo *info, Uint32 ms);
238 263
239 /* 264 /*
240 * Use this if you need a cross-platform stricmp(). 265 * Use this if you need a cross-platform stricmp().
241 */ 266 */
242 int __Sound_strcasecmp(const char *x, const char *y); 267 int __Sound_strcasecmp(const char *x, const char *y);
243 268
244 269
245 /* These get used all over for lessening code clutter. */ 270 /* These get used all over for lessening code clutter. */
246 #define BAIL_MACRO(e, r) { Sound_SetError(e); return r; } 271 #define BAIL_MACRO(e, r) { __Sound_SetError(e); return r; }
247 #define BAIL_IF_MACRO(c, e, r) if (c) { Sound_SetError(e); return r; } 272 #define BAIL_IF_MACRO(c, e, r) if (c) { __Sound_SetError(e); return r; }
248 273
249 274
250 275
251 276
252 /*--------------------------------------------------------------------------*/ 277 /*--------------------------------------------------------------------------*/