OpenViBE Documentation 3.3.0
Stream Switch

Summary

  • Plugin name : Stream Switch
  • Version : 1.1
  • Author : Laurent Bonnet
  • Company : INRIA
  • Short description : Redirect its input on a particular output
  • Documentation template generation date : Apr 20 2022

Description

This box act as a switch between N possible outputs for its Streamed Matrix input. N Stimulation settings trigger the switch.

The Stream Switch box redirects a Streamed Matrix input to one particular output according to stimulation received. Each output is triggered by a specific stimulation, detailed in the box settings.

Warning: The Stream Switch box operates at chunk granularity. This means that the timing accuracy of this box depends on the chunk size you use (sample count per sent block, also changed by epoching). When the box receives a stimulation that is recognized as a switch trigger, the box will redirect the future chunks that start later than the stimulation timestamp to the desired output. The box will never switch the output stream in the middle of a chunk. For example, if your sampling rate is 512 and your chunk size is 32, then the first sample redirected can be one which is at most 32/512 = 0.0625s = 62.5ms later than the time requested by the stimulation timestamp. With low sampling rates and high chunk sizes, this delay before the box changes the stream output can be even seconds. Hence, we do not recommend using stream switch with its current implementation for use-cases where the first sample needs to be strictly immediately after or at the stimulation timestamp. For such usage, consider using the Stimulation Based Epoching box.

Note 1: if the same stimulation is used by 2 or more outputs, only the first output will be activated when receiving the stimulation.
Note 2: at startup, none of the outputs is activated, unless 'Default to output 1' has been set to true in the box configuration.

Inputs

1. Triggers

Stimulations to switch from one output to another.

  • Type identifier : Stimulations (0x6f752dd0, 0x082a321e)

2. Matrix

The stream to redirect. It can be any Streamed Matrix subtype.

  • Type identifier : Streamed matrix (0x544a003e, 0x6dcba5f6)

Outputs

The box can have 2 or more outputs, all have the same type as the input stream.

1. Output

The first possible output.

  • Type identifier : Streamed matrix (0x544a003e, 0x6dcba5f6)

2. Output(1)

The second possible output.

  • Type identifier : Streamed matrix (0x544a003e, 0x6dcba5f6)

Settings

The box has a stimulation setting for each of its outputs. Each such setting dictates the stimulation that activates the corresponding output.

1. Default to output 1

If this flag is set to true, the box will output to the first channel by default without requiring a stimulus first.

  • Type identifier : Boolean (0x2cdb2f0b, 0x12f231ea)
  • Default value : [ false ]

2. Switch stim for output 1

The first possible switch trigger.

  • Type identifier : Stimulation (0x2c132d6e, 0x44ab0d97)
  • Default value : [ OVTK_StimulationId_Label_00 ]

3. Switch stim for output 2

The second possible switch trigger.

  • Type identifier : Stimulation (0x2c132d6e, 0x44ab0d97)
  • Default value : [ OVTK_StimulationId_Label_01 ]

Examples

The scenario stream-switch.xml in share/openvibe/scenarios/box-tutorials is a simple, commented example.

The Stream Switch can be used in more complex situations as well, for example in an online classifier comparison scenario. The scenario motor-imagery-5-classifier-comparison.xml in share/openvibe/scenarios/bci-examples/motor-imagery is a commented example of such a situation.

Miscellaneous