Renamed AudioStreamSpeed to AudioStreamFrequencyRatio

This commit is contained in:
Brick
2023-09-03 19:37:57 +01:00
committed by Sam Lantinga
parent 47bcb078f5
commit 0e552761b7
7 changed files with 43 additions and 37 deletions

View File

@@ -703,33 +703,40 @@ extern DECLSPEC int SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream,
* \sa SDL_PutAudioStreamData
* \sa SDL_GetAudioStreamData
* \sa SDL_GetAudioStreamAvailable
* \sa SDL_SetAudioStreamSpeed
* \sa SDL_SetAudioStreamFrequencyRatio
*/
extern DECLSPEC int SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream,
const SDL_AudioSpec *src_spec,
const SDL_AudioSpec *dst_spec);
/**
* Get the playback speed of an audio stream.
* Get the frequency ratio of an audio stream.
*
* \param stream the SDL_AudioStream to query.
* \returns the playback speed of the stream, or 0.0 on error
* \returns the frequency ratio of the stream, or 0.0 on error
*
* \threadsafety It is safe to call this function from any thread, as it holds
* a stream-specific mutex while running.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetAudioStreamSpeed
* \sa SDL_SetAudioStreamFrequencyRatio
*/
extern DECLSPEC float SDLCALL SDL_GetAudioStreamSpeed(SDL_AudioStream *stream);
extern DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream *stream);
/**
* Change the playback speed of an audio stream.
*
* \param stream The stream the speed is being changed
* \param speed The new speed. 1.0 is normal speed, 1.2 is 20% faster, etc.
* Must be between 0.01 and 100.
* Change the frequency ratio of an audio stream.
*
* The frequency ratio is used to adjust the rate at which input data is consumed.
* Changing this effectively modifies the speed and pitch of the audio.
* A value greater than 1.0 will play the audio faster, and at a higher pitch.
* A value less than 1.0 will play the audio slower, and at a lower pitch.
*
* This is applied during SDL_GetAudioStreamData, and can be continuously changed
* to create various effects.
*
* \param stream The stream the frequency ratio is being changed
* \param ratio The frequency ratio. 1.0 is normal speed. Must be between 0.01 and 100.
* \returns 0 on success, or -1 on error.
*
* \threadsafety It is safe to call this function from any thread, as it holds
@@ -737,11 +744,10 @@ extern DECLSPEC float SDLCALL SDL_GetAudioStreamSpeed(SDL_AudioStream *stream);
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetAudioStreamSpeed
* \sa SDL_GetAudioStreamFrequencyRatio
* \sa SDL_SetAudioStreamFormat
*/
extern DECLSPEC int SDLCALL SDL_SetAudioStreamSpeed(SDL_AudioStream *stream,
float speed);
extern DECLSPEC int SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio);
/**
* Add data to be converted/resampled to the stream.