From 569538aa1f0e7168b5d01cd89f96dc0dd4a35ce9 Mon Sep 17 00:00:00 2001 From: rexim Date: Tue, 17 Oct 2023 18:02:33 +0700 Subject: [PATCH] [raudio] Implement GetMasterVolume() It feels a little unfinished when you can SetMasterVolume but can't really Get it. So to finish the symmetry here is the GetMasterVolume implementation. --- src/raudio.c | 8 ++++++++ src/raylib.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/raudio.c b/src/raudio.c index a8d1b40e2e4d..6a10967673ee 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -536,6 +536,14 @@ void SetMasterVolume(float volume) ma_device_set_master_volume(&AUDIO.System.device, volume); } +// Get master volume (listener) +float GetMasterVolume(void) +{ + float volume = 0.0f; + ma_device_get_master_volume(&AUDIO.System.device, &volume); + return volume; +} + //---------------------------------------------------------------------------------- // Module Functions Definition - Audio Buffer management //---------------------------------------------------------------------------------- diff --git a/src/raylib.h b/src/raylib.h index c03e0a5765ce..331bf5253949 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1538,6 +1538,7 @@ RLAPI void InitAudioDevice(void); // Initial RLAPI void CloseAudioDevice(void); // Close the audio device and context RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully RLAPI void SetMasterVolume(float volume); // Set master volume (listener) +RLAPI float GetMasterVolume(void); // Get master volume (listener) // Wave/Sound loading/unloading functions RLAPI Wave LoadWave(const char *fileName); // Load wave data from file