Commit d9f6f640 authored by Anne's avatar Anne
Browse files

implemented reading and writing from Client Buffer

parent 8d113869
......@@ -49,6 +49,7 @@ public:
int iMessageType = NET_MESSAGE_OPEN;
m_pConnection->Send( &iMessageType, sizeof( int ) );
//Vistabytebuffer
int iNumChannels = ( int ) m_pParent->GetNumberOfChannels();
m_pConnection->Send( &iNumChannels, sizeof( int ) );
double dSampleRate = m_pParent->GetSampleRate();
......@@ -126,7 +127,16 @@ CITANetAudioStream::~CITANetAudioStream()
const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const ITAStreamInfo* )
{
// @todo: implement cyclic read from ring buffer
// @todo: is connected?
int iCurrentWritePointer = m_iWriteCursor;
if (iCurrentWritePointer > m_iReadCursor) {
// kein lesen ber das Bufferende hinaus
m_sfOutputStreamBuffer[uiChannel].cyclic_write(&m_sfRingBuffer[uiChannel],
m_sfOutputStreamBuffer.GetLength(), m_iReadCursor, iCurrentWritePointer);
} else {
// in diesem Block alle Kanle auf 0 setzen
m_sfOutputStreamBuffer[uiChannel].Zero();
}
return m_sfOutputStreamBuffer[ uiChannel ].GetData();
}
......@@ -139,7 +149,23 @@ void CITANetAudioStream::IncrementBlockPointer()
int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSamples )
{
ITA_EXCEPT0( NOT_IMPLEMENTED );
int iCurrentReadCursor = m_iReadCursor;
//kopiert Samples in den RingBuffer
m_sfRingBuffer.cyclic_write(sfNewSamples, iNumSamples,
iCurrentReadCursor, m_iWriteCursor);
// Gibt freien Platz im RingBuffer zurck
if (iCurrentReadCursor > m_iWriteCursor) {
return m_iWriteCursor - iCurrentReadCursor;
}
else {
return m_sfRingBuffer.GetLength() - m_iWriteCursor + iCurrentReadCursor;
}
// Threadsave programmieren
m_iWriteCursor+=iNumSamples;
}
int CITANetAudioStream::GetRingBufferSize() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment