Trying to prepare sample transmission on server side

parent e065dae2
......@@ -103,11 +103,12 @@ bool CITANetAudioStreamingClient::LoopBody()
case CITANetAudioProtocol::NP_SERVER_SEND_SAMPLES:
// Receive samples and forward them to the stream ring buffer
/*
int iNumSamples = m_pMessage->ReadSampleFrame( &m_sfReceivingBuffer );
if( m_pStream->GetRingbufferFreeSamples() >= iNumSamples )
m_pStream->Transmit( m_sfReceivingBuffer, iNumSamples );
*/
int iFreeSamples = m_pMessage->ReadInt();
//int iNumSamples = m_pMessage->ReadSampleFrame( &m_sfReceivingBuffer );
//if( m_pStream->GetRingbufferFreeSamples() >= iNumSamples )
// m_pStream->Transmit( m_sfReceivingBuffer, iNumSamples );
break;
}
......
......@@ -114,17 +114,27 @@ bool CITANetAudioStreamingServer::LoopBody()
switch( m_pMessage->GetMessageType() )
{
case CITANetAudioProtocol::NP_CLIENT_WAITING_FOR_SAMPLES:
for( int i = 0; i < m_pInputStream->GetNumberOfChannels(); i++ )
{
int iFreeSamples = m_pMessage->ReadInt();
if( iFreeSamples >= m_pInputStream->GetBlocklength() )
{
for( int i = 0; i < m_pInputStream->GetNumberOfChannels(); i++ )
{
ITAStreamInfo oStreamInfo;
const float* pfData = m_pInputStream->GetBlockPointer( i, &oStreamInfo );
m_sfTempTransmitBuffer[ i ].write( pfData, m_pInputStream->GetBlocklength() );
}
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_SEND_SAMPLES );
//m_pMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
}
else
{
ITAStreamInfo oStreamInfo;
const float* pfData = m_pInputStream->GetBlockPointer( i, &oStreamInfo );
m_sfTempTransmitBuffer[ i ].write( pfData, m_pInputStream->GetBlocklength() );
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_WAITING_FOR_TRIGGER );
}
//m_pMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
m_pMessage->WriteAnswer();
break;
}
case CITANetAudioProtocol::NP_CLIENT_CLOSE:
m_pMessage->WriteAnswer();
m_pConnection = NULL;
......
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