Mercurial > hg > touchkeys
comparison Source/TouchKeys/Osc.h @ 22:48e3f67b5fe0
Merge, and starting condensing all the platform-specific serial code into just a few methods.
author | Andrew McPherson <andrewm@eecs.qmul.ac.uk> |
---|---|
date | Tue, 11 Feb 2014 18:19:34 +0000 |
parents | dfff66c07936 |
children | 90ce403d0dc5 |
comparison
equal
deleted
inserted
replaced
21:aeec68269253 | 22:48e3f67b5fe0 |
---|---|
22 */ | 22 */ |
23 | 23 |
24 #ifndef OSC_H | 24 #ifndef OSC_H |
25 #define OSC_H | 25 #define OSC_H |
26 | 26 |
27 //#include <cstdint> | |
27 #include <iostream> | 28 #include <iostream> |
28 #include <iomanip> | 29 #include <iomanip> |
29 #include <fstream> | 30 #include <fstream> |
30 #include <set> | 31 #include <set> |
31 #include <map> | 32 #include <map> |
32 #include <string> | 33 #include <string> |
33 #include <vector> | 34 #include <vector> |
34 #include <set> | 35 #include <set> |
36 #include "lo/lo.h" | |
35 #include "../JuceLibraryCode/JuceHeader.h" | 37 #include "../JuceLibraryCode/JuceHeader.h" |
36 #include "lo/lo.h" | |
37 | 38 |
38 using namespace std; | 39 using namespace std; |
39 | 40 |
40 class OscMessageSource; | 41 class OscMessageSource; |
41 | 42 |
102 useThru_ = false; | 103 useThru_ = false; |
103 | 104 |
104 // Only start the server if the port is positive | 105 // Only start the server if the port is positive |
105 if(port > 0) { | 106 if(port > 0) { |
106 char portStr[16]; | 107 char portStr[16]; |
108 #ifdef _MSC_VER | |
109 _snprintf_s(portStr, 16, _TRUNCATE, "%d", port); | |
110 #else | |
107 snprintf(portStr, 16, "%d", port); | 111 snprintf(portStr, 16, "%d", port); |
108 | 112 #endif |
113 | |
109 oscServerThread_ = lo_server_thread_new(portStr, staticErrorHandler); | 114 oscServerThread_ = lo_server_thread_new(portStr, staticErrorHandler); |
110 if(oscServerThread_ != 0) { | 115 if(oscServerThread_ != 0) { |
111 lo_server_thread_add_method(oscServerThread_, NULL, NULL, OscReceiver::staticHandler, (void *)this); | 116 lo_server_thread_add_method(oscServerThread_, NULL, NULL, OscReceiver::staticHandler, (void *)this); |
112 lo_server_thread_start(oscServerThread_); | 117 lo_server_thread_start(oscServerThread_); |
113 } | 118 } |