How to merge the code of two boxes to have one box

Making & changing box plugins and external apps
Post Reply
johnkobe
Posts: 3
Joined: Wed Nov 02, 2016 4:05 pm

How to merge the code of two boxes to have one box

Post by johnkobe »

Dear community,

I am John. I am now doing research on BCI. For our research aim, we want to merge the code of two boxes into one box with two boxes' function. For example, I am now merging box Temporal Filter and Signal Decimation. If I understand the right things, when one box is processing, it gets the address pointer which points to the where the signal stream is saved. Then the signal stream is processed. So each time, the address is not changed while buffer pointed by the address pointer is changed. If it is this case, my method of merging two boxes is that let two box code work by sequence and do not let the first box encoder the head, buffer and end. However, in this case, there comes several errors.

I would like to ask is there an easy and universal way to merge two boxes code? Or do you have only the code of the processing part from each box rather than including all the interfaces and communications between boxes and variables?

Thanks so much if you could reply to me.

jtlindgren
Posts: 778
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: How to merge the code of two boxes to have one box

Post by jtlindgren »

Hello John,

in OpenViBE 2.0 based on Certivibe we will have a feature called a 'metabox' which allows bundling boxes into other boxes. However I don't know when we are able to publish that, possibly in the summer or next winter -- so it'll take a while in any case!

At the moment the easiest and best way in my opinion is to do the following (pseudocode),

Code: Select all

signalDecoder.decode(i);
if(signalDecoder.isBufferReceived()) {
   processedChunk=alg1(signalDecoder.getOutputMatrix());
   processedChunk2=alg2(processedChuck);
   // ...
   // finally stick your last processedChunk to the output encoder
}
i.e., as you suggest, just strip out all the glue and leave one piece of glue for the combined box. Of course you can have alg1 and alg2 etc as well-designed independent classes or functions as you like which might then also be re-used as independent boxes (with their own communication glue).


Happy hacking,
Jussi

Post Reply