Add Core DSP Chain Elements
mitchmindtree opened this issue · comments
We will break this down into several modules.
- SoundUnit
The base trait for sound units that can be strung together into a DSP-style chain. - SoundSource
The base trait for SoundUnits that generate some kind of sound output. - SoundBuffer
A wrapper struct for an interleaved floating point buffer with a fixed length that is equal toframes * channels
- SoundSink
The base trait for sound units that receives audio data, either by pulling from upstream inputs, or from anaudio_requested
method. - SoundMixer
A trait that derives from SoundSink and SoundSource that mixes together inputs from multiple SoundSources. - SoundEffect
The base trait for a sound effect, which takes input from an upstream SoundSource and processes it.
These are some base ideas inspired by ofxDspChain (a dsp chain i'm quite familiar with).
Remember that since Rust got modules and the crate is named sound
, you could have sound::Mixer
instead of sound::SoundMixer
.
Buffer
is taken by std, but will do this for the others.
Well, you can still have sound::Buffer
.
I wonder what other people thing about prefixes vs using the module.
Perhaps this will be a problem with traits, since they need to be used to import the methods.
I think you're right, the module is definitely better, but I think just SoundBuffer is fine for that one, remember the crate is called dsp
anyway.
Ah, forgot that. Perhaps we should have Sound
as prefix for everything then?
hmm I quite like dsp::Source
, dsp::Unit
, dsp::Mixer
, etc now you mention it haha. What do you think?
Let's try it. Rust supports aliasing anyway.