void BCI2000OutputFormat::Initialize( const SignalProperties& inProperties, const StateVector& inStatevector ) { mInputProperties = inProperties; mStatevectorLength = inStatevector.Length(); }
void BCI2000OutputFormat::Write( ostream& os, const GenericSignal& inSignal, const StateVector& inStatevector ) { switch( mInputProperties.Type() ) { case SignalType::int16: case SignalType::float32: case SignalType::int32: // Note that the order of Elements and Channels differs from the one in the // socket protocol. for( int j = 0; j < inSignal.Elements(); ++j ) { for( int i = 0; i < inSignal.Channels(); ++i ) inSignal.WriteValueBinary( os, i, j ); os.write( reinterpret_cast<const char*>( inStatevector( min( j, inStatevector.Samples() - 1 ) ).Data() ), inStatevector.Length() ); } break; default: bcierr << "Unsupported signal data type" << endl; } }