forked from osxmidi/LinVst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rdwrops.h
90 lines (79 loc) · 2.43 KB
/
rdwrops.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
dssi-vst: a DSSI plugin wrapper for VST effects and instruments
Copyright 2004-2007 Chris Cannam
*/
#ifndef _RD_WR_OPS_H_
#include <string>
#include "remoteplugin.h"
#include <vector>
#ifdef SEM
#include <semaphore.h>
#endif
#include <syscall.h>
#include <linux/futex.h>
#include <errno.h>
#define SHM_RING_BUFFER_SIZE 4096
/*
#ifdef EMBED
struct winmessage
{
int handle;
int width;
int height;
};
#endif
*/
struct RingBuffer
{
int head;
int tail;
int written;
bool invalidateCommit;
char buf[SHM_RING_BUFFER_SIZE];
};
struct ShmControl
{
// 32 and 64-bit binaries align semaphores differently.
// Let's make sure there's plenty of room for either one.
union {
#ifdef SEM
sem_t runServer;
char alignServerSem[32];
int runServer386;
#else
int runServer;
#endif
};
union {
#ifdef SEM
sem_t runClient;
char alignClientSem[32];
int runClient386;
#else
int runClient;
#endif
};
RingBuffer ringBuffer;
};
#define tryRead(a, b, c) rdwr_tryRead(a, b, c, __FILE__, __LINE__)
#define tryWrite(a, b, c) rdwr_tryWrite(a, b, c, __FILE__, __LINE__)
#define writeOpcode(a, b) rdwr_writeOpcode(a, b, __FILE__, __LINE__)
#define writeString(a, b) rdwr_writeString(a, b, __FILE__, __LINE__)
#define readString(a) rdwr_readString(a, __FILE__, __LINE__)
#define writeInt(a, b) rdwr_writeInt(a, b, __FILE__, __LINE__)
#define readInt(a) rdwr_readInt(a, __FILE__, __LINE__)
#define writeFloat(a, b) rdwr_writeFloat(a, b, __FILE__, __LINE__)
#define readFloat(a) rdwr_readFloat(a, __FILE__, __LINE__)
#define commitWrite(a) rdwr_commitWrite(a, __FILE__, __LINE__)
#define purgeRead(a) rdwr_purgeRead(a, __FILE__, __LINE__)
#define writeOpcodering(a, b) rdwr_writeOpcodering(a, b, __FILE__, __LINE__)
#define writeIntring(a, b) rdwr_writeIntring(a, b, __FILE__, __LINE__)
#define readIntring(a) rdwr_readIntring(a, __FILE__, __LINE__)
#define tryReadring(a, b, c) rdwr_tryReadring(a, b, c, __FILE__, __LINE__)
#define writeFloatring(a, b) rdwr_writeFloatring(a, b, __FILE__, __LINE__)
#define readFloatring(a) rdwr_readFloatring(a, __FILE__, __LINE__)
#define writeStringring(a, b) rdwr_writeStringring(a, b, __FILE__, __LINE__)
#define readStringring(a) rdwr_readStringring(a, __FILE__, __LINE__)
#define tryReadring(a, b, c) rdwr_tryReadring(a, b, c, __FILE__, __LINE__)
#define tryWritering(a, b, c) rdwr_tryWritering(a, b, c, __FILE__, __LINE__)
#endif