diff --git a/src/raudio.c b/src/raudio.c index 032cfadeb..c2c53625a 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -1202,18 +1202,36 @@ bool IsSoundPlaying(Sound sound) return result; } +// Get volume for a sound +float GetSoundVolume(Sound sound) +{ + return sound.stream.buffer->volume; +} + // Set volume for a sound void SetSoundVolume(Sound sound, float 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 void SetSoundPitch(Sound sound, float 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 void SetSoundPan(Sound sound, float pan) { @@ -2022,18 +2040,36 @@ bool IsMusicStreamPlaying(Music music) return IsAudioStreamPlaying(music.stream); } +// Get volume for music +float GetMusicVolume(Music music) +{ + return music.stream.buffer->volume; +} + // Set volume for music void SetMusicVolume(Music music, float volume) { SetAudioStreamVolume(music.stream, volume); } +// Get pitch for music +float GetMusicPitch(Music music) +{ + return music.stream.buffer->pitch; +} + // Set pitch for music void SetMusicPitch(Music music, float 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 void SetMusicPan(Music music, float pan) { @@ -2185,18 +2221,36 @@ void StopAudioStream(AudioStream stream) 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) void SetAudioStreamVolume(AudioStream stream, float 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) void SetAudioStreamPitch(AudioStream stream, float pitch) { SetAudioBufferPitch(stream.buffer, pitch); } +// Get pan for audio stream +float GetAudioStreamPan(AudioStream stream) +{ + return stream.buffer->pan; +} + // Set pan for audio stream void SetAudioStreamPan(AudioStream stream, float pan) { diff --git a/src/raylib.h b/src/raylib.h index 035f6f2bf..f3682a6c3 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1621,8 +1621,11 @@ RLAPI void PauseSound(Sound sound); // Pause a RLAPI void ResumeSound(Sound sound); // Resume a paused sound 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 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 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 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 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 @@ -1642,8 +1645,11 @@ RLAPI void PauseMusicStream(Music music); // Pause m 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 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 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 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 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 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 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 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 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 SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data