Add a function to clone a sound and share data with another sound.

This commit is contained in:
Jeff Myers 2023-08-02 10:19:21 -07:00
commit d25c662f24

View file

@ -461,6 +461,7 @@ typedef struct AudioStream {
typedef struct Sound {
AudioStream stream; // Audio stream
unsigned int frameCount; // Total number of frames (considering channels)
bool noFree; // The sound data buffer is owned by something else, don't free it
} Sound;
// Music, audio stream, anything longer than ~10 seconds should be streamed
@ -1531,6 +1532,7 @@ RLAPI Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileDat
RLAPI bool IsWaveReady(Wave wave); // Checks if wave data is ready
RLAPI Sound LoadSound(const char *fileName); // Load sound from file
RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
RLAPI Sound CloneSound(Sound sourceSound); // Create a new sound that shares the same sample data as the source sound, does not own the sound data
RLAPI bool IsSoundReady(Sound sound); // Checks if a sound is ready
RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
RLAPI void UnloadWave(Wave wave); // Unload wave data