Expose sound_get_level_intensity

This commit is contained in:
Agent X 2024-06-12 15:01:11 -04:00
parent eb2033f9b0
commit 40fb681eda
5 changed files with 46 additions and 1 deletions

View File

@ -67,7 +67,7 @@ in_files = [
]
override_allowed_functions = {
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music" ],
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks", "drop_queued_background_music", "sound_get_level_intensity" ],
"src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ],
"src/pc/djui/djui_popup.h" : [ "create" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked", "touch_coin_score_age", "save_file_set_course_coin_score", "save_file_do_save", "save_file_remove_star_flags" ],

View File

@ -3313,6 +3313,12 @@ function sound_banks_enable(player, bankMask)
-- ...
end
--- @param distance number
--- @return number
function sound_get_level_intensity(distance)
-- ...
end
--- @param seqId integer
function stop_background_music(seqId)
-- ...

View File

@ -3161,6 +3161,26 @@
<br />
## [sound_get_level_intensity](#sound_get_level_intensity)
### Lua Example
`local numberValue = sound_get_level_intensity(distance)`
### Parameters
| Field | Type |
| ----- | ---- |
| distance | `number` |
### Returns
- `number`
### C Prototype
`f32 sound_get_level_intensity(f32 distance);`
[:arrow_up_small:](#)
<br />
## [stop_background_music](#stop_background_music)
### Lua Example

View File

@ -791,6 +791,7 @@
- [set_audio_fadeout](functions-3.md#set_audio_fadeout)
- [sound_banks_disable](functions-3.md#sound_banks_disable)
- [sound_banks_enable](functions-3.md#sound_banks_enable)
- [sound_get_level_intensity](functions-3.md#sound_get_level_intensity)
- [stop_background_music](functions-3.md#stop_background_music)
- [stop_secondary_music](functions-3.md#stop_secondary_music)
- [stop_sound](functions-3.md#stop_sound)

View File

@ -13079,6 +13079,23 @@ int smlua_func_sound_banks_enable(lua_State* L) {
return 1;
}
int smlua_func_sound_get_level_intensity(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 1) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "sound_get_level_intensity", 1, top);
return 0;
}
f32 distance = smlua_to_number(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "sound_get_level_intensity"); return 0; }
lua_pushnumber(L, sound_get_level_intensity(distance));
return 1;
}
int smlua_func_stop_background_music(lua_State* L) {
if (L == NULL) { return 0; }
@ -33352,6 +33369,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "set_audio_fadeout", smlua_func_set_audio_fadeout);
smlua_bind_function(L, "sound_banks_disable", smlua_func_sound_banks_disable);
smlua_bind_function(L, "sound_banks_enable", smlua_func_sound_banks_enable);
smlua_bind_function(L, "sound_get_level_intensity", smlua_func_sound_get_level_intensity);
smlua_bind_function(L, "stop_background_music", smlua_func_stop_background_music);
smlua_bind_function(L, "stop_secondary_music", smlua_func_stop_secondary_music);
smlua_bind_function(L, "stop_sound", smlua_func_stop_sound);