summaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
authorjussi2023-11-20 21:04:53 +0200
committerjussi2023-11-20 21:04:53 +0200
commit05eaafb79e6fa1bebff157e94563334d7ead700b (patch)
tree574ae0af685967df067efe11058dc50478558333 /src/audio.c
parent7765a23a2c90e6d02f6278eed1b1b9b9375bc941 (diff)
downloadreilua-enhanced-05eaafb79e6fa1bebff157e94563334d7ead700b.tar.gz
reilua-enhanced-05eaafb79e6fa1bebff157e94563334d7ead700b.tar.bz2
reilua-enhanced-05eaafb79e6fa1bebff157e94563334d7ead700b.zip
Initial changes for Raylib 5.0 and some missing functions.
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c
index 0b793b2..ef466cb 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -8,6 +8,41 @@
*/
/*
+> RL.InitAudioDevice()
+
+Initialize audio device and context
+*/
+int laudioInitAudioDevice( lua_State *L ) {
+ InitAudioDevice();
+
+ return 0;
+}
+
+/*
+> RL.CloseAudioDevice()
+
+Close the audio device and context
+*/
+int laudioCloseAudioDevice( lua_State *L ) {
+ CloseAudioDevice();
+
+ return 0;
+}
+
+/*
+> isReady = RL.IsAudioDeviceReady()
+
+Check if audio device has been initialized successfully
+
+- Success return bool
+*/
+int laudioIsAudioDeviceReady( lua_State *L ) {
+ lua_pushboolean( L, IsAudioDeviceReady() );
+
+ return 1;
+}
+
+/*
> RL.SetMasterVolume( float volume )
Set master volume (listener)
@@ -21,6 +56,19 @@ int laudioSetMasterVolume( lua_State *L ) {
}
/*
+> isReady = RL.GetMasterVolume()
+
+Get master volume (listener)
+
+- Success return float
+*/
+int laudioGetMasterVolume( lua_State *L ) {
+ lua_pushnumber( L, GetMasterVolume() );
+
+ return 1;
+}
+
+/*
## Audio - Wave/Sound loading/unloading functions
*/
@@ -95,6 +143,21 @@ int laudioLoadSoundFromWave( lua_State *L ) {
}
/*
+> sound = RL.LoadSoundAlias( Sound source )
+
+Create a new sound that shares the same sample data as the source sound, does not own the sound data
+
+- Success return Sound
+*/
+int laudioLoadSoundAlias( lua_State *L ) {
+ Sound *source = uluaGetSound( L, 1 );
+
+ uluaPushSound( L, LoadSoundAlias( *source ) );
+
+ return 1;
+}
+
+/*
> isReady = RL.IsSoundReady( Sound sound )
Checks if a sound is ready
@@ -136,6 +199,19 @@ int laudioUnloadSound( lua_State *L ) {
}
/*
+> RL.UnloadSoundAlias( Sound alias )
+
+Unload a sound alias (does not deallocate sample data)
+*/
+int laudioUnloadSoundAlias( lua_State *L ) {
+ Sound *alias = uluaGetSound( L, 1 );
+
+ UnloadSoundAlias( *alias );
+
+ return 0;
+}
+
+/*
> success = RL.ExportWave( Wave wave, string fileName )
Export wave data to file, returns true on success