bevyengine / bevyengine/bevy

Add equivalent to kira's `Handle` or oddio's `Controlled` in `bevy_audio::Decodable`

Open
#5,828 1 comment 0 reactions 0 assignees View on GitHub
A-Audio C-Feature
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

- There should be a way to control a playing sound externally, outside of what is possible using `AudioSink`.
- kira achieved this by returning a [`Handle`](kira::Handle) in [`SoundData`].
- oddio achieved this by implementing [`Controlled`] for some [`Signal`] types.

[kira::Handle]: https://docs.rs/kira/latest/kira/sound/trait.SoundData.html#associatedtype.Handle
[`SoundData`]: https://docs.rs/kira/latest/kira/sound/trait.SoundData.html
[`Controlled`]: https://docs.rs/oddio/latest/oddio/trait.Controlled.html
[`Signal`]: https://docs.rs/oddio/latest/oddio/trait.Signal.html

## What solution would you like?

- In [`Decodable`], add another associated type called `Control` (`Handle` is taken)
- This `Control` is returned from `Decodable::decoder()`, alongside `Decoder`.
- The `Control` is returned to the user when using `Audio::play` or other related functions.

[`Decodable`]: https://docs.rs/bevy_audio/latest/bevy_audio/trait.Decodable.html

## What alternative(s) have you considered?

- Just do not do this. lol
- Embed `Control` in `AudioSink`.

## Additional context

- I am refactoring [`bevy_fundsp`] right now, and I want to resolve harudagondi/bevy_fundsp#2

[`bevy_fundsp`]: https://github.com/harudagondi/bevy_fundsp

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.