Expose most of the music handler to Lua
This exposes several music functions to Lua, while also enabling modders to add their own custom tune IDs.
Music system changes
Tunes can now be added via the Music_AddTune
function. A set of tune flags can be passed to the function to assign various values on creation of a tune:
TN_LOOPING
TN_INCLUSIVEFADE
TN_USEMAPVOLUME
TN_SYNCMUSIC
TN_MUSICCRED
TN_VAPES
TN_NIGHTCOREABLE
-
TN_CHANGEPITCH
(combination ofTN_VAPES
andTN_NIGHTCOREABLE
)
A Music_SetFadeIn
function has been added to the music framework, allowing for an easy way to set a tune's fade-in.
Example
I've created a Lua file that serves as a basic test for the music functions, playing existing base-game music.
Everything has been tested in a Windows build. Both the Developer and Release presets have been used.
Merge request reports
Activity
- Resolved by Sal
I'm not convinced that restricting this Lua-facing API to just one tune mimicking the legacy API would be the right approach. ACS already has full access to
Music_Play
,Music_Remap
andMusic_StopAll
, plus a custom fade-in/fade-out function usingg_musicfade
, so I don't see why we shouldn't expose at least a large chunk ofmusic.h
to Lua directly. It might also be a good idea to add some more direct control over the music manager thatmusic.h
doesn't expose, using a hook, similarly to how SRB2Kart had theMusicChange
hook.Edited by X.organic
added 1 commit
- c394732c - Clean up leftovers of the prior implementation
- Resolved by toaster
Do you mind cleaning up the commit history by force pushing a flatter diff? Adding and then removing significant amounts of code makes git bisect harder to manage
added Lua label
- Resolved by Sal
I am uncomfortable with adding anything that retrieves client-sided information about the music's state, because they can create desyncs online. The music functions already in ACS and the new tune functions are OK, because they do their function without giving you any additional information about the music's state.
See the explanation here on why: !38 (comment 61422)
added 1 commit
- fb448fd5 - Remove functions that retrieve client-sided information
added 1 commit
- 90860cc6 - Remove Lua function for ``Music_TuneExists``
added 42 commits
-
90860cc6...e4b81494 - 39 commits from branch
KartKrew:master
- 72c7ee0e - Expose most of music.h to Lua
- f65d59a8 - Remove functions that retrieve client-sided information
- 3feb03ef - Remove Lua function for ``Music_TuneExists``
Toggle commit list-
90860cc6...e4b81494 - 39 commits from branch
mentioned in commit 61956f59