Mercurial > SDL_sound_CoreAudio
diff 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 |
line wrap: on
line diff
--- a/SDL_sound_internal.h Sun Apr 21 17:48:11 2002 +0000 +++ b/SDL_sound_internal.h Sun Apr 21 18:39:47 2002 +0000 @@ -177,6 +177,22 @@ * this method should ever fail! */ int (*rewind)(Sound_Sample *sample); + + /* + * Reposition the decoding to an arbitrary point. Nonzero on + * success, zero on failure. + * + * The purpose of this method is to allow for higher efficiency than + * an application could get by just rewinding the sample and + * decoding to a given point. + * + * The decoder is responsible for calling seek() on the associated + * SDL_RWops. + * + * If there is an error, try to recover so that the next read will + * continue as if nothing happened. + */ + int (*seek)(Sound_Sample *sample, Uint32 ms); } Sound_DecoderFunctions; @@ -225,6 +241,7 @@ #define ERR_COMPRESSION "(De)compression error" #define ERR_PREV_ERROR "Previous decoding already caused an error" #define ERR_PREV_EOF "Previous decoding already triggered EOF" +#define ERR_CANNOT_SEEK "Sample is not seekable" /* * Call this to set the message returned by Sound_GetError(). @@ -233,8 +250,16 @@ * * Calling this with a NULL argument is a safe no-op. */ -void Sound_SetError(const char *err); +void __Sound_SetError(const char *err); + +/* !!! FIXME: Clean up elsewhere and get rid of this. */ +#define Sound_SetError __Sound_SetError +/* + * Call this to convert milliseconds to an actual byte position, based on + * audio data characteristics. + */ +Uint32 __Sound_convertMsToBytePos(Sound_AudioInfo *info, Uint32 ms); /* * Use this if you need a cross-platform stricmp(). @@ -243,8 +268,8 @@ /* These get used all over for lessening code clutter. */ -#define BAIL_MACRO(e, r) { Sound_SetError(e); return r; } -#define BAIL_IF_MACRO(c, e, r) if (c) { Sound_SetError(e); return r; } +#define BAIL_MACRO(e, r) { __Sound_SetError(e); return r; } +#define BAIL_IF_MACRO(c, e, r) if (c) { __Sound_SetError(e); return r; }