Commit 437cbfd9 authored by Jonas Stienen's avatar Jonas Stienen Committed by Anne
Browse files

Revert "Tests with transmit [ok] and ring buffer playback [ok] - problem must...

Revert "Tests with transmit [ok] and ring buffer playback [ok] - problem must be with concurrent read/write on ring buffer in combination with network streaming"

This reverts commit 0d8e5df6.
parent 0d8e5df6
...@@ -32,7 +32,6 @@ using namespace std; ...@@ -32,7 +32,6 @@ using namespace std;
class CITANetAudioStreamingClient; class CITANetAudioStreamingClient;
class ITABufferedAudiofileWriter;
//! Network audio stream //! Network audio stream
/** /**
...@@ -97,8 +96,6 @@ private: ...@@ -97,8 +96,6 @@ private:
bool m_bRingBufferFull; //!< Indicator if ring buffer is full (and read cursor equals write cursor) bool m_bRingBufferFull; //!< Indicator if ring buffer is full (and read cursor equals write cursor)
ITASampleFrame m_sfRingBuffer; //!< Buffer incoming data ITASampleFrame m_sfRingBuffer; //!< Buffer incoming data
ITABufferedAudiofileWriter* m_pfNetStreamSampleWriter;
int m_iStreamingStatus; //!< Current streaming status int m_iStreamingStatus; //!< Current streaming status
friend class CITANetAudioStreamingClient; friend class CITANetAudioStreamingClient;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include <ITANetAudioStreamingClient.h> #include <ITANetAudioStreamingClient.h>
// ITA includes // ITA includes
#include <ITABufferedAudiofileWriter.h>
#include <ITAException.h> #include <ITAException.h>
// STL // STL
...@@ -27,27 +26,12 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int ...@@ -27,27 +26,12 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int
m_iStreamingStatus = STOPPED; m_iStreamingStatus = STOPPED;
outputFile.open( "program3data.txt" ); outputFile.open( "program3data.txt" );
ITAAudiofileProperties props;
props.dSampleRate = dSamplingRate;
props.eDomain = ITADomain::ITA_TIME_DOMAIN;
props.eQuantization = ITAQuantization::ITA_FLOAT;
props.iChannels = iChannels;
props.sComment = "NetAudio transmitted stream";
m_pfNetStreamSampleWriter = ITABufferedAudiofileWriter::create( "NetStreamTransmition.wav", props );
// nachher weg!
m_sfRingBuffer.zero();
ITASampleFrame sfLangShort( "lang_short.wav" );
m_sfRingBuffer.write( sfLangShort, iRingBufferCapacity );
m_bRingBufferFull = true;
} }
CITANetAudioStream::~CITANetAudioStream() CITANetAudioStream::~CITANetAudioStream()
{ {
delete m_pNetAudioStreamingClient; delete m_pNetAudioStreamingClient;
outputFile.close( ); outputFile.close( );
delete m_pfNetStreamSampleWriter;
} }
bool CITANetAudioStream::Connect( const std::string& sAddress, int iPort ) bool CITANetAudioStream::Connect( const std::string& sAddress, int iPort )
...@@ -95,13 +79,6 @@ const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const ...@@ -95,13 +79,6 @@ const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const
void CITANetAudioStream::IncrementBlockPointer() void CITANetAudioStream::IncrementBlockPointer()
{ {
if( !GetIsConnected() )
return;
m_iReadCursor = ( m_iReadCursor + m_sfOutputStreamBuffer.GetLength() ) % m_sfRingBuffer.GetLength();
m_iWriteCursor = ( m_iReadCursor + 2*m_sfOutputStreamBuffer.GetLength() ) % m_sfRingBuffer.GetLength();
return;
// Increment read cursor by one audio block and wrap around if exceeding ring buffer // Increment read cursor by one audio block and wrap around if exceeding ring buffer
if ( ( GetRingBufferSize() - GetRingBufferFreeSamples( )) >= int( GetBlocklength( ) ) ) if ( ( GetRingBufferSize() - GetRingBufferFreeSamples( )) >= int( GetBlocklength( ) ) )
{ {
...@@ -140,17 +117,17 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa ...@@ -140,17 +117,17 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa
// @todo: only partly write // @todo: only partly write
//std::cerr << "BUFFER_OVERRUN! Would partly write samples because ring buffer will be full then." << std::endl; //std::cerr << "BUFFER_OVERRUN! Would partly write samples because ring buffer will be full then." << std::endl;
//m_iWriteCursor = m_iReadCursor; m_iWriteCursor = m_iReadCursor;
m_bRingBufferFull = false; m_bRingBufferFull = false;
//outputFile << " incSomeWrite: "; //outputFile << " incSomeWrite: ";
} }
else else
{ {
// write samples into ring buffer // write samples into ring buffer
//m_sfRingBuffer.cyclic_write( sfNewSamples, iNumSamples, 0, iCurrentWriteCursor ); m_sfRingBuffer.cyclic_write( sfNewSamples, iNumSamples, 0, iCurrentWriteCursor );
// set write curser // set write curser
//m_iWriteCursor = ( m_iWriteCursor + iNumSamples ) % GetRingBufferSize( ); m_iWriteCursor = ( m_iWriteCursor + iNumSamples ) % GetRingBufferSize( );
m_bRingBufferFull = true; m_bRingBufferFull = true;
//outputFile << " IncWrite: "; //outputFile << " IncWrite: ";
} }
...@@ -158,9 +135,6 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa ...@@ -158,9 +135,6 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa
//outputFile << "\tWrite : " << m_iWriteCursor; //outputFile << "\tWrite : " << m_iWriteCursor;
//outputFile << "\tFreeSamples: " << GetRingBufferFreeSamples( ) << endl; //outputFile << "\tFreeSamples: " << GetRingBufferFreeSamples( ) << endl;
const ITASampleFrame* pNewSamples = &sfNewSamples;
m_pfNetStreamSampleWriter->write( pNewSamples );
return GetRingBufferFreeSamples(); return GetRingBufferFreeSamples();
} }
......
...@@ -17,13 +17,13 @@ static int g_iBufferSize = 256; ...@@ -17,13 +17,13 @@ static int g_iBufferSize = 256;
int main( int , char** ) int main( int , char** )
{ {
CITANetAudioStream oNetAudioStream( 1, g_dSampleRate, g_iBufferSize, 1000 * g_iBufferSize ); CITANetAudioStream oNetAudioStream( 2, g_dSampleRate, g_iBufferSize, 100 * g_iBufferSize );
ITAStreamProbe oProbe( &oNetAudioStream, "out_gutentag.wav" ); ITAStreamProbe oProbe( &oNetAudioStream, "out_gutentag.wav" );
ITAStreamMultiplier1N oMultiplier( &oProbe, 2 ); //ITAStreamMultiplier1N oMultiplier( &oProbe, 2 );
ITAPortaudioInterface ITAPA( g_dSampleRate, g_iBufferSize ); ITAPortaudioInterface ITAPA( g_dSampleRate, g_iBufferSize );
ITAPA.Initialize(); ITAPA.Initialize();
ITAPA.SetPlaybackDatasource( &oMultiplier ); ITAPA.SetPlaybackDatasource( &oProbe );
ITAPA.Open(); ITAPA.Open();
ITAPA.Start(); ITAPA.Start();
......
...@@ -16,7 +16,7 @@ static int g_iBlockLength = 256; ...@@ -16,7 +16,7 @@ static int g_iBlockLength = 256;
int main( int , char** ) int main( int , char** )
{ {
ITAStreamFunctionGenerator oGenerator( 2, g_dSampleRate, g_iBlockLength, ITAStreamFunctionGenerator::SINE, 456.78f, 0.81f, true ); ITAStreamFunctionGenerator oGenerator( 2, g_dSampleRate, g_iBlockLength, ITAStreamFunctionGenerator::SINE, 456.78f, 0.81f, true );
ITAFileDatasource oDatei("lang_short.wav", g_iBlockLength); ITAFileDatasource oDatei("01_Empfang_Guten_Tag.wav", g_iBlockLength);
CITANetAudioStreamingServer oStreamingServer; CITANetAudioStreamingServer oStreamingServer;
oStreamingServer.SetInputStream(&oDatei); oStreamingServer.SetInputStream(&oDatei);
......
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