Commit 7ee2ae14 authored by Anne Heimes's avatar Anne Heimes

bugfixes deiconnect not running

parent 01cb7c2a
......@@ -27,7 +27,7 @@ CITANetAudioMessage::CITANetAudioMessage( VistaSerializingToolset::ByteOrderSwap
void CITANetAudioMessage::ResetMessage()
{
if( m_oIncoming.GetTailSize() > 0 )
//vstr::err() << "CITANetAudioMessage::ResetMessage() called before message was fully processed!" << std::endl;
vstr::err() << "CITANetAudioMessage::ResetMessage() called before message was fully processed!" << std::endl;
// wait till sending is complete -> this prevents us
// from deleting the buffer while it is still being read
......@@ -115,14 +115,13 @@ bool CITANetAudioMessage::ReadMessage( int timeout)
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "CITANetAudioMessage [ Reading ] Waiting for incoming data" << std::endl;
#endif
double dTimeBefore = ITAClock::getDefaultClock( )->getTime( );
// WaitForIncomming Data int in ca ms
long nIncomingBytes = m_pConnection->WaitForIncomingData( timeout );
double dTimeAfter = ITAClock::getDefaultClock( )->getTime( );
double DTimeDiff = dTimeAfter - dTimeBefore;
// TODO Timer entfernen
if ( nIncomingBytes == -1)
if (nIncomingBytes == -1)
return false;
else
int a = 5;
if (timeout != 0)
nIncomingBytes = m_pConnection->WaitForIncomingData( 0 );
......@@ -136,8 +135,8 @@ bool CITANetAudioMessage::ReadMessage( int timeout)
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "CITANetAudioMessage [ Reading ] Expecting " << nMessagePayloadSize << " bytes message payload" << std::endl;
#endif
if (nMessagePayloadSize <= 2 * sizeof(VistaType::sint32))
int i = 34;
if (nMessagePayloadSize <= 0)
return false;
// we need at least the two protocol ints
//assert( nMessagePayloadSize >= 2 * sizeof( VistaType::sint32 ) );
......
......@@ -68,13 +68,14 @@ CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pP
CITANetAudioStreamingClient::~CITANetAudioStreamingClient()
{
//try{
if (m_pConnection->GetIsOpen())
if (m_pConnection->GetIsConnected())
{
m_pMessage->ResetMessage();
m_pMessage->SetConnection(m_pConnection);
m_pMessage->SetMessageType(CITANetAudioProtocol::NP_CLIENT_CLOSE);
m_pMessage->WriteBool(true);
m_pMessage->WriteMessage();
m_pClient->Disconnect();
//m_pClient->Disconnect();
}
delete m_pClientLogger;
//}
......@@ -154,8 +155,9 @@ bool CITANetAudioStreamingClient::LoopBody()
vstr::out( ) << "[ITANetAudioStreamingServer] Unkown protocol type : " << iMsgType << std::endl;
break;
}
oLog.iChannel = m_pStream->GetNumberOfChannels( );
oLog.iChannel = m_pStream->GetNumberOfChannels();
oLog.iProtocolStatus = iMsgType;
oLog.iFreeSamples = m_pStream->GetRingBufferFreeSamples();
oLog.dWorldTimeStamp = ITAClock::getDefaultClock( )->getTime( );
m_pClientLogger->log( oLog );
}
......
......@@ -32,7 +32,7 @@ int main(int argc, char* argv[])
cout << "Channel " << iChannels << endl;
CITANetAudioStream oNetAudioStream(iChannels, dSampleRate, iBlockLength, 1 * iBufferSize);
/*
ITAStreamPatchbay oPatchbay(dSampleRate, iBlockLength);
oPatchbay.AddInput( &oNetAudioStream );
int iOutputID = oPatchbay.AddOutput( 2 );
......@@ -40,8 +40,8 @@ int main(int argc, char* argv[])
int N = int( oNetAudioStream.GetNumberOfChannels( ) );
for ( int i = 0; i < N; i++ )
oPatchbay.ConnectChannels( 0, i, 0, i % 2, 1 / double( N ) );
ITAStreamProbe oProbe( oPatchbay.GetOutputDatasource( iOutputID ), "ITANetAudioTest.stream.wav" );
*/
//ITAStreamProbe oProbe( oPatchbay.GetOutputDatasource( iOutputID ), "ITANetAudioTest.stream.wav" );
ITAsioInitializeLibrary();
......@@ -90,7 +90,7 @@ int main(int argc, char* argv[])
}
ITAsioSetPlaybackDatasource(&oProbe);
ITAsioSetPlaybackDatasource( &oNetAudioStream );
if (ITAsioStart() != ASE_OK) {
ITAsioFinalizeLibrary();
......@@ -133,7 +133,6 @@ int main(int argc, char* argv[])
return 255;
}
ITAsioFinalizeLibrary();
return 0;
......
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