Synchonous and asynchronous streaming in aRts

There are various requirements how a module can do streaming. To see the difference, here some examples:

The first case is the simplest. On getting 200 samples input, the module produces 200 samples output. It only produces output when it gets input.

The second case produces different output sizes on 200 samples input, depending what conversion is performed.

The third case is even worse, from the outside you can not even guess how much data 200 bytes in will generate (probably a lot more than 200 bytes, but...)

The last case is a module which becomes active by itself, and sometimes produces some data.

In aRts-0.3.4, only streams of the first type where handled, and most things worked nicely. So this is probably what you need most when writing modules that process audio. The problem with the other, more complex types of streaming is that they are hard to program, and that you don't need the features most of the time.

That is why I'll to this with two different stream types:

When you declare streams, you use the keyword "async" to indicate you want to make an asynchronous stream. So for instance assume you want to convert an asynchronous stream of bytes into a synchronous stream of samples, your interface could look like:
interface ByteStreamToAudio : SynthModule {
    async in byte stream indata;   // the asynchonous input sample stream

    out audio stream left,right;   // the synchronous output sample streams
};

back to index