Mercurial > hg > beaglert
diff projects/basic_network/render.cpp @ 222:6a23c07d0fbb mergingClockSync
Working with UdpIoPlugin
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sun, 14 Feb 2016 01:09:23 +0000 |
parents | dbff109f64c2 |
children | ac8eb07afcf5 |
line wrap: on
line diff
--- a/projects/basic_network/render.cpp Sat Feb 13 16:56:29 2016 +0000 +++ b/projects/basic_network/render.cpp Sun Feb 14 01:09:23 2016 +0000 @@ -9,6 +9,7 @@ //#include <rtdk.h> #include <cmath> #include <NetworkSend.h> +#include <ReceiveAudioThread.h> #include <Utilities.h> // setup() is called once before the audio rendering starts. @@ -21,6 +22,7 @@ // Return true on success; returning false halts the program. NetworkSend networkSend; +ReceiveAudioThread receive; float gFrequency; float gInverseSampleRate; float gPhase; @@ -29,9 +31,11 @@ // Retrieve a parameter passed in from the initAudio() call gFrequency = *(float *)userData; - networkSend.setup(context->audioSampleRate, context->audioFrames, 3, 9999, "192.168.7.1"); + networkSend.setup(context->audioSampleRate, context->audioFrames, 0, 9999, "192.168.7.1"); + receive.init(10000, context->audioFrames, 0); + receive.startThread(); gInverseSampleRate = 1.0 / context->audioSampleRate; - gPhase = 0.2132; + gPhase = 0; return true; } @@ -48,10 +52,12 @@ if(gPhase > 2.0 * M_PI) gPhase -= 2.0 * M_PI; + networkSend.log(out); + float in; + int ret = receive.getSamplesSrc(&in, 1, 1); for(unsigned int channel = 0; channel < context->audioChannels; channel++){ - context->audioOut[n * context->audioChannels + channel] = out; + audioWriteFrame(context, n, channel, in); } - networkSend.log(out); } }