adding comments and todos, removing outcommented lines

also changes in protocol id (!)
Some fixes after closing connection
parent 5e71a29e
......@@ -28,6 +28,7 @@ class VistaConnectionIP;
//! A network audio client that connects to a network audio server
/**
* Use CITANetAudioStreamingClient to start an audio stream with the connection of this client.
* This class is basically a helper around Vista TCP/IP network functionality.
*
*/
class CITANetAudioClient
......
......@@ -54,7 +54,7 @@ public:
static const int NP_CLIENT_OPEN = 100;
static const int NP_CLIENT_CLOSE = 101;
static const int NP_CLIENT_WAITING_FOR_SAMPLES = 102;
static const int NP_CLIENT_WAITING_FOR_SAMPLES = 111;
static const int NP_SERVER_CLOSE = 200;
static const int NP_SERVER_OPEN = 201;
......
......@@ -37,6 +37,8 @@ class VistaTCPSocket;
/**
* Can be connected to an ITADataSource as a streaming source
* or to a user-implemented sample producer, i.e. an audio sythesizer.
*
* @todo: move to src folder
*/
class ITA_DATA_SOURCES_API CITANetAudioServer
{
......
......@@ -40,7 +40,9 @@ class CITANetAudioStream;
//! Network audio streaming client
/**
* Audio streaming for a signal source that is connected via TCP/IP.
* Implements the ITA network protocol for audio streaming in client side.
* Implements the ITA network protocol for audio streaming on client side.
*
* @todo: move to src folder
*
* \note not thread-safe
*/
......
......@@ -31,7 +31,6 @@ CITANetAudioStreamingClient::~CITANetAudioStreamingClient()
m_pMessage->SetConnection( m_pConnection );
m_pMessage->SetMessageType( CITANetAudioProtocol::NP_CLIENT_CLOSE );
m_pMessage->WriteMessage();
m_pMessage->ReadAnswer();
m_pClient->Disconnect();
}
}
......@@ -99,7 +98,6 @@ bool CITANetAudioStreamingClient::LoopBody()
case CITANetAudioProtocol::NP_SERVER_WAITING_FOR_TRIGGER:
// Wait until block increment is triggered by audio context (more free samples in ring buffer)
//std::cout << "Will wait for block increment" << std::endl;
m_oBlockIncrementEvent.WaitForEvent( true );
break;
......@@ -107,7 +105,6 @@ bool CITANetAudioStreamingClient::LoopBody()
// Receive samples from net message and forward them to the stream ring buffer
m_pMessage->ReadSampleFrame( &m_sfReceivingBuffer );
//std::cout << "Receiving " << m_sfReceivingBuffer.GetLength() << " samples from streaming server" << std::endl;
if ( m_pStream->GetRingBufferFreeSamples( ) >= m_sfReceivingBuffer.GetLength( ) )
m_pStream->Transmit( m_sfReceivingBuffer, m_sfReceivingBuffer.GetLength( ) );
//else
......
......@@ -144,26 +144,20 @@ bool CITANetAudioStreamingServer::LoopBody()
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_SEND_SAMPLES );
m_pMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
m_pMessage->WriteAnswer();
//std::cout << "Transmitted " << m_pInputStream->GetBlocklength() << " samples, because there where " << iFreeSamples << " free samples on client side" << std::endl;
}
else
{
//std::cout << "Could not transmitt, because there where only " << iFreeSamples << " free samples on client side" << std::endl;
// Waiting for Trigger
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_WAITING_FOR_TRIGGER );
m_pMessage->WriteAnswer();
break;
}
float fTimeOut = m_pInputStream->GetBlocklength() / m_pInputStream->GetSampleRate();
//VistaTimeUtils::Sleep( (int) ( 1 * 100 ) );
break;
}
case CITANetAudioProtocol::NP_CLIENT_CLOSE:
{
m_pMessage->WriteAnswer();
m_pConnection = NULL;
StopGently( true );
Stop();
......
......@@ -45,7 +45,7 @@ int main( int , char** )
cout << "Connected." << endl;
// Playback
float fSeconds = 10.0f;
float fSeconds = 100.0f;
cout << "Playback started, waiting " << fSeconds << " seconds" << endl;
ITAPA.Sleep( fSeconds ); // blocking
cout << "Done." << endl;
......
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