Jump to content

Programming Reference:ChoiceCombination

From BCI2000 Wiki
Revision as of 15:19, 7 September 2023 by Mellinger (talk | contribs) (Created page with "==Function== The <tt>ChoiceCombination</tt> class contains filters that are applied alternatively, depending on a user choice. To use a <tt>ChoiceCombination</tt>, you need to derive a child class and define a constructor in which you add the desired filters, together with the corresponding user choice. In addition, you need to specify a parameter name that will be displayed in the BCI2000 GUI, and allows to select one of the choices. #include "ChoiceCombination.h" #i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Function

The ChoiceCombination class contains filters that are applied alternatively, depending on a user choice. To use a ChoiceCombination, you need to derive a child class and define a constructor in which you add the desired filters, together with the corresponding user choice. In addition, you need to specify a parameter name that will be displayed in the BCI2000 GUI, and allows to select one of the choices.

#include "ChoiceCombination.h"
#include "IdentityFilter.h"
#include "Filter1.h"
#include "Filter2.h"

struct MyChoice : ChoiceCombination
{
  MyChoice() : ChoiceCombination("MyParameterName")
  {
    AddChoice<IdentityFilter>(1);
    AddChoice<Filter1>(2);
    AddChoice<Filter2>(3);
  }
};

In the above example, we have used the IdentityFilter to give the user an "neutral" choice, i.e. not processing anything but transferring the input signal to the output unchanged.

Parameters

<UserDefinedParameterName>

An enumeration parameter whose value determines which of the filters is applied to the input.

States

None.

See also

Programming Reference:ParallelCombination, Programming Reference:LinearCombination, Programming Reference:IdentityFilter