comparison SDL_sound.h @ 477:3e705c9180e5

Fixed binary compatibility, added Sound_GetDuration().
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 12 May 2004 02:15:00 +0000
parents c66080364dff
children 137c0b00ea4c
comparison
equal deleted inserted replaced
475:f0b8865577db 477:3e705c9180e5
183 Sound_AudioInfo desired; /**< Desired audio format for conversion. */ 183 Sound_AudioInfo desired; /**< Desired audio format for conversion. */
184 Sound_AudioInfo actual; /**< Actual audio format of sample. */ 184 Sound_AudioInfo actual; /**< Actual audio format of sample. */
185 void *buffer; /**< Decoded sound data lands in here. */ 185 void *buffer; /**< Decoded sound data lands in here. */
186 Uint32 buffer_size; /**< Current size of (buffer), in bytes (Uint8). */ 186 Uint32 buffer_size; /**< Current size of (buffer), in bytes (Uint8). */
187 Sound_SampleFlags flags; /**< Flags relating to this sample. */ 187 Sound_SampleFlags flags; /**< Flags relating to this sample. */
188 Sint32 total_time; /**< Total length of song or track */
189 } Sound_Sample; 188 } Sound_Sample;
190 189
191 190
192 /** 191 /**
193 * \struct Sound_Version 192 * \struct Sound_Version
499 */ 498 */
500 SNDDECLSPEC void SDLCALL Sound_FreeSample(Sound_Sample *sample); 499 SNDDECLSPEC void SDLCALL Sound_FreeSample(Sound_Sample *sample);
501 500
502 501
503 /** 502 /**
503 * \fn Sint32 Sound_GetDuration(Sound_Sample *sample)
504 * \brief Retrieve total play time of sample, in milliseconds.
505 *
506 * Report total time length of sample, in milliseconds. This is a fast
507 * call. Duration is calculated during Sound_NewSample*, so this is just
508 * an accessor into otherwise opaque data.
509 *
510 * Please note that not all formats can determine a total time, some can't
511 * be exact without fully decoding the data, and thus will estimate the
512 * duration. Many decoders will require the ability to seek in the data
513 * stream to calculate this, so even if we can tell you how long an .ogg
514 * file will be, the same data set may fail if it's, say, streamed over an
515 * HTTP connection. Plan accordingly.
516 *
517 * Most people won't need this function to just decode and playback, but it
518 * can be useful for informational purposes in, say, a music player's UI.
519 *
520 * \param sample Sound_Sample from which to retrieve duration information.
521 * \return Sample length in milliseconds, or -1 if duration can't be
522 * determined for any reason.
523 */
524 SNDDECLSPEC Sint32 SDLCALL Sound_GetDuration(Sound_Sample *sample);
525
526
527 /**
504 * \fn int Sound_SetBufferSize(Sound_Sample *sample, Uint32 new_size) 528 * \fn int Sound_SetBufferSize(Sound_Sample *sample, Uint32 new_size)
505 * \brief Change the current buffer size for a sample. 529 * \brief Change the current buffer size for a sample.
506 * 530 *
507 * If the buffer size could be changed, then the sample->buffer and 531 * If the buffer size could be changed, then the sample->buffer and
508 * sample->buffer_size fields will reflect that. If they could not be 532 * sample->buffer_size fields will reflect that. If they could not be