Mercurial > hg > beaglert
comparison core/NetworkSend.cpp @ 219:0183185cab1b mergingClockSync
Removed obsolete Scope class
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 13 Feb 2016 15:55:33 +0000 |
parents | c42a6b4dc2d4 |
children | 46bd63a50933 |
comparison
equal
deleted
inserted
replaced
218:a94c8e0f4ec7 | 219:0183185cab1b |
---|---|
238 // t2 = std::chrono::high_resolution_clock::now(); | 238 // t2 = std::chrono::high_resolution_clock::now(); |
239 // auto duration1 = std::chrono::duration_cast<std::chrono::microseconds>( t3 - t1 ).count(); | 239 // auto duration1 = std::chrono::duration_cast<std::chrono::microseconds>( t3 - t1 ).count(); |
240 // auto duration2 = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count(); | 240 // auto duration2 = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count(); |
241 // if(duration2>0) | 241 // if(duration2>0) |
242 // std::cout << "Duration is: " << duration2 <<". Whole loop is: " << duration1 << "\n"; | 242 // std::cout << "Duration is: " << duration2 <<". Whole loop is: " << duration1 << "\n"; |
243 sleep(1); | 243 usleep(1000); |
244 } | 244 } |
245 #else | 245 #else |
246 threadRunning=true; | 246 threadRunning=true; |
247 while(threadShouldExit()==false){ | 247 while(threadShouldExit()==false){ |
248 sendAllData(); | 248 sendAllData(); |
249 usleep(sleepTimeMs*1000); | 249 usleep(sleepTimeMs*1000); |
250 } | 250 } |
251 threadRunning=false; | 251 threadRunning=false; |
252 #endif | 252 #endif |
253 } | 253 } |
254 #ifdef USE_JUCE | |
255 #else | |
256 Scope::Scope(int aNumChannels): | |
257 channels(aNumChannels) | |
258 {}; | |
259 Scope::~Scope(){}; | |
260 | |
261 void Scope::log(int channel, float value){ | |
262 if(channel>=getNumChannels()) //TODO: assert this | |
263 return; | |
264 channels[channel].log(value); | |
265 } | |
266 | |
267 void Scope::setup(){ | |
268 setup(44100, 9999, "127.0.0.1"); | |
269 } | |
270 | |
271 void Scope::setup(float sampleRate, int aPort, const char* aServer){ | |
272 for(int n=0; n<getNumChannels(); n++){ | |
273 channels[n].setup(sampleRate, 128, n, aPort, aServer); //TODO: replace 128 with the actual block size | |
274 } | |
275 } | |
276 | |
277 void Scope::setPort(int port){ | |
278 for(int n=0; n<getNumChannels(); n++){ | |
279 channels[n].setPort(port); | |
280 } | |
281 } | |
282 void Scope::setPort(int channel, int aPort){ | |
283 channels[channel].setPort(aPort); | |
284 printf("Channel %d is now sending to port %d\n", channel, aPort); | |
285 } | |
286 | |
287 int Scope::getNumChannels(){ | |
288 return channels.size(); | |
289 } | |
290 | |
291 void Scope::sendData(){ | |
292 NetworkSend::sendAllData(); | |
293 } | |
294 #endif |