diff --git a/bridge/src/fmod_generated.c b/bridge/src/fmod_generated.c index 5f99678..19ade0e 100644 --- a/bridge/src/fmod_generated.c +++ b/bridge/src/fmod_generated.c @@ -22,6 +22,8 @@ inline static void throwError(FMOD_RESULT res, lua_State* L) { /* Basic types */ +#define optional(L, index, typename, x) (lua_isnoneornil(L, index) ? ((typename)0) : (x)) + #define FMODBridge_push_char(L, x) lua_pushnumber(L, (lua_Number)(x)) #define FMODBridge_check_char(L, index) ((char)luaL_checknumber(L, index)) #define FMODBridge_push_short(L, x) lua_pushnumber(L, (lua_Number)(x)) @@ -2939,38 +2941,36 @@ static int _FMODBridge_func_FMOD_System_GetFileUsage(lua_State *L) { #endif -/* FMOD_System_CreateSound(input FMOD_SYSTEM* system, input const char* name_or_data, input FMOD_MODE mode, output_ptr FMOD_CREATESOUNDEXINFO* exinfo, output FMOD_SOUND** sound, ) */ +/* FMOD_System_CreateSound(input FMOD_SYSTEM* system, input const char* name_or_data, input FMOD_MODE mode, input FMOD_CREATESOUNDEXINFO* exinfo, output FMOD_SOUND** sound, ) */ #ifndef FMODBridge_func_FMOD_System_CreateSound #define FMODBridge_func_FMOD_System_CreateSound _FMODBridge_func_FMOD_System_CreateSound static int _FMODBridge_func_FMOD_System_CreateSound(lua_State *L) { FMOD_SYSTEM* system = FMODBridge_check_ptr_FMOD_SYSTEM(L, 1); const char* name_or_data = FMODBridge_check_ptr_char(L, 2); FMOD_MODE mode = FMODBridge_check_unsigned_int(L, 3); - FMOD_CREATESOUNDEXINFO* exinfo = FMODBridge_push_ptr_FMOD_CREATESOUNDEXINFO(L, NULL); + FMOD_CREATESOUNDEXINFO* exinfo = optional(L, 4, FMOD_CREATESOUNDEXINFO*, FMODBridge_check_ptr_FMOD_CREATESOUNDEXINFO(L, 4)); FMOD_SOUND* sound; ensure(LL, FMOD_System_CreateSound, FMOD_RESULT, FMOD_SYSTEM*, const char*, FMOD_MODE, FMOD_CREATESOUNDEXINFO*, FMOD_SOUND**); errCheck(FMOD_System_CreateSound(system, name_or_data, mode, exinfo, &sound)); - lua_pushvalue(L, -1); FMODBridge_push_ptr_FMOD_SOUND(L, sound); - return 2; + return 1; } #endif -/* FMOD_System_CreateStream(input FMOD_SYSTEM* system, input const char* name_or_data, input FMOD_MODE mode, output_ptr FMOD_CREATESOUNDEXINFO* exinfo, output FMOD_SOUND** sound, ) */ +/* FMOD_System_CreateStream(input FMOD_SYSTEM* system, input const char* name_or_data, input FMOD_MODE mode, input FMOD_CREATESOUNDEXINFO* exinfo, output FMOD_SOUND** sound, ) */ #ifndef FMODBridge_func_FMOD_System_CreateStream #define FMODBridge_func_FMOD_System_CreateStream _FMODBridge_func_FMOD_System_CreateStream static int _FMODBridge_func_FMOD_System_CreateStream(lua_State *L) { FMOD_SYSTEM* system = FMODBridge_check_ptr_FMOD_SYSTEM(L, 1); const char* name_or_data = FMODBridge_check_ptr_char(L, 2); FMOD_MODE mode = FMODBridge_check_unsigned_int(L, 3); - FMOD_CREATESOUNDEXINFO* exinfo = FMODBridge_push_ptr_FMOD_CREATESOUNDEXINFO(L, NULL); + FMOD_CREATESOUNDEXINFO* exinfo = optional(L, 4, FMOD_CREATESOUNDEXINFO*, FMODBridge_check_ptr_FMOD_CREATESOUNDEXINFO(L, 4)); FMOD_SOUND* sound; ensure(LL, FMOD_System_CreateStream, FMOD_RESULT, FMOD_SYSTEM*, const char*, FMOD_MODE, FMOD_CREATESOUNDEXINFO*, FMOD_SOUND**); errCheck(FMOD_System_CreateStream(system, name_or_data, mode, exinfo, &sound)); - lua_pushvalue(L, -1); FMODBridge_push_ptr_FMOD_SOUND(L, sound); - return 2; + return 1; } #endif @@ -3055,8 +3055,8 @@ static int _FMODBridge_func_FMOD_System_CreateReverb3D(lua_State *L) { static int _FMODBridge_func_FMOD_System_PlaySound(lua_State *L) { FMOD_SYSTEM* system = FMODBridge_check_ptr_FMOD_SYSTEM(L, 1); FMOD_SOUND* sound = FMODBridge_check_ptr_FMOD_SOUND(L, 2); - FMOD_CHANNELGROUP* channelgroup = FMODBridge_check_ptr_FMOD_CHANNELGROUP(L, 3); - FMOD_BOOL paused = FMODBridge_check_FMOD_BOOL(L, 4); + FMOD_CHANNELGROUP* channelgroup = optional(L, 3, FMOD_CHANNELGROUP*, FMODBridge_check_ptr_FMOD_CHANNELGROUP(L, 3)); + FMOD_BOOL paused = optional(L, 4, FMOD_BOOL, FMODBridge_check_FMOD_BOOL(L, 4)); FMOD_CHANNEL* channel; ensure(LL, FMOD_System_PlaySound, FMOD_RESULT, FMOD_SYSTEM*, FMOD_SOUND*, FMOD_CHANNELGROUP*, FMOD_BOOL, FMOD_CHANNEL**); errCheck(FMOD_System_PlaySound(system, sound, channelgroup, paused, &channel)); diff --git a/fmod/lib/arm64-android/libfmodbridge.a b/fmod/lib/arm64-android/libfmodbridge.a index 6780ddf..876d525 100644 Binary files a/fmod/lib/arm64-android/libfmodbridge.a and b/fmod/lib/arm64-android/libfmodbridge.a differ diff --git a/fmod/lib/armv7-android/libfmodbridge.a b/fmod/lib/armv7-android/libfmodbridge.a index 3ef4318..81453cc 100644 Binary files a/fmod/lib/armv7-android/libfmodbridge.a and b/fmod/lib/armv7-android/libfmodbridge.a differ diff --git a/fmod/lib/ios/libfmodbridge.a b/fmod/lib/ios/libfmodbridge.a index 76cd932..36246cc 100644 Binary files a/fmod/lib/ios/libfmodbridge.a and b/fmod/lib/ios/libfmodbridge.a differ diff --git a/fmod/lib/osx/libfmodbridge.a b/fmod/lib/osx/libfmodbridge.a index c21b645..9f6b0d5 100644 Binary files a/fmod/lib/osx/libfmodbridge.a and b/fmod/lib/osx/libfmodbridge.a differ diff --git a/fmod/lib/web/libfmodbridge.a b/fmod/lib/web/libfmodbridge.a index 6ae868f..6cf8c8a 100644 Binary files a/fmod/lib/web/libfmodbridge.a and b/fmod/lib/web/libfmodbridge.a differ diff --git a/fmod/lib/x86-win32/fmodbridge.lib b/fmod/lib/x86-win32/fmodbridge.lib index 802fca6..edd53e5 100644 Binary files a/fmod/lib/x86-win32/fmodbridge.lib and b/fmod/lib/x86-win32/fmodbridge.lib differ diff --git a/fmod/lib/x86_64-ios/libfmodbridge_simulator.a b/fmod/lib/x86_64-ios/libfmodbridge_simulator.a index e2ca2a9..f9bacb0 100644 Binary files a/fmod/lib/x86_64-ios/libfmodbridge_simulator.a and b/fmod/lib/x86_64-ios/libfmodbridge_simulator.a differ diff --git a/fmod/lib/x86_64-linux/libfmodbridge.a b/fmod/lib/x86_64-linux/libfmodbridge.a index ae47fdf..a2b1857 100755 Binary files a/fmod/lib/x86_64-linux/libfmodbridge.a and b/fmod/lib/x86_64-linux/libfmodbridge.a differ diff --git a/fmod/lib/x86_64-win32/fmodbridge.lib b/fmod/lib/x86_64-win32/fmodbridge.lib index f1ec364..964d5f6 100644 Binary files a/fmod/lib/x86_64-win32/fmodbridge.lib and b/fmod/lib/x86_64-win32/fmodbridge.lib differ