int CCircuitry::ReplayWith(int nChan, CInterlink* pChain) { if ( ! pChain || ! pChain->IsConnected() ) return -1; if ( m_pPlayIoOver->Offset >= MAX_PLAYLST ) return -1; if ( ! HasOverlappedIoCompleted(m_pPlayIoOver) ) return -1; CBuffer* pInput = pChain->m_pInput; if ( pInput->m_nLength > MASK_BUFFER ) pInput->Remove( pInput->m_nLength - MASK_BUFFER ); if ( pInput->m_nLength < TEMP_BUFFER ) return -1; Neighbour.m_pWakeup.SetEvent(); m_pPlayIoOver->Internal = STATUS_PENDING; //TRACE("%i->buffer in[%i], [%i]\n", GetTickCount(), pInput->m_nBuffer,pInput->m_nLength); m_nPlyCookie %= MAX_PLAYLST; BYTE* pBuffer = m_pBufferIn[0] + ( m_nPlyCookie++ * TEMP_BUFFER ); CopyMemory( pBuffer, pInput->m_pBuffer, TEMP_BUFFER ); pInput->Remove( TEMP_BUFFER ); if ( int nResult = SsmPlayMemBlock(nChan, 6, pBuffer, TEMP_BUFFER, OnPlayMemBlockDone, m_pPlayIoOver) ) { #ifdef _DEBUG CHAR sError[1024]; SsmGetLastErrMsg( sError ); theApp.Message( MSG_ERROR, sError ); #endif m_pPlayIoOver->Internal = 0; return nResult; } m_pPlayIoOver->Offset++; m_pPlayIoOver->Internal = 0; ResetEvent( m_pPlayIoOver->hEvent ); //TRACE("%i-> ReplayWith in [%i]\n", GetTickCount(), m_pPlayIoOver->Offset); return 0; }