RustAudio / dasp

The fundamentals for Digital Audio Signal Processing. Formerly `sample`.
Other
886 stars 65 forks source link

Realtime-friendly Bus implementation #64

Open andrewcsmith opened 7 years ago

andrewcsmith commented 7 years ago

While Bus is pretty cool, the use of VecDeque (and the possibility that it will reallocate mid-sample) means that it's not suitable for realtime audio. I'm working on a (very circumscribed) replacement that is suitable.

mitchmindtree commented 7 years ago

I wonder if we can have Signal::bus take a ring_buffer::Bounded (instead of using an inner VecDeque) to solve this? I guess the caveat would be that although this would allow for ensuring no dynamic allocations, there would be the chance of panic!ing if the ring buffer's max length was exceeded. I think the real-time case is probably important enough that this would be worth it though. Perhaps we can consider re-adding a growable option if there's a desire for it in the future.

mitchmindtree commented 7 years ago

Btw, would love to see your implementation if you think it could make a nice replacement!