-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOSC.h
43 lines (36 loc) · 1 KB
/
OSC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Created by martin on 4/28/18.
//
#ifndef RTPIANO_OSC_H
#define RTPIANO_OSC_H
#define IN_BUFFER_SIZE 8192
#define OUT_BUFFER_SIZE 32768
#include <arpa/inet.h>
#include <fcntl.h>
#include <unistd.h>
#include "tinyosc.h"
#include <functional>
#include <iostream>
using namespace std;
class OSC {
const int fd = socket(AF_INET, SOCK_DGRAM, 0);
char buffer[IN_BUFFER_SIZE];
std::function<void(tosc_message*)> oscCallback;
int fdOut;
struct addrinfo* addInfoOut = 0;
char bufferOut[OUT_BUFFER_SIZE];
public:
OSC(std::function<void(tosc_message*)> oscCallback);
void oscListen();
void closeSocket();
// Outbound
void sendJson(const char* json);
void sendFaustError(const char* errorMsg);
void sendFaustCode(int channel, const char *code);
void sendFaustAck();
void sendInstruments(string instruments);
void sendClipSummary(string json);
void sendChannelSummary(string json);
void sendActive(int channel, int variation);
};
#endif //RTPIANO_OSC_H