dxinteractive
02-08-2016, 05:17 AM
Hi, I'm using a Teensy to make a little multi effects unit. In this I'm planning to have "modes", where each mode is basically a set of effects / mixers etc with connections between them. A couple of buttons will allow selecting a different mode during program execution. No need for two modes to run at the same time, however a mode will obviously contain multiple AudioStream and AudioConnection objects. It'd be cool to choose a Chorus effect and then flick over to a Low Pass Filter etc. all in one little box.
Now there are two ways I can think of making something like this work.
Create necessary AudioStream and AudioConnection objects when changing to a new mode. This requires the ability to remove those objects later when a different mode is selected. Also need to allocate objects on the heap, I've never seen examples do this but it seems to work. Not sure how it affects performance.
Create all AudioStream and AudioConnection objects and set up a mechanism to allow most presets to be bypassed at any given time. This seems wasteful (not sure if it actually is), and given the amount of modes I want to potentially use (hopefully 10-20!) I'm not sure if it's a suitable option. I don't know just how much memory or processor usage these objects take up if they are bypassed, or even if there is a mechanism to toggle an AudioStream object to be bypassed or not.
So right now I'm aiming for option 1. Any ideas if that's possible? So far I've thought of a couple of things:
it looks as though a AudioConnection::disconnect() method would have to be created to complement AudioConnection::connect().
Do AudioConnection or AudioStream objects get added to any register-style objects that they would need to be de-registered from? The comment on the docs that says "Connections are most efficient when made from an earlier object (in the order they are created) to a later one" (https://www.pjrc.com/teensy/td_libs_AudioConnection.html) makes me think there is a little magic going on behind the scenes that I should probably be aware of.
Now there are two ways I can think of making something like this work.
Create necessary AudioStream and AudioConnection objects when changing to a new mode. This requires the ability to remove those objects later when a different mode is selected. Also need to allocate objects on the heap, I've never seen examples do this but it seems to work. Not sure how it affects performance.
Create all AudioStream and AudioConnection objects and set up a mechanism to allow most presets to be bypassed at any given time. This seems wasteful (not sure if it actually is), and given the amount of modes I want to potentially use (hopefully 10-20!) I'm not sure if it's a suitable option. I don't know just how much memory or processor usage these objects take up if they are bypassed, or even if there is a mechanism to toggle an AudioStream object to be bypassed or not.
So right now I'm aiming for option 1. Any ideas if that's possible? So far I've thought of a couple of things:
it looks as though a AudioConnection::disconnect() method would have to be created to complement AudioConnection::connect().
Do AudioConnection or AudioStream objects get added to any register-style objects that they would need to be de-registered from? The comment on the docs that says "Connections are most efficient when made from an earlier object (in the order they are created) to a later one" (https://www.pjrc.com/teensy/td_libs_AudioConnection.html) makes me think there is a little magic going on behind the scenes that I should probably be aware of.