Subject: Re: [boost] Flow-based programming library for Boost?
From: Marcus Tomlinson (themarcustomlinson_at_[hidden])
Date: 2013-01-04 06:56:05
On Fri, Jan 4, 2013 at 1:24 PM, Vicente J. Botet Escriba <
> Le 04/01/13 11:36, Marcus Tomlinson a écrit :
> On 04 Jan 2013, at 11:46 AM, "Vicente J. Botet Escriba" <
>> vicente.botet_at_[hidden]> wrote:
>> Le 04/01/13 08:51, Marcus Tomlinson a écrit :
>>>> * You use a bus of input/output untyped signals. Why the signals are not
>>>>> 1. Flexibility - inputs and outputs can dynamically accept changing
>>>> signal types. E.g. Varying sample size in an audio stream.
>>> I don't know why this couldn't be modeled with a vector signal
>>> containing the samples. Maybe you have other examples needing untyped
>> Sorry, audio jargon. Sample size - the size of each sample. So changing a
>> vector<char> to a vector<int> for example. The sample type needs to change
>> hence the vector variable needs to change.
> Could you show a simple example that makes use of this kind of changes?
> BTW, what happens when you connect a char and you try to get/set an int or
> a complex? Do you get an exception?
Here's an example of the above vector<char> to a vector<int> situation
(this component sets the gain of the audio signal passing through it):
virtual void Process_( DspSignalBus& inputs, DspSignalBus& outputs )
// Audio input of char samples
std::vector< char > _charStream;
if( inputs.GetValue( 0, _charStream ) )
for( unsigned long i = 0; i < _charStream.size(); i++ )
_charStream[i] *= _gain;
outputs.SetValue( 0, _charStream );
// Audio input of int samples
std::vector< int > _intStream;
else if( inputs.GetValue( 0, _intStream ) )
for( unsigned long i = 0; i < _intStream.size(); i++ )
_intStream[i] *= _gain;
outputs.SetValue( 0, _intStream );
The GetValue() and SetValue() methods simply return false if the type
you're trying to get/set is mismatched. We use this in order to determine
what data we have received.
> It seems that more tutorials/examples are needed.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk