DataBuffer:
Filter:
OpenBCI-SuperCollider/Classes (extension) | External Control

DataBuffer
ExtensionExtension

buffer data and accelerometer values

Description

Collects data from any OpenBCI board into buffers.

Class Methods

.new

create a new instance

Arguments:

board

an instance of a OpenBCI subclass (for example a CytonSerial or GanglionWifi).

maxSize

the number of slots in both data and accelerometer buffers. If the data is not read fast enough, the buffers will fill up to this size and then start dropping values (fifo).

dataActive

a Boolean flag indicating if data should be buffered or not.

accelActive

a Boolean flag indicating if accelerometer data should be buffered or not.

Instance Methods

.board

get the board instance

.start

start buffering

.stop

stop buffering

.readData

read the data buffer and clear it. This should be called at regular intervals. Faster than the buffer is filling up (depends on sample rate).

Returns:

a List of arrays with n-channels data values.

.readAccel

read the accelerometer buffer and clear it. This should be called at regular intervals. Faster than the buffer is filling up (depends on sample rate).

Returns:

a List of arrays with xyz values.

.dataActive

a Boolean flag indicating if data should be buffered or not.

.accelActive

a Boolean flag indicating if accelerometer data should be buffered or not.

.dataFull

a Boolean flag indicating if the data buffer filled up to its maximum.

.accelFull

a Boolean flag indicating if the accel buffer filled up to its maximum.

.size

get or set the maxSize.

.dataBuffer

current data buffer. Read without clearing.

.accelBuffer

current accel buffer. Read without clearing.

.clear

clear buffers and flags

Examples