Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SFX & BGM Data API Functions: get_lengths #57

Closed
10 tasks done
Tracked by #54
RobDavenport opened this issue Sep 12, 2022 · 0 comments
Closed
10 tasks done
Tracked by #54

Implement SFX & BGM Data API Functions: get_lengths #57

RobDavenport opened this issue Sep 12, 2022 · 0 comments
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

Comments

@RobDavenport
Copy link
Member

RobDavenport commented Sep 12, 2022

Now that bgm_is_active and channel_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

  1. bgm_length_secs(index: i32) -> f32 which returns the length of the BGM in seconds.
  2. bgm_length_frames(index: i32) -> i32 which returns the length of the BGM in frames.
  3. sfx_length_secs(index: i32) -> f32 same as 1, but for SFX.
  4. 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:

  • Figure out how to calculate length of a sequence in seconds (f32) from the BPM
  • Figure out how to calculate the length of a sequence in frames, from the previous step.
  • implement bgm_length_secs
  • implement bgm_length_frames
  • implement sfx_length_secs
  • implement sfx_length_frames
  • update gamercade_rs with 4 new functions
  • update docs with 4 new functions (gamercade-io/gamercade_site@c1675e7)
  • Add UI label on song editor to show song length
  • Add UI label on SFX editor to show sfx length
@RobDavenport RobDavenport added enhancement New feature or request Audio Related to the Audio or Sound Engine crates. Console Related to the Console crate labels Sep 12, 2022
@RobDavenport RobDavenport changed the title Implement SFX & BGM Data API Functions: get_length Implement SFX & BGM Data API Functions: get_lengths Sep 12, 2022
@RobDavenport RobDavenport added RS Related to the gamercade_rs crate good first issue Good for newcomers labels Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant