You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeSineWave = /* the full type */;fnsine_wave(freq:f32) -> implFn() -> SineWave{move || sine_hz(freq) >> split::<U2>()*0.2}
All returned closures are of the same type. Thus, they have the same TypeId.
Internally, DspManager uses HashMap<TypeId, DspGraph>. This is built for functions with the type fn() -> impl AudioUnit32. It would be nice if there is a way to generate multiple functions/closures, each with a different type.
Another potential solution is to find the equivalent of Python's is operator. This test if the two objects are the same (not to be confused with equality). A ValueId would be nice, and can be an alternative to Box<dyn Hash> (this, of course, doesn't work).
The text was updated successfully, but these errors were encountered:
# Objective
- This is a very big refactor that allows better ergonomics, better refactorability, and better support for streaming audio.
- Partially complete #1 for `bevy_audio`,
- bevyengine/bevy#5819 ~needs to be merged first.~ is now merged! Now waiting for bevy 0.9.
- NiklasEi/bevy_kira_audio#63 is blocking for `kira`.
- Partially complete #2 for `oddio`
- bevyengine/bevy#5828 needs to be resolved first
- NiklasEi/bevy_kira_audio#63 is blocking for `kira`
- `oddio` isn't even implemented yet for this PR
- By virtue of solving #2, then #3 will be unblocked
- Unblocks #4 by using `DspGraph`
- Fixes#5
## Solution
- [x] Add support for
- [x] `bevy_audio`, ~blocked by bevyengine/bevy#5819~ Now waiting for bevy 0.9.
- [x] `bevy_kira_audio`, ~blocked by NiklasEi/bevy_kira_audio#72~ Now waiting for bevy 0.9.
- [x] `bevy_oddio`
- [ ] Add support for streaming audio in
- [x] `bevy_audio`, ~blocked by bevyengine/bevy#5819~
- [ ] `bevy_kira_audio`, blocked by NiklasEi/bevy_kira_audio#63
- [x] `bevy_oddio`
- [ ] Allow setting of parameters in
- [ ] `bevy_audio`, blocked by bevyengine/bevy#5828
- [ ] `bevy_kira_audio`, blocked by NiklasEi/bevy_kira_audio#63
- [x] `bevy_oddio`
## Note for Users of this Branch
If you are a user of `bevy_fundsp`, please try to test this PR! This currently only works with bevy_audio (EDIT: and bevy_oddio!), because this relies on a branch I made on bevy.
---
## Changelog
Reworked the majority of the code.
## Added
- A way to play streaming DSP sources. See `SourceType::Dynamic`.
- You can play DSP sources using `Audio::play_dsp`.
- Two iterators on streaming audio sources: `Iter` and `IterMono`.
### Changed
- Adding the DSP plugin.
- You must now call `DspPlugin::default()`.
- The method on adding DSP sources.
- No more initializing using `DspAssets`!
- Just add your DSP function using `app.add_dsp_source`
- Playing DSP sources require `Audio` to be mutable. (Use `ResMut`)
- A lot of internals are shuffled around.
### Removed
- `DspAssets`
- `FnDspGraph`
- `StreamingDspSource`
Currently, this could not work:
All returned closures are of the same type. Thus, they have the same
TypeId
.Internally,
DspManager
usesHashMap<TypeId, DspGraph>
. This is built for functions with the typefn() -> impl AudioUnit32
. It would be nice if there is a way to generate multiple functions/closures, each with a different type.Another potential solution is to find the equivalent of Python's
is
operator. This test if the two objects are the same (not to be confused with equality). AValueId
would be nice, and can be an alternative toBox<dyn Hash>
(this, of course, doesn't work).The text was updated successfully, but these errors were encountered: