Programming Reference:FeedbackDemo Application

From BCI2000 Wiki
Jump to: navigation, search




The FeedbackDemo application module is a simple cursor feedback application that demonstrates how to write a BCI2000 application module using the Qt GUI library.

It may serve as a starting point to create your own feedback application in BCI2000.


The FeedbackDemo application's task filter class is FeedbackDemoTask, and inherits from the FeedbackTask base class. Thus, it needs not deal with trial sequencing, target sequences, and similar issues; rather, it provides a window, populates it with the elements of a feedback screen such as a cursor, and a target, and implements a number of hooks, or event handlers.

Feedback Window

The FeedbackDemo application uses a Qt QWidget object as its output window, which contains a QGraphicsScene. In the QGraphicsScene, it maintains a QGraphicsSimpleTextItem object to display output messages, and two QGraphicsEllipseItem objects, one for cursor and target each.


Most parameters required for a feedback application are already provided by the FeedbackTask base class. Two parameters are added by the FeedbackDemo application:


This is a RGB color value defining the cursor's color.


The cursor's width in percent of total screen width.


The FeedbackDemo application provides an example for a translation table, giving translations for application screen messages, and shows how to wrap string literals in a LocalizableString call in order to look them up in the translation table.

Cursor Speed

A feedback application's input signal consists of a normalized, zero-mean signal from the signal processing module. The FeedbackDemo demonstrates how to use these properties to determine an appropriate signal scaling (cursor speed) in the FeedbackDemoTask::OnInitialize() event handler.


In the FeedbackDemoTask::DoFeedback() event handler, the FeedbackDemo shows

  • how to use the control signal to update cursor position,
  • how to end the trial when the cursor hits the right margin,
  • how to set the ResultCode state.

Trial Statistics

The FeedbackDemo uses a TrialStatistics object to store information about trial outcomes, and demonstrates how to update this information in FeedbackDemoTask::OnFeedbackEnd(), and how to obtain run statistics in FeedbackDemoTask::OnStopRun().

Application Log

The demo uses the AppLog object provided by the ApplicationBase class in order to write to a file and a screen log.

See also

Programming Reference:FeedbackTask Class, Programming Reference:ApplicationBase Class, Programming Reference:Localization, Programming Reference:TrialStatistics Class