FyroxEngine / Fyrox

3D and 2D game engine written in Rust
https://fyrox.rs
MIT License
7.73k stars 350 forks source link

Do effects affect the sound sources' locations? #273

Closed herrkami closed 2 years ago

herrkami commented 2 years ago

If I can still trust my aging ears, the sound source in fyrox-sound/examples/reverb.rs does not change position as it should. If you remove lines 80 to 82, where the source is passed to the reverb effect, the source rotates nicely, such as in fyrox-sound/examples/hrtf.rs. However, adding the reverb makes the source static, it seems to me.

Is this due to the reverb effect itself, or do location updates not affect sources passed to effects? Unfortunately, I'm quite new to Rust and don`t quite know how to debug this yet.

mrDIMAS commented 2 years ago

The reverb effect takes raw samples (which are not affected by spatialization) and passes it thorough complex chain of delay lines, filters and stuff. The signal from reverb effect is then mixed with spatialized signals from sound sources. There is a separate effect gain control for reverb, and I think it is a bit high in this example.

herrkami commented 2 years ago

Wow, thanks for the quick reply! I'll try to adjust the reverb volume then. Would it also be possible to route the spatialized signals to the reverb or do effects only accept samples or filtered samples as input?

mrDIMAS commented 2 years ago

Currently it is not possible, I thought about adding processing graphs to the crate, but then decided a simpler solution with a fixed functionality. But it shouldn't be too hard to implement something that you need.

herrkami commented 2 years ago

Thank you mrDIMAS. I would like to contribute but I lack the time unfortunately. Having this feature would enable Fyrox to be also usable as pretty neat DSP-suite.