comparison projects/basic_network/render.cpp @ 25:98aed580452a bbb_network

- Network now actually works.
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 08 May 2015 17:48:58 +0100
parents ad5cd8dd99b3
children 4255ecbb9bec 3c3a1357657d
comparison
equal deleted inserted replaced
24:ad5cd8dd99b3 25:98aed580452a
17 int gCount=0; 17 int gCount=0;
18 networkData networkObject; 18 networkData networkObject;
19 AuxiliaryTask transmitReceiveDataTask; 19 AuxiliaryTask transmitReceiveDataTask;
20 20
21 void transmitReceiveData(){ 21 void transmitReceiveData(){
22 printf("transmitAndReceiveData\n"); 22 printf("transmitReceiveData auxiliary task has started\n");
23 while(!gShouldStop){ 23 while(!gShouldStop){
24 //sendMessage(networkObject); 24 sendMessage(networkObject);
25 //receiveMessage(networkObject); 25 receiveMessage(networkObject);
26 usleep(10000); 26 usleep(1000);
27 } 27 }
28 closeSockets(); 28 closeSockets();
29 } 29 }
30 30
31 // initialise_render() is called once before the audio rendering starts. 31 // initialise_render() is called once before the audio rendering starts.
51 networkObject.counter=&gCount; 51 networkObject.counter=&gCount;
52 networkObject.variables[0]=&gFrequency; 52 networkObject.variables[0]=&gFrequency;
53 networkObject.variables[1]=&gPhase; 53 networkObject.variables[1]=&gPhase;
54 networkObject.numVariables=2; 54 networkObject.numVariables=2;
55 setupSockets(settings->receivePort, settings->transmitPort, settings->serverName); 55 setupSockets(settings->receivePort, settings->transmitPort, settings->serverName);
56 transmitReceiveDataTask=createAuxiliaryTaskLoop(*transmitReceiveData, 50, "transmit-receive-data"); 56 transmitReceiveDataTask=createAuxiliaryTaskLoop(*transmitReceiveData, 80, "transmit-receive-data");
57 //scheduleAuxiliaryTask(transmitReceiveDataTask); //here it does not work 57 //scheduleAuxiliaryTask(transmitReceiveDataTask); //here it does not work
58 return true; 58 return true;
59 } 59 }
60 60
61 // render() is called regularly at the highest priority by the audio engine. 61 // render() is called regularly at the highest priority by the audio engine.