dynamic link creation model #823
-
How is this library modeled to create links between different nodes? There seem to be multiple different base classes for things (AudioStream, AudioOutput, AudioSource, StreamCopy, etc) and none inherit from any common superclass. The Javascript web audio API, as well as PJRC's Teensy Audio library, designed everything as audio nodes that have input and output "ports", that are then connected together. A sine wave generator might have 1 output (mono) and 0 inputs, for example. I find this kind of organization easy to think about, but unfortunately I'm trying to do some audio work on an ESP32, using this library. I'm not asking for any rewrite here. I'm just asking is there any base model/abstraction/idea about how audio is routed between nodes? Mostly because I want to dynamically re-route audio at runtime, and knowing when to pass in an input stream as a parameter to a constructor and then using that stream as an output, versus using a StreamCopy to pump data between two streams is a little confusing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
The starting point was the Arduino class model! At the root you have Print and as subclass of Print you have Stream. Therefore AudioStream inherits from Stream and AudioOutput inherits from Print! Arduino Print is for writing data and Stream supports writing and reading! I tried to be consistent in the classes, so when you can read and write it is a Stream and if it is output only it is ending with Output and inherits from Print and not Stream. This has the big advantage that we can also use any Arduino subclasses which inherits from Print of Stream: in our framwork as well: e.g. File, Serial etc... |
Beta Was this translation helpful? Give feedback.
Just read the chapter about encoding and decoding
The Wiki is quite complete!