Adding getters for Music, Sound and AudioStream

This commit is contained in:
LeandroSQ 2024-05-03 22:02:30 -03:00
parent f1007554a0
commit e1af38d1d7
2 changed files with 63 additions and 0 deletions

View File

@ -1202,18 +1202,36 @@ bool IsSoundPlaying(Sound sound)
return result; return result;
} }
// Get volume for a sound
float GetSoundVolume(Sound sound)
{
return sound.stream.buffer->volume;
}
// Set volume for a sound // Set volume for a sound
void SetSoundVolume(Sound sound, float volume) void SetSoundVolume(Sound sound, float volume)
{ {
SetAudioBufferVolume(sound.stream.buffer, volume); SetAudioBufferVolume(sound.stream.buffer, volume);
} }
// Get pitch for a sound
float GetSoundPitch(Sound sound)
{
return sound.stream.buffer->pitch;
}
// Set pitch for a sound // Set pitch for a sound
void SetSoundPitch(Sound sound, float pitch) void SetSoundPitch(Sound sound, float pitch)
{ {
SetAudioBufferPitch(sound.stream.buffer, pitch); SetAudioBufferPitch(sound.stream.buffer, pitch);
} }
// Get pan for a sound
float GetSoundPan(Sound sound)
{
return sound.stream.buffer->pan;
}
// Set pan for a sound // Set pan for a sound
void SetSoundPan(Sound sound, float pan) void SetSoundPan(Sound sound, float pan)
{ {
@ -2022,18 +2040,36 @@ bool IsMusicStreamPlaying(Music music)
return IsAudioStreamPlaying(music.stream); return IsAudioStreamPlaying(music.stream);
} }
// Get volume for music
float GetMusicVolume(Music music)
{
return music.stream.buffer->volume;
}
// Set volume for music // Set volume for music
void SetMusicVolume(Music music, float volume) void SetMusicVolume(Music music, float volume)
{ {
SetAudioStreamVolume(music.stream, volume); SetAudioStreamVolume(music.stream, volume);
} }
// Get pitch for music
float GetMusicPitch(Music music)
{
return music.stream.buffer->pitch;
}
// Set pitch for music // Set pitch for music
void SetMusicPitch(Music music, float pitch) void SetMusicPitch(Music music, float pitch)
{ {
SetAudioBufferPitch(music.stream.buffer, pitch); SetAudioBufferPitch(music.stream.buffer, pitch);
} }
// Get pan for a music
float GetMusicPan(Music music)
{
return music.stream.buffer->pan;
}
// Set pan for a music // Set pan for a music
void SetMusicPan(Music music, float pan) void SetMusicPan(Music music, float pan)
{ {
@ -2185,18 +2221,36 @@ void StopAudioStream(AudioStream stream)
StopAudioBuffer(stream.buffer); StopAudioBuffer(stream.buffer);
} }
// Get volume for audio stream (1.0 is max level)
float GetAudioStreamVolume(AudioStream stream)
{
return stream.buffer->volume;
}
// Set volume for audio stream (1.0 is max level) // Set volume for audio stream (1.0 is max level)
void SetAudioStreamVolume(AudioStream stream, float volume) void SetAudioStreamVolume(AudioStream stream, float volume)
{ {
SetAudioBufferVolume(stream.buffer, volume); SetAudioBufferVolume(stream.buffer, volume);
} }
// Get pitch for audio stream (1.0 is base level)
float GetAudioStreamPitch(AudioStream stream)
{
return stream.buffer->pitch;
}
// Set pitch for audio stream (1.0 is base level) // Set pitch for audio stream (1.0 is base level)
void SetAudioStreamPitch(AudioStream stream, float pitch) void SetAudioStreamPitch(AudioStream stream, float pitch)
{ {
SetAudioBufferPitch(stream.buffer, pitch); SetAudioBufferPitch(stream.buffer, pitch);
} }
// Get pan for audio stream
float GetAudioStreamPan(AudioStream stream)
{
return stream.buffer->pan;
}
// Set pan for audio stream // Set pan for audio stream
void SetAudioStreamPan(AudioStream stream, float pan) void SetAudioStreamPan(AudioStream stream, float pan)
{ {

View File

@ -1621,8 +1621,11 @@ RLAPI void PauseSound(Sound sound); // Pause a
RLAPI void ResumeSound(Sound sound); // Resume a paused sound RLAPI void ResumeSound(Sound sound); // Resume a paused sound
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level) RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
RLAPI float GetSoundVolume(Sound sound); // Get volume for a sound (1.0 is max level)
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level) RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
RLAPI float GetSoundPitch(Sound sound); // Get pitch for a sound (1.0 is base level)
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center) RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
RLAPI float GetSoundPan(Sound sound); // Set pan for a sound (0.5 is center)
RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
RLAPI void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range RLAPI void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range
RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
@ -1642,8 +1645,11 @@ RLAPI void PauseMusicStream(Music music); // Pause m
RLAPI void ResumeMusicStream(Music music); // Resume playing paused music RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds) RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds)
RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level) RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
RLAPI float GetMusicVolume(Music music); // Get volume for music (1.0 is max level)
RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level) RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
RLAPI float GetMusicPitch(Music music); // Get pitch for a music (1.0 is base level)
RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (0.5 is center) RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (0.5 is center)
RLAPI float GetMusicPan(Music music); // Get pan for a music (0.5 is center)
RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds) RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds) RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
@ -1659,8 +1665,11 @@ RLAPI void ResumeAudioStream(AudioStream stream); // Resume
RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check if audio stream is playing RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check if audio stream is playing
RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream
RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level) RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
RLAPI float GetAudioStreamVolume(AudioStream stream); // Get volume for audio stream (1.0 is max level)
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level) RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
RLAPI float GetAudioStreamPitch(AudioStream stream); // Get pitch for audio stream (1.0 is base level)
RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered) RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered)
RLAPI float GetAudioStreamPan(AudioStream stream); // Get pan for audio stream (0.5 is centered)
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data