Mercurial > SDL_sound_CoreAudio
diff SDL_sound.h @ 485:137c0b00ea4c
Added Sound_NewSampleFromMem(), and implementation of RWops pooling.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 27 Feb 2005 19:53:25 +0000 |
parents | 3e705c9180e5 |
children | a0bb7a9c05b1 |
line wrap: on
line diff
--- a/SDL_sound.h Sun Feb 27 19:50:54 2005 +0000 +++ b/SDL_sound.h Sun Feb 27 19:53:25 2005 +0000 @@ -452,6 +452,39 @@ Uint32 bufferSize); /** + * \fn Sound_Sample *Sound_NewSampleFromMem(const Uint8 *data, Sound_AudioInfo *desired, Uint32 bufferSize) + * \brief Start decoding a new sound sample from a file on disk. + * + * This is identical to Sound_NewSample(), but it creates an SDL_RWops for you + * from the (size) bytes of memory referenced by (data). + * + * This can pool RWops structures, so it may fragment the heap less over time + * than using SDL_RWFromMem(). + * + * \param filename file containing sound data. + * \param desired Format to convert sound data into. Can usually be NULL, + * if you don't need conversion. + * \param bufferSize size, in bytes, of initial read buffer. + * \return Sound_Sample pointer, which is used as a handle to several other + * SDL_sound APIs. NULL on error. If error, use + * Sound_GetError() to see what went wrong. + * + * \sa Sound_NewSample + * \sa Sound_SetBufferSize + * \sa Sound_Decode + * \sa Sound_DecodeAll + * \sa Sound_Seek + * \sa Sound_Rewind + * \sa Sound_FreeSample + */ +SNDDECLSPEC Sound_Sample * SDLCALL Sound_NewSampleFromMem(const Uint8 *data, + Uint32 size, + const char *ext, + Sound_AudioInfo *desired, + Uint32 bufferSize); + + +/** * \fn Sound_Sample *Sound_NewSampleFromFile(const char *filename, Sound_AudioInfo *desired, Uint32 bufferSize) * \brief Start decoding a new sound sample from a file on disk. * @@ -462,6 +495,9 @@ * Sound_NewSample()'s "ext" parameter is gleaned from the contents of * (filename). * + * This can pool RWops structures, so it may fragment the heap less over time + * than using SDL_RWFromFile(). + * * \param filename file containing sound data. * \param desired Format to convert sound data into. Can usually be NULL, * if you don't need conversion.