Mercurial > hg > touchkeys
comparison Source/TouchKeys/Osc.h @ 20:dfff66c07936
Lots of minor changes to support building on Visual Studio. A few MSVC-specific #ifdefs to eliminate things Visual Studio doesn't like. This version now compiles on Windows (provided liblo, Juce and pthread are present) but the TouchKeys device support is not yet enabled. Also, the code now needs to be re-checked on Mac and Linux.
author | Andrew McPherson <andrewm@eecs.qmul.ac.uk> |
---|---|
date | Sun, 09 Feb 2014 18:40:51 +0000 |
parents | f943785252fc |
children | 48e3f67b5fe0 |
comparison
equal
deleted
inserted
replaced
19:5d91c6f5aa90 | 20:dfff66c07936 |
---|---|
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 } |