Commit d396a444 authored by Anne's avatar Anne

bugfixes

parent e52b29d6
......@@ -24,6 +24,7 @@
#include <ITANetAudioProtocol.h>
#include <ITASampleFrame.h>
#include <ITAStreamProbe.h>
#include <VistaInterProcComm/Concurrency/VistaThreadEvent.h>
#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>
......@@ -61,6 +62,7 @@ protected:
private:
CITANetAudioClient* m_pClient;
CITANetAudioStream* m_pStream;
ITAStreamProbe* m_pStreamProbe;
CITANetAudioProtocol* m_pProtocol;
CITANetAudioMessage* m_pMessage;
......
......@@ -12,6 +12,8 @@ CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pP
, m_pConnection( NULL )
, m_bStopIndicated( false )
{
m_pStreamProbe = new ITAStreamProbe( pParent, "output.wav" );
m_pClient = new CITANetAudioClient();
m_oParams.iChannels = pParent->GetNumberOfChannels();
......@@ -100,8 +102,12 @@ bool CITANetAudioStreamingClient::LoopBody()
// Receive samples from net message and forward them to the stream ring buffer
m_pMessage->ReadSampleFrame( &m_sfReceivingBuffer );
if (m_pStream->GetRingbufferFreeSamples() >= m_sfReceivingBuffer.GetLength())
m_pStream->Transmit(m_sfReceivingBuffer, m_sfReceivingBuffer.GetLength());
if ( m_pStream->GetRingbufferFreeSamples( ) >= m_sfReceivingBuffer.GetLength( ) )
{
m_pStream->Transmit( m_sfReceivingBuffer, m_sfReceivingBuffer.GetLength( ) );
}
//else
// Fehler
......
......@@ -144,6 +144,8 @@ bool CITANetAudioStreamingServer::LoopBody()
m_pInputStream->IncrementBlockPointer();
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_SEND_SAMPLES );
m_pMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
m_pMessage->WriteAnswer();
m_pInputStream->IncrementBlockPointer();
}
else
{
......@@ -153,9 +155,7 @@ bool CITANetAudioStreamingServer::LoopBody()
break;
}
m_pMessage->WriteAnswer();
m_pInputStream->IncrementBlockPointer();
float fTimeOut = m_pInputStream->GetBlocklength() / m_pInputStream->GetSampleRate();
//VistaTimeUtils::Sleep( (int) ( 1 * 100 ) );
break;
......
......@@ -5,6 +5,8 @@
#include <ITAPortaudioInterface.h>
#include <ITAStreamMultiplier1N.h>
#include <ITAException.h>
#include <ITAFileDatasource.h>
#include <ITAStreamProbe.h>
using namespace std;
......@@ -15,12 +17,13 @@ static int g_iBufferSize = 256;
int main( int , char** )
{
CITANetAudioStream oNetAudioStream( 2, g_dSampleRate, g_iBufferSize, 100 * g_iBufferSize );
//ITAStreamMultiplier1N oMultiplier( &oNetAudioStream, 2 );
CITANetAudioStream oNetAudioStream( 1, g_dSampleRate, g_iBufferSize, 100 * g_iBufferSize );
ITAStreamProbe oProbe( &oNetAudioStream, "output.wav" );
ITAStreamMultiplier1N oMultiplier( &oProbe, 2 );
ITAPortaudioInterface ITAPA( g_dSampleRate, g_iBufferSize );
ITAPA.Initialize();
ITAPA.SetPlaybackDatasource(&oNetAudioStream);
ITAPA.SetPlaybackDatasource( &oMultiplier );
ITAPA.Open();
ITAPA.Start();
......@@ -55,6 +58,8 @@ int main( int , char** )
ITAPA.Stop();
ITAPA.Close();
ITAPA.Finalize();
return 0;
}
......@@ -16,7 +16,7 @@ static int g_iBlockLength = 256;
int main( int , char** )
{
ITAStreamFunctionGenerator oGenerator( 1, g_dSampleRate, g_iBlockLength, ITAStreamFunctionGenerator::SINE, 456.78f, 0.81f, true );
ITAFileDatasource oDatei("Gershwin.wav", g_iBlockLength);
ITAFileDatasource oDatei("Gershwin-mono.wav", g_iBlockLength);
CITANetAudioStreamingServer oStreamingServer;
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