// this function is called directly by the driver whenever data is ready // there is an anomaly in the (current version of the) Data Translation driver // that causes this function to be called unevenly spaced in time // this only happens under certain circumstances (i.e., number of channels, // SampleBlockSize, and sampling frequency) // see corresponding description in BCI2000 documentation __stdcall BufferDone( UINT uiMsg, unsigned int Dass, LPARAM lParam ) { ECODE status; int arrays; int i; short *buffer; HBUF hBuf; LPHBUF lphBuf; ULNG samples; HDASS lphDass; hBuf= NULL; lphBuf= NULL; lphDass= (void *)Dass; status= olDaGetBuffer(lphDass, &hBuf); if ( hBuf != NULL ) { status= olDmGetMaxSamples(hBuf,&samples); status= olDmGetBufferPtr( hBuf, (LPVOID FAR*)&lphBuf ); status= olDaPutBuffer(lphDass, hBuf); buffer= (short *)lphBuf; ((DTFUN *)(lParam))->data_critsec->Acquire(); ((DTFUN *)(lParam))->Add_to_data( buffer, samples ); // add data to FIFO ((DTFUN *)(lParam))->data_critsec->Release(); } // notify ADReadDataBlock() that data is here ((DTFUN *)(lParam))->bdone->SetEvent(); return(0); }
void COctopusAOTF::GenerateSignal( void ) { u16* ptr; u16 i = 0; olDmGetBufferPtr( hBuf_DAC, (LPVOID FAR*)&ptr ); for( i = 0; i < outbuffersize / 4; i++ ) { if ( i < 50 ) { //on *(ptr++) = ConvertVoltToDAC( volts_CH1 ); //CH_1 *(ptr++) = ConvertVoltToDAC( volts_CH2 ); //CH_2 *(ptr++) = ConvertVoltToDAC( 10.0 ); //blanking channel? *(ptr++) = ConvertVoltToDAC( 4.5 ); //camera start exposure } else { //off *(ptr++) = ConvertVoltToDAC( 0.0 ); //CH_1 *(ptr++) = ConvertVoltToDAC( 0.0 ); //CH_2 *(ptr++) = ConvertVoltToDAC( 10.0 ); //blanking channel? *(ptr++) = ConvertVoltToDAC( 0.0 ); //camera off } } }