Can an AudioSource be connected to two mixers?


#1

Mixer has addInput - can an audio source be added to two mixers? Is that likely to work? What I want to do is:

AudioSource -> output mixer -> output
            -> send mixer -> reverb -> output mixer

Or is there some other way of doing it?


#2

Pete,

the Audio source class is designed to allow a chain of audio sources to apply multiple effects, so this is not a problem. However, if you have two parallel mixers that attach to the same audio source then this won't work (at least not in a standard audio source) because the audio source reads sequential blocks of audio data in a stream and each mixer will only receive part of the data.

The way to do this is to store the output that you want to send to both mixers in an intermediate buffer which you then copy to both mixers. You could, for example, subclass a splitter audio source which buffers  streams and keeps a separate "next buffer" pointer for each mixer that calls it.  


#3

I found out by accident what happens if an audio source is connected to two mixers. It plays at twice the speed and distorts!

I'd forgotten to remove the source from one mixer, once I fixed that all was well. I've chosen to simply have an alternate path rather than a send for now.