Mercurial > hg > beaglert
comparison include/Scope.h @ 107:836052c86e1e
Updated Scope.h with ifdefs
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Tue, 18 Aug 2015 00:13:04 +0100 |
parents | 8c7f537d0a21 |
children | ad8a93cd7c39 |
comparison
equal
deleted
inserted
replaced
106:207a57538bb7 | 107:836052c86e1e |
---|---|
2 #include <BeagleRT.h> | 2 #include <BeagleRT.h> |
3 #include <rtdk.h> | 3 #include <rtdk.h> |
4 #include <cmath> | 4 #include <cmath> |
5 #include <UdpClient.h> | 5 #include <UdpClient.h> |
6 | 6 |
7 #define NETWORK_AUDIO_BUFFER_SIZE 400 | 7 #define BUILD_FOR_UDPRECEIVE_PLUGIN |
8 #define NETWORK_AUDIO_BUFFER_SIZE 302 | |
8 struct networkAudio{ | 9 struct networkAudio{ |
9 int timestamp; | 10 int timestamp; |
10 int currentBuffer; | 11 int currentBuffer; |
11 int index; | 12 int index; |
12 float buffers[2][NETWORK_AUDIO_BUFFER_SIZE]; | 13 float buffers[2][NETWORK_AUDIO_BUFFER_SIZE]; |
27 int numChannels; | 28 int numChannels; |
28 networkAudio channel[NUM_SCOPE_CHANNELS]; | 29 networkAudio channel[NUM_SCOPE_CHANNELS]; |
29 Scope(){ | 30 Scope(){ |
30 numChannels = NUM_SCOPE_CHANNELS; | 31 numChannels = NUM_SCOPE_CHANNELS; |
31 sampleCount = 0; | 32 sampleCount = 0; |
32 | 33 #ifdef BUILD_FOR_UDPRECEIVE_PLUGIN |
34 char server[]="192.168.7.1"; | |
35 #else | |
36 char server[]="127.0.0.1"; | |
37 #endif /* BUILD_FOR_UDPRECEIVE_PLUGIN */ | |
38 printf("Sending messages to : %s\n", server); | |
33 for(int n=0; n<numChannels; n++){ | 39 for(int n=0; n<numChannels; n++){ |
34 channel[n].doneOnTime=1; | 40 channel[n].doneOnTime=1; |
35 channel[n].index=2; //leave space for the heading message (channel, timestamp) | 41 channel[n].index=2; //leave space for the heading message (channel, timestamp) |
36 channel[n].timestamp=0; | 42 channel[n].timestamp=0; |
37 channel[n].currentBuffer=0; | 43 channel[n].currentBuffer=0; |
38 channel[n].toBeSent=false; | 44 channel[n].toBeSent=false; |
45 channel[n].udpClient.setServer(server); | |
39 #ifdef BUILD_FOR_UDPRECEIVE_PLUGIN | 46 #ifdef BUILD_FOR_UDPRECEIVE_PLUGIN |
40 channel[n].udpClient.setPort(9999+n); | 47 channel[n].udpClient.setPort(9999+n); |
41 channel[n].udpClient.setServer("192.168.7.1"); | |
42 #else | 48 #else |
43 channel[n].udpClient.setPort(9999); | 49 channel[n].udpClient.setPort(9999); |
44 channel[n].udpClient.setServer("127.0.0.1"); | |
45 #endif /* BUILD_FOR_UDPRECEIVE_PLUGIN */ | 50 #endif /* BUILD_FOR_UDPRECEIVE_PLUGIN */ |
46 } | 51 } |
47 } | 52 } |
48 void setup(float _sampleRate); | 53 void setup(float _sampleRate); |
49 void log(float channel1=0.0, float channel2=0.0, float channel3=0.0, float channel4=0.0, float channel5=0.0, float channel6=0.0){ | 54 void log(float channel1=0.0, float channel2=0.0, float channel3=0.0, float channel4=0.0, float channel5=0.0, float channel6=0.0){ |