Compare commits

...

9 commits

Author SHA1 Message Date
ThePlayerRolo
371ce663b7
Merge 7a0b4c6b8e into 32f395fb0c 2025-10-21 12:47:13 -05:00
ThePlayerRolo
7a0b4c6b8e Merge branch 'dev' of https://github.com/ThePlayerRolo/sm64coopdx into dev 2025-09-19 20:06:21 -04:00
ThePlayerRolo
67edb1316f Update smlua_audio_utils again 2025-09-19 20:05:33 -04:00
ThePlayerRolo
707dc7ca80
Update smlua_audio_utils.c 2025-07-19 17:58:53 -04:00
ThePlayerRolo
88e084d5ef Final fix (hopefully) 2025-07-14 18:01:15 -04:00
ThePlayerRolo
f20d238167 Updates according to review 2025-07-12 21:07:37 -04:00
ThePlayerRolo
0983fee916 quick fix 2025-07-10 14:19:26 -04:00
ThePlayerRolo
a5dad2204c Edit Naming To Be Consistent 2025-07-10 14:13:44 -04:00
ThePlayerRolo
ca6a3d1148 Allocate Sequence 2025-07-10 12:36:21 -04:00
6 changed files with 56 additions and 0 deletions

View file

@ -10125,6 +10125,12 @@ function smlua_audio_utils_replace_sequence(sequenceId, bankId, defaultVolume, m
-- ...
end
--- @return integer
--- Allocates a new sequence ID
function smlua_audio_utils_allocate_sequence()
-- ...
end
--- @param filename string
--- @return ModAudio
--- Loads an `audio` stream by `filename` (with extension)

View file

@ -5612,6 +5612,27 @@ Replaces the sequence corresponding to `sequenceId` with one called `m64Name`.m6
<br />
## [smlua_audio_utils_allocate_sequence](#smlua_audio_utils_allocate_sequence)
### Description
Allocates a new sequence ID
### Lua Example
`local integerValue = smlua_audio_utils_allocate_sequence()`
### Parameters
- None
### Returns
- `integer`
### C Prototype
`u8 smlua_audio_utils_allocate_sequence(void);`
[:arrow_up_small:](#)
<br />
## [audio_stream_load](#audio_stream_load)
### Description

View file

@ -1815,6 +1815,7 @@
- smlua_audio_utils.h
- [smlua_audio_utils_reset_all](functions-6.md#smlua_audio_utils_reset_all)
- [smlua_audio_utils_replace_sequence](functions-6.md#smlua_audio_utils_replace_sequence)
- [smlua_audio_utils_allocate_sequence](functions-6.md#smlua_audio_utils_allocate_sequence)
- [audio_stream_load](functions-6.md#audio_stream_load)
- [audio_stream_destroy](functions-6.md#audio_stream_destroy)
- [audio_stream_play](functions-6.md#audio_stream_play)

View file

@ -30609,6 +30609,21 @@ int smlua_func_smlua_audio_utils_replace_sequence(lua_State* L) {
return 1;
}
int smlua_func_smlua_audio_utils_allocate_sequence(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "smlua_audio_utils_allocate_sequence", 0, top);
return 0;
}
lua_pushinteger(L, smlua_audio_utils_allocate_sequence());
return 1;
}
int smlua_func_audio_stream_load(lua_State* L) {
if (L == NULL) { return 0; }
@ -38409,6 +38424,7 @@ void smlua_bind_functions_autogen(void) {
// smlua_audio_utils.h
smlua_bind_function(L, "smlua_audio_utils_reset_all", smlua_func_smlua_audio_utils_reset_all);
smlua_bind_function(L, "smlua_audio_utils_replace_sequence", smlua_func_smlua_audio_utils_replace_sequence);
smlua_bind_function(L, "smlua_audio_utils_allocate_sequence", smlua_func_smlua_audio_utils_allocate_sequence);
smlua_bind_function(L, "audio_stream_load", smlua_func_audio_stream_load);
smlua_bind_function(L, "audio_stream_destroy", smlua_func_audio_stream_destroy);
smlua_bind_function(L, "audio_stream_play", smlua_func_audio_stream_play);

View file

@ -170,6 +170,16 @@ void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolu
LOG_LUA_LINE("Could not find m64 at path: %s", m64path);
}
u8 smlua_audio_utils_allocate_sequence(void) {
for (u8 seqId = SEQ_COUNT + 1; seqId < MAX_AUDIO_OVERRIDE; seqId++) {
if (!sAudioOverrides[seqId].enabled) {
return seqId;
}
}
LOG_ERROR("Cannot allocate more custom sequences.");
return 0;
}
///////////////
// mod audio //
///////////////

View file

@ -8,6 +8,8 @@ void smlua_audio_utils_reset_all(void);
bool smlua_audio_utils_override(u8 sequenceId, s32* bankId, void** seqData);
/* |description|Replaces the sequence corresponding to `sequenceId` with one called `m64Name`.m64 with `bankId` and `defaultVolume`|descriptionEnd| */
void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolume, const char* m64Name);
/* |description|Allocates a new sequence ID|descriptionEnd| */
u8 smlua_audio_utils_allocate_sequence(void);
////////////////
// mod sounds //