Example #1
0
// 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);
}
Example #2
0
ECODE DTFUN::SetBuffers( DWORD BufSize )
{
    int i;
    ECODE retval= 0;

    status= olDaSetWrapMode( lphDass, OL_WRP_MULTIPLE  );

    dwSize= BufSize;

    for(i=0; i<BUFNUM; i++)
    {
        retval+= olDmAllocBuffer( 0, dwSize, &hbuf[i] );
        retval+= olDaPutBuffer( lphDass, hbuf[i] );
    }

    retval+= olDaConfig( lphDass );

    d_count= 0;   // initialize data counter
    BufferCount= 0;
    BufferPtr= 0;

    return( status );
}
Example #3
0
void COctopusAOTF::Start( void ) 
{ 
	olDaSetClockFrequency( hdass_9834, 0.25 * freq * outbuffersize );

	olDmAllocBuffer( 0, outbuffersize, &hBuf_DAC );

	if( hBuf_DAC == NULL ) 
	{
		AfxMessageBox(_T("Error Allocating buffer."));
		return;
	}
	
	GenerateSignal();
	
	olDaPutBuffer( hdass_9834, hBuf_DAC );	
	
	olDaConfig( hdass_9834 );
	
	olDaStart( hdass_9834 );

	B.AOTF_running = true;

	m_status_AOTF.SetBitmap( m_bmp_yes );
}