Renamed SDL_MixAudioFormat to SDL_MixAudio, and use float volume

This commit is contained in:
Brick
2024-05-08 14:21:24 +01:00
parent 5c4b558c1c
commit b6b9d5508e
9 changed files with 37 additions and 28 deletions

View File

@@ -1557,13 +1557,6 @@ extern DECLSPEC int SDLCALL SDL_LoadWAV_IO(SDL_IOStream * src, SDL_bool closeio,
extern DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
Uint8 ** audio_buf, Uint32 * audio_len);
/**
* Maximum volume allowed in calls to SDL_MixAudioFormat.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_MIX_MAXVOLUME 128
/**
* Mix audio data in a specified format.
*
@@ -1581,7 +1574,7 @@ extern DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
*
* It is a common misconception that this function is required to write audio
* data to an output stream in an audio callback. While you can do that,
* SDL_MixAudioFormat() is really only needed when you're mixing a single
* SDL_MixAudio() is really only needed when you're mixing a single
* audio stream with a volume adjustment.
*
* \param dst the destination for the mixed audio
@@ -1589,8 +1582,7 @@ extern DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
* \param format the SDL_AudioFormat structure representing the desired audio
* format
* \param len the length of the audio buffer in bytes
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
* for full audio volume
* \param volume ranges from 0.0 - 1.0, and should be set to 1.0 for full audio volume
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
@@ -1598,10 +1590,10 @@ extern DECLSPEC int SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * spec,
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_MixAudioFormat(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, int volume);
extern DECLSPEC int SDLCALL SDL_MixAudio(Uint8 * dst,
const Uint8 * src,
SDL_AudioFormat format,
Uint32 len, float volume);
/**
* Convert some audio data of one format to another format.

View File

@@ -68,6 +68,7 @@
#define SDL_FreeAudioStream SDL_DestroyAudioStream
#define SDL_FreeWAV SDL_free
#define SDL_LoadWAV_RW SDL_LoadWAV_IO
#define SDL_MixAudioFormat SDL_MixAudio
#define SDL_NewAudioStream SDL_CreateAudioStream
/* ##SDL_cpuinfo.h */
@@ -584,6 +585,7 @@
#define SDL_FreeAudioStream SDL_FreeAudioStream_renamed_SDL_DestroyAudioStream
#define SDL_FreeWAV SDL_FreeWAV_renamed_SDL_free
#define SDL_LoadWAV_RW SDL_LoadWAV_RW_renamed_SDL_LoadWAV_IO
#define SDL_MixAudioFormat SDL_MixAudioFormat_renamed_SDL_MixAudio
#define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream
/* ##SDL_cpuinfo.h */