25#include "jnetlib/jnetlib.h"
29#include "IPlugOSC_msg.h"
36static constexpr int OSC_TIMER_RATE = 100;
39using OSCLogFunc = std::function<void(WDL_String& log)>;
44 OSCDevice(
const char* dest,
int maxpacket,
int sendsleep,
struct sockaddr_in* listen_addr);
49 void AddInstance(
void (*callback)(
void* d1,
int dev_idx,
int msglen,
void* msg),
void* d1,
int dev_idx);
50 void OnMessage(
char type,
const unsigned char* msg,
int len);
51 void SendOSC(
const char* src,
int len);
56 void (*callback)(
void* d1,
int dev_idx,
int msglen,
void* msg);
61 WDL_TypedBuf<rec> mInstances;
63 double mLastOpenTime = 0;
64 bool mHasInput =
false;
65 bool mHasOutput =
false;
68 int mMaxMacketSize, mSendSleep;
69 WDL_String mDestination;
71 struct sockaddr_in mSendAddress, mReceiveAddress;
72 WDL_Queue mSendQueue, mReceiveQueue;
92 OSCDevice* CreateReceiver(WDL_String& log,
int port = 8000);
93 OSCDevice* CreateSender(WDL_String& log,
const char* ip =
"127.0.0.1",
int port = 8000);
97 void SetLogFunc(OSCLogFunc logFunc) { mLogFunc = logFunc; }
105 static void MessageCallback(
void *d1,
int dev_idx,
int msglen,
void *msg);
107 void OnTimer(
Timer& timer);
109 WDL_PtrList<OSCDevice> mDevices;
113 std::unique_ptr<Timer> mTimer;
114 WDL_HeapBuf mIncomingEvents;
115 WDL_Mutex mIncomingEvents_mutex;
IPlug logging a.k.a tracing functionality.
This file includes classes for implementing timers - in order to get a regular callback on the main t...
void RemoveDevice(OSCDevice *device)
Remove a device from the device list and delete it.