Implement SFX & BGM Data API Functions: get_lengths #57
Labels
Audio
Related to the Audio or Sound Engine crates.
Console
Related to the Console crate
enhancement
New feature or request
good first issue
Good for newcomers
RS
Related to the gamercade_rs crate
Now that
bgm_is_active
andchannel_is_active
are removed, we need a way to notify the game logic how long a sound will last.I propose adding two more functions to the
data_api
bgm_length_secs(index: i32) -> f32
which returns the length of the BGM in seconds.bgm_length_frames(index: i32) -> i32
which returns the length of the BGM in frames.sfx_length_secs(index: i32) -> f32
same as 1, but for SFX.sfx_length_frames(index: i32) -> i32
same as 2, but for SFX.While we don't have looping BGM or SFX yet, I figure we could use INFINITY or NaN or a negative number to represent looping ones in the future.
For the "frame" based ones, this should be an integer for the sound to completely complete. For example, if a SFX would take 15.5 game frames to complete, it should return 16.
Task List:
bgm_length_secs
bgm_length_frames
sfx_length_secs
sfx_length_frames
The text was updated successfully, but these errors were encountered: