Rewind a sample to the start.
Defined in <SDL3_sound/SDL_sound.h>
int Sound_Rewind(Sound_Sample *sample);| Sound_Sample * | sample | the Sound_Sample to rewind. |
(int) Returns nonzero on success, zero on error. Specifics of the error can be gleaned from Sound_GetError().
Restart a sample at the start of its waveform data, as if newly created with Sound_NewSample(). If successful, the next call to Sound_Decode() or Sound_DecodeAll() will give audio data from the earliest point in the stream.
Beware that this function will fail if the SDL_IOStream that feeds the decoder can not be rewound via SDL_SeekIO(), but this can theoretically be avoided by wrapping it in some sort of buffering SDL_IOStream.
This function should ONLY fail if the SDL_IOStream is not seekable, or SDL_sound is not initialized. Both can be controlled by the application, and thus, it is up to the developer's paranoia to dictate whether this function's return value need be checked at all.
If this function fails, the state of the sample is undefined, but it is still safe to call Sound_FreeSample() to dispose of it.
On success, SOUND_SAMPLEFLAG_ERROR, SOUND_SAMPLEFLAG_EOF, and SOUND_SAMPLEFLAG_EAGAIN are cleared
from sample->flags. The SOUND_SAMPLEFLAG_ERROR flag will be
set on error.
It is safe to call this function from any thread, but a single Sound_Sample should not be accessed from two threads at the same time.
This function is available since SDL_sound 1.0.0.