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

Allow keeping handles on SoundEffect #12

Open
ikskuh opened this issue Dec 11, 2020 · 0 comments
Open

Allow keeping handles on SoundEffect #12

ikskuh opened this issue Dec 11, 2020 · 0 comments
Labels
feature New feature or request good first issue Good for newcomers

Comments

@ikskuh
Copy link
Contributor

ikskuh commented Dec 11, 2020

Add a retain-release-logic to SoundEffect so it is possible to keep handles to played sounds and modify stuff like volume or panning while the sound plays.

basic idea is that there's a atomic reference counter and release() requires a EventPool where the sound is freed with when the refcount goes to zero.

const handle = try audio.playSound(sound, .{
  .keep_reference = true, // this is opt-in behaviour, we would not retain the sound handle by defaul
});
…
handle.pan += 0.2 * delta_time;
…
audio.releaseSound(handle);

Expose the following features to the user:

  • is_playing
  • pan
  • volume
@ikskuh ikskuh added feature New feature or request good first issue Good for newcomers labels Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant