Change UpdateSound() to accept const void *
The function means to accept a const * so let's declare it. Will allow passing const buffers in games. Also constness is next to godliness! Signed-off-by: Saggi Mizrahi <saggi@mizrahi.cc>
This commit is contained in:
parent
5df10d824c
commit
c394708c43
3 changed files with 11 additions and 10 deletions
|
@ -342,7 +342,7 @@ void UnloadSound(Sound sound)
|
||||||
|
|
||||||
// Update sound buffer with new data
|
// Update sound buffer with new data
|
||||||
// NOTE: data must match sound.format
|
// NOTE: data must match sound.format
|
||||||
void UpdateSound(Sound sound, void *data, int numSamples)
|
void UpdateSound(Sound sound, const void *data, int numSamples)
|
||||||
{
|
{
|
||||||
ALint sampleRate, sampleSize, channels;
|
ALint sampleRate, sampleSize, channels;
|
||||||
alGetBufferi(sound.buffer, AL_FREQUENCY, &sampleRate);
|
alGetBufferi(sound.buffer, AL_FREQUENCY, &sampleRate);
|
||||||
|
|
|
@ -115,7 +115,7 @@ Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, in
|
||||||
Sound LoadSound(const char *fileName); // Load sound to memory
|
Sound LoadSound(const char *fileName); // Load sound to memory
|
||||||
Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
||||||
Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
||||||
void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data
|
void UpdateSound(Sound sound, const void *data, int numSamples); // Update sound buffer with new data
|
||||||
void UnloadWave(Wave wave); // Unload wave data
|
void UnloadWave(Wave wave); // Unload wave data
|
||||||
void UnloadSound(Sound sound); // Unload sound
|
void UnloadSound(Sound sound); // Unload sound
|
||||||
void PlaySound(Sound sound); // Play a sound
|
void PlaySound(Sound sound); // Play a sound
|
||||||
|
|
17
src/raylib.h
17
src/raylib.h
|
@ -549,7 +549,7 @@ typedef enum {
|
||||||
// Texture parameters: filter mode
|
// Texture parameters: filter mode
|
||||||
// NOTE 1: Filtering considers mipmaps if available in the texture
|
// NOTE 1: Filtering considers mipmaps if available in the texture
|
||||||
// NOTE 2: Filter is accordingly set for minification and magnification
|
// NOTE 2: Filter is accordingly set for minification and magnification
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FILTER_POINT = 0, // No filter, just pixel aproximation
|
FILTER_POINT = 0, // No filter, just pixel aproximation
|
||||||
FILTER_BILINEAR, // Linear filtering
|
FILTER_BILINEAR, // Linear filtering
|
||||||
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
||||||
|
@ -581,12 +581,12 @@ typedef enum {
|
||||||
} Gestures;
|
} Gestures;
|
||||||
|
|
||||||
// Camera system modes
|
// Camera system modes
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CAMERA_CUSTOM = 0,
|
CAMERA_CUSTOM = 0,
|
||||||
CAMERA_FREE,
|
CAMERA_FREE,
|
||||||
CAMERA_ORBITAL,
|
CAMERA_ORBITAL,
|
||||||
CAMERA_FIRST_PERSON,
|
CAMERA_FIRST_PERSON,
|
||||||
CAMERA_THIRD_PERSON
|
CAMERA_THIRD_PERSON
|
||||||
} CameraMode;
|
} CameraMode;
|
||||||
|
|
||||||
// Head Mounted Display devices
|
// Head Mounted Display devices
|
||||||
|
@ -930,7 +930,8 @@ RLAPI Wave LoadWave(const char *fileName); // Load wa
|
||||||
RLAPI Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, int channels); // Load wave data from float array data (32bit)
|
RLAPI Wave LoadWaveEx(float *data, int sampleCount, int sampleRate, int sampleSize, int channels); // Load wave data from float array data (32bit)
|
||||||
RLAPI Sound LoadSound(const char *fileName); // Load sound to memory
|
RLAPI Sound LoadSound(const char *fileName); // Load sound to memory
|
||||||
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound to memory from wave data
|
||||||
RLAPI void UpdateSound(Sound sound, void *data, int numSamples); // Update sound buffer with new data
|
RLAPI void UpdateSound(Sound sound, const void *data, int numSamples);// Update sound buffer with new data
|
||||||
|
RLAPI Sound LoadSoundFromRES(const char *rresName, int resId); // Load sound to memory from rRES file (raylib Resource)
|
||||||
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
RLAPI void UnloadWave(Wave wave); // Unload wave data
|
||||||
RLAPI void UnloadSound(Sound sound); // Unload sound
|
RLAPI void UnloadSound(Sound sound); // Unload sound
|
||||||
RLAPI void PlaySound(Sound sound); // Play a sound
|
RLAPI void PlaySound(Sound sound); // Play a sound
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue