Use C standard library utilities for booleans and fixed-width ints

This commit is contained in:
Chris Thrasher authored and Lukas Dürrenberger committed 2024-02-19 23:30:30 +01:00
1 parent 46bc9a7ed8
commit a51c22a7a3
97 files changed
+670 -707

No files matched your search

+9 -9
View File
@@ -110,24 +110,24 @@ CSFML_AUDIO_API void sfMusic_destroy(sfMusic* music);
///
/// If set, the music will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// sfMusic_setLoop(music, sfFalse) is called.
/// sfMusic_setLoop(music, false) is called.
/// The default looping state for musics is false.
///
/// \param music Music object
/// \param loop sfTrue to play in loop, sfFalse to play once
/// \param loop true to play in loop, false to play once
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_setLoop(sfMusic* music, sfBool loop);
CSFML_AUDIO_API void sfMusic_setLoop(sfMusic* music, bool loop);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not a music is in loop mode
///
/// \param music Music object
///
/// \return sfTrue if the music is looping, sfFalse otherwise
/// \return true if the music is looping, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfMusic_getLoop(const sfMusic* music);
CSFML_AUDIO_API bool sfMusic_getLoop(const sfMusic* music);
////////////////////////////////////////////////////////////
/// \brief Get the total duration of a music
@@ -310,10 +310,10 @@ CSFML_AUDIO_API void sfMusic_setPosition(sfMusic* music, sfVector3f position);
/// The default value is false (position is absolute).
///
/// \param music Music object
/// \param relative sfTrue to set the position relative, sfFalse to set it absolute
/// \param relative true to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_setRelativeToListener(sfMusic* music, sfBool relative);
CSFML_AUDIO_API void sfMusic_setRelativeToListener(sfMusic* music, bool relative);
////////////////////////////////////////////////////////////
/// \brief Set the minimum distance of a music
@@ -397,10 +397,10 @@ CSFML_AUDIO_API sfVector3f sfMusic_getPosition(const sfMusic* music);
///
/// \param music Music object
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
/// \return true if the position is relative, false if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfMusic_isRelativeToListener(const sfMusic* music);
CSFML_AUDIO_API bool sfMusic_isRelativeToListener(const sfMusic* music);
////////////////////////////////////////////////////////////
/// \brief Get the minimum distance of a music
+9 -9
View File
@@ -126,24 +126,24 @@ CSFML_AUDIO_API const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound);
///
/// If set, the sound will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// sfSound_setLoop(sound, sfFalse) is called.
/// sfSound_setLoop(sound, false) is called.
/// The default looping state for sounds is false.
///
/// \param sound Sound object
/// \param loop sfTrue to play in loop, sfFalse to play once
/// \param loop true to play in loop, false to play once
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSound_setLoop(sfSound* sound, sfBool loop);
CSFML_AUDIO_API void sfSound_setLoop(sfSound* sound, bool loop);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not a sound is in loop mode
///
/// \param sound Sound object
///
/// \return sfTrue if the sound is looping, sfFalse otherwise
/// \return true if the sound is looping, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSound_getLoop(const sfSound* sound);
CSFML_AUDIO_API bool sfSound_getLoop(const sfSound* sound);
////////////////////////////////////////////////////////////
/// \brief Get the current status of a sound (stopped, paused, playing)
@@ -205,10 +205,10 @@ CSFML_AUDIO_API void sfSound_setPosition(sfSound* sound, sfVector3f position);
/// The default value is false (position is absolute).
///
/// \param sound Sound object
/// \param relative sfTrue to set the position relative, sfFalse to set it absolute
/// \param relative true to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSound_setRelativeToListener(sfSound* sound, sfBool relative);
CSFML_AUDIO_API void sfSound_setRelativeToListener(sfSound* sound, bool relative);
////////////////////////////////////////////////////////////
/// \brief Set the minimum distance of a sound
@@ -292,10 +292,10 @@ CSFML_AUDIO_API sfVector3f sfSound_getPosition(const sfSound* sound);
///
/// \param sound Sound object
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
/// \return true if the position is relative, false if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSound_isRelativeToListener(const sfSound* sound);
CSFML_AUDIO_API bool sfSound_isRelativeToListener(const sfSound* sound);
////////////////////////////////////////////////////////////
/// \brief Get the minimum distance of a sound
+7 -7
View File
@@ -82,7 +82,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str
/// \brief Create a new sound buffer and load it from an array of samples in memory
///
/// The assumed format of the audio samples is 16 bits signed integer
/// (sfInt16).
/// (int16_t).
///
/// \param samples Pointer to the array of samples in memory
/// \param sampleCount Number of samples in the array
@@ -92,7 +92,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str
/// \return A new sfSoundBuffer object (NULL if failed)
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64 sampleCount, unsigned int channelCount, unsigned int sampleRate);
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const int16_t* samples, uint64_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Create a new sound buffer by copying an existing one
@@ -122,16 +122,16 @@ CSFML_AUDIO_API void sfSoundBuffer_destroy(sfSoundBuffer* soundBuffer);
/// \param soundBuffer Sound buffer object
/// \param filename Path of the sound file to write
///
/// \return sfTrue if saving succeeded, sfFalse if it failed
/// \return true if saving succeeded, false if it failed
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename);
CSFML_AUDIO_API bool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename);
////////////////////////////////////////////////////////////
/// \brief Get the array of audio samples stored in a sound buffer
///
/// The format of the returned samples is 16 bits signed integer
/// (sfInt16). The total number of samples in this array
/// (int16_t). The total number of samples in this array
/// is given by the sfSoundBuffer_getSampleCount function.
///
/// \param soundBuffer Sound buffer object
@@ -139,7 +139,7 @@ CSFML_AUDIO_API sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer
/// \return Read-only pointer to the array of sound samples
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer);
CSFML_AUDIO_API const int16_t* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer);
////////////////////////////////////////////////////////////
/// \brief Get the number of samples stored in a sound buffer
@@ -152,7 +152,7 @@ CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* sou
/// \return Number of samples
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfUint64 sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
CSFML_AUDIO_API uint64_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of a sound buffer
+4 -4
View File
@@ -61,10 +61,10 @@ CSFML_AUDIO_API void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundB
/// \param soundBufferRecorder Sound buffer recorder object
/// \param sampleRate Desired capture rate, in number of samples per second
///
/// \return sfTrue, if it was able to start recording
/// \return true, if it was able to start recording
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
CSFML_AUDIO_API bool sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Stop the capture of a sound recorder
@@ -114,10 +114,10 @@ CSFML_AUDIO_API const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSou
/// \param soundBufferRecorder Sound buffer recorder object
/// \param name The name of the audio capture device
///
/// \return sfTrue, if it was able to set the requested device
/// \return true, if it was able to set the requested device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* soundBufferRecorder, const char* name);
CSFML_AUDIO_API bool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* soundBufferRecorder, const char* name);
////////////////////////////////////////////////////////////
/// \brief Get the name of the current audio capture device
+8 -8
View File
@@ -34,9 +34,9 @@
#include <stddef.h>
typedef sfBool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture
typedef sfBool (*sfSoundRecorderProcessCallback)(const sfInt16*, size_t, void*); ///< Type of the callback used to process audio data
typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture
typedef bool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture
typedef bool (*sfSoundRecorderProcessCallback)(const int16_t*, size_t, void*); ///< Type of the callback used to process audio data
typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture
////////////////////////////////////////////////////////////
@@ -79,7 +79,7 @@ CSFML_AUDIO_API void sfSoundRecorder_destroy(sfSoundRecorder* soundRecorder);
/// \return True, if start of capture was successful
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
CSFML_AUDIO_API bool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Stop the capture of a sound recorder
@@ -110,10 +110,10 @@ CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder
/// the audio capture features. If it returns false, then
/// any attempt to use sfSoundRecorder will fail.
///
/// \return sfTrue if audio capture is supported, sfFalse otherwise
/// \return true if audio capture is supported, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundRecorder_isAvailable(void);
CSFML_AUDIO_API bool sfSoundRecorder_isAvailable(void);
////////////////////////////////////////////////////////////
/// \brief Set the processing interval
@@ -170,10 +170,10 @@ CSFML_AUDIO_API const char* sfSoundRecorder_getDefaultDevice(void);
/// \param soundRecorder Sound recorder object
/// \param name The name of the audio capture device
///
/// \return sfTrue, if it was able to set the requested device
/// \return true, if it was able to set the requested device
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name);
CSFML_AUDIO_API bool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name);
////////////////////////////////////////////////////////////
/// \brief Get the name of the current audio capture device
+12 -12
View File
@@ -41,12 +41,12 @@
////////////////////////////////////////////////////////////
typedef struct
{
sfInt16* samples; ///< Pointer to the audio samples
int16_t* samples; ///< Pointer to the audio samples
unsigned int sampleCount; ///< Number of samples pointed by Samples
} sfSoundStreamChunk;
typedef sfBool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data
typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< Type of the callback used to seek in a sound stream
typedef bool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data
typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< Type of the callback used to seek in a sound stream
////////////////////////////////////////////////////////////
@@ -197,10 +197,10 @@ CSFML_AUDIO_API void sfSoundStream_setPosition(sfSoundStream* soundStream, sfVec
/// The default value is false (position is absolute).
///
/// \param soundStream Sound stream object
/// \param relative sfTrue to set the position relative, sfFalse to set it absolute
/// \param relative true to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_setRelativeToListener(sfSoundStream* soundStream, sfBool relative);
CSFML_AUDIO_API void sfSoundStream_setRelativeToListener(sfSoundStream* soundStream, bool relative);
////////////////////////////////////////////////////////////
/// \brief Set the minimum distance of a sound stream
@@ -253,14 +253,14 @@ CSFML_AUDIO_API void sfSoundStream_setPlayingOffset(sfSoundStream* soundStream,
///
/// If set, the stream will restart from beginning after
/// reaching the end and so on, until it is stopped or
/// sfSoundStream_setLoop(stream, sfFalse) is called.
/// sfSoundStream_setLoop(stream, false) is called.
/// The default looping state for sound streams is false.
///
/// \param soundStream Sound stream object
/// \param loop sfTrue to play in loop, sfFalse to play once
/// \param loop true to play in loop, false to play once
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_setLoop(sfSoundStream* soundStream, sfBool loop);
CSFML_AUDIO_API void sfSoundStream_setLoop(sfSoundStream* soundStream, bool loop);
////////////////////////////////////////////////////////////
/// \brief Get the pitch of a sound stream
@@ -298,10 +298,10 @@ CSFML_AUDIO_API sfVector3f sfSoundStream_getPosition(const sfSoundStream* soundS
///
/// \param soundStream Sound stream object
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
/// \return true if the position is relative, false if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundStream_isRelativeToListener(const sfSoundStream* soundStream);
CSFML_AUDIO_API bool sfSoundStream_isRelativeToListener(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the minimum distance of a sound stream
@@ -328,10 +328,10 @@ CSFML_AUDIO_API float sfSoundStream_getAttenuation(const sfSoundStream* soundStr
///
/// \param soundStream Sound stream object
///
/// \return sfTrue if the music is looping, sfFalse otherwise
/// \return true if the music is looping, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundStream_getLoop(const sfSoundStream* soundStream);
CSFML_AUDIO_API bool sfSoundStream_getLoop(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the current playing position of a sound stream