Commit bba2ed6a authored by Anne's avatar Anne
Browse files

Comment + Writepointer bugfix

parent d9f6f640
...@@ -130,11 +130,10 @@ const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const ...@@ -130,11 +130,10 @@ const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const
// @todo: is connected? // @todo: is connected?
int iCurrentWritePointer = m_iWriteCursor; int iCurrentWritePointer = m_iWriteCursor;
if (iCurrentWritePointer > m_iReadCursor) { if (iCurrentWritePointer > m_iReadCursor) {
// kein lesen ber das Bufferende hinaus
m_sfOutputStreamBuffer[uiChannel].cyclic_write(&m_sfRingBuffer[uiChannel], m_sfOutputStreamBuffer[uiChannel].cyclic_write(&m_sfRingBuffer[uiChannel],
m_sfOutputStreamBuffer.GetLength(), m_iReadCursor, iCurrentWritePointer); m_sfOutputStreamBuffer.GetLength(), m_iReadCursor, iCurrentWritePointer);
} else { } else {
// in diesem Block alle Kanle auf 0 setzen // in diesem Block alle Kanaele auf 0 setzen
m_sfOutputStreamBuffer[uiChannel].Zero(); m_sfOutputStreamBuffer[uiChannel].Zero();
} }
...@@ -155,7 +154,10 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa ...@@ -155,7 +154,10 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa
m_sfRingBuffer.cyclic_write(sfNewSamples, iNumSamples, m_sfRingBuffer.cyclic_write(sfNewSamples, iNumSamples,
iCurrentReadCursor, m_iWriteCursor); iCurrentReadCursor, m_iWriteCursor);
// Gibt freien Platz im RingBuffer zurck // Schreibpointer weiter setzen
m_iWriteCursor = ( m_iWriteCursor + iNumSamples ) % m_sfRingBuffer.GetLength();
// Gibt freien Platz im RingBuffer zurueck
if (iCurrentReadCursor > m_iWriteCursor) { if (iCurrentReadCursor > m_iWriteCursor) {
return m_iWriteCursor - iCurrentReadCursor; return m_iWriteCursor - iCurrentReadCursor;
} }
...@@ -165,7 +167,7 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa ...@@ -165,7 +167,7 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa
// Threadsave programmieren // Threadsave programmieren
m_iWriteCursor+=iNumSamples;
} }
int CITANetAudioStream::GetRingBufferSize() const 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