1 | //notify.h: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2013 |
---|
5 | * |
---|
6 | * This file is part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU Lesser General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * RoarAudio is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU Lesser General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU Lesser General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
22 | * Boston, MA 02110-1301, USA. |
---|
23 | * |
---|
24 | * NOTE: Even though this file is LGPLed it (may) include GPLed files |
---|
25 | * so the license of this file is/may therefore downgraded to GPL. |
---|
26 | * See HACKING for details. |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _ROARAUDIO_NOTIFY_H_ |
---|
30 | #define _ROARAUDIO_NOTIFY_H_ |
---|
31 | |
---|
32 | #define ROAR_EVENT_NETFLAG_NONE 0x00000000 |
---|
33 | #define ROAR_EVENT_NETFLAG_DATA 0x00000001 |
---|
34 | #define ROAR_EVENT_NETFLAG_PROXYEVENT 0x00000002 |
---|
35 | |
---|
36 | #define ROAR_NOTIFY_SPECIAL (uint32_t)0xffffffff |
---|
37 | |
---|
38 | // protocol cmds: |
---|
39 | #define ROAR_NOTIFY_OFFSET_CMD (uint32_t)0x00000000 |
---|
40 | #define ROAR_NOTIFY_MASK_CMD (uint32_t)0x000000ff |
---|
41 | |
---|
42 | // event groups (AKA meta events): |
---|
43 | #define ROAR_NOTIFY_OFFSET_EGRP (uint32_t)0x00010000 |
---|
44 | #define ROAR_NOTIFY_MASK_EGRP (uint32_t)0x0000ffff |
---|
45 | |
---|
46 | // object event: |
---|
47 | #define ROAR_NOTIFY_OFFSET_OE (uint32_t)0x00020000 |
---|
48 | #define ROAR_NOTIFY_MASK_OE (uint32_t)0x0000ffff |
---|
49 | |
---|
50 | // data events: |
---|
51 | #define ROAR_NOTIFY_OFFSET_DATA (uint32_t)0x00030000 |
---|
52 | #define ROAR_NOTIFY_MASK_DATA (uint32_t)0x0000ffff |
---|
53 | |
---|
54 | // user defined events: |
---|
55 | #define ROAR_NOTIFY_OFFSET_USER (uint32_t)0x40000000 |
---|
56 | #define ROAR_NOTIFY_MASK_USER (uint32_t)0x3fffffff |
---|
57 | |
---|
58 | #define ROAR_NOTIFY_X2EVENT(x,offset,mask) ((x) == (uint32_t)-1 ? ROAR_NOTIFY_SPECIAL : (((x) & (mask))+(offset))) |
---|
59 | #define ROAR_NOTIFY_EVENT2X(x,offset,mask) (ROAR_NOTIFY_IS_X((x),(offset),(mask)) != 1 ? (uint32_t)-1 : ((x) - (offset))) |
---|
60 | #define ROAR_NOTIFY_IS_X(x,offset,mask) ((x) == ROAR_NOTIFY_SPECIAL ? -1 : (((x) | (mask)) - (mask)) == (offset) ? 1 : 0) |
---|
61 | |
---|
62 | #define ROAR_NOTIFY_CMD2EVENT(x) ROAR_NOTIFY_X2EVENT((x), ROAR_NOTIFY_OFFSET_CMD, ROAR_NOTIFY_MASK_CMD) |
---|
63 | #define ROAR_NOTIFY_EVENT2CMD(x) ROAR_NOTIFY_EVENT2X((x), ROAR_NOTIFY_OFFSET_CMD, ROAR_NOTIFY_MASK_CMD) |
---|
64 | #define ROAR_NOTIFY_IS_CMD(x) ROAR_NOTIFY_IS_X((x), ROAR_NOTIFY_OFFSET_CMD, ROAR_NOTIFY_MASK_CMD) |
---|
65 | |
---|
66 | #define ROAR_NOTIFY_EGRP2EVENT(x) ROAR_NOTIFY_X2EVENT((x), ROAR_NOTIFY_OFFSET_EGRP, ROAR_NOTIFY_MASK_EGRP) |
---|
67 | #define ROAR_NOTIFY_EVENT2EGRP(x) ROAR_NOTIFY_EVENT2X((x), ROAR_NOTIFY_OFFSET_EGRP, ROAR_NOTIFY_MASK_EGRP) |
---|
68 | #define ROAR_NOTIFY_IS_EGRP(x) ROAR_NOTIFY_IS_X((x), ROAR_NOTIFY_OFFSET_EGRP, ROAR_NOTIFY_MASK_EGRP) |
---|
69 | |
---|
70 | #define ROAR_NOTIFY_OE2EVENT(x) ROAR_NOTIFY_X2EVENT((x), ROAR_NOTIFY_OFFSET_OE, ROAR_NOTIFY_MASK_OE) |
---|
71 | #define ROAR_NOTIFY_EVENT2OE(x) ROAR_NOTIFY_EVENT2X((x), ROAR_NOTIFY_OFFSET_OE, ROAR_NOTIFY_MASK_OE) |
---|
72 | #define ROAR_NOTIFY_IS_OE(x) ROAR_NOTIFY_IS_X((x), ROAR_NOTIFY_OFFSET_OE, ROAR_NOTIFY_MASK_OE) |
---|
73 | |
---|
74 | #define ROAR_NOTIFY_DATA2EVENT(x) ROAR_NOTIFY_X2EVENT((x), ROAR_NOTIFY_OFFSET_DATA, ROAR_NOTIFY_MASK_DATA) |
---|
75 | #define ROAR_NOTIFY_EVENT2DATA(x) ROAR_NOTIFY_EVENT2X((x), ROAR_NOTIFY_OFFSET_DATA, ROAR_NOTIFY_MASK_DATA) |
---|
76 | #define ROAR_NOTIFY_IS_DATA(x) ROAR_NOTIFY_IS_X((x), ROAR_NOTIFY_OFFSET_DATA, ROAR_NOTIFY_MASK_DATA) |
---|
77 | |
---|
78 | #define ROAR_NOTIFY_USER2EVENT(x) ROAR_NOTIFY_X2EVENT((x), ROAR_NOTIFY_OFFSET_USER, ROAR_NOTIFY_MASK_USER) |
---|
79 | #define ROAR_NOTIFY_EVENT2USER(x) ROAR_NOTIFY_EVENT2X((x), ROAR_NOTIFY_OFFSET_USER, ROAR_NOTIFY_MASK_USER) |
---|
80 | #define ROAR_NOTIFY_IS_USER(x) ROAR_NOTIFY_IS_X((x), ROAR_NOTIFY_OFFSET_USER, ROAR_NOTIFY_MASK_USER) |
---|
81 | |
---|
82 | // EGRP: |
---|
83 | #define ROAR_NOTIFY_EGRP_GROUP_BASICS 0x0000 |
---|
84 | #define ROAR_NOTIFY_EGRP_GROUP_CLIENTS (ROAR_OT_CLIENT << 8) |
---|
85 | #define ROAR_NOTIFY_EGRP_GROUP_STREAMS (ROAR_OT_STREAM << 8) |
---|
86 | #define ROAR_NOTIFY_EGRP_GROUP_SOURCES (ROAR_OT_SOURCE << 8) |
---|
87 | #define ROAR_NOTIFY_EGRP_GROUP_SAMPLES (ROAR_OT_SAMPLE << 8) |
---|
88 | |
---|
89 | #define ROAR_EGRP_ANY_EVENT ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_BASICS + 0) |
---|
90 | #define ROAR_EGRP_OBJECT_NEW ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_BASICS + 1) |
---|
91 | #define ROAR_EGRP_OBJECT_DELETE ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_BASICS + 2) |
---|
92 | #define ROAR_EGRP_OBJECT_REF ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_BASICS + 3) |
---|
93 | #define ROAR_EGRP_OBJECT_UNREF ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_BASICS + 4) |
---|
94 | #define ROAR_EGRP_ERROR ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_BASICS + 5) |
---|
95 | |
---|
96 | #define ROAR_EGRP_ANY_CLIENT_EVENT ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_CLIENTS + 0) |
---|
97 | |
---|
98 | #define ROAR_EGRP_ANY_STREAM_EVENT ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_STREAMS + 0) |
---|
99 | |
---|
100 | #define ROAR_EGRP_ANY_SOURCE_EVENT ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_SOURCES + 0) |
---|
101 | |
---|
102 | #define ROAR_EGRP_ANY_SAMPLE_EVENT ROAR_NOTIFY_EGRP2EVENT(ROAR_NOTIFY_EGRP_GROUP_SAMPLES + 0) |
---|
103 | |
---|
104 | // OE: |
---|
105 | #define ROAR_NOTIFY_OE_GROUP_BASICS 0x0000 |
---|
106 | #define ROAR_NOTIFY_OE_GROUP_CLIENTS (ROAR_OT_CLIENT << 8) |
---|
107 | #define ROAR_NOTIFY_OE_GROUP_STREAMS (ROAR_OT_STREAM << 8) |
---|
108 | #define ROAR_NOTIFY_OE_GROUP_SOURCES (ROAR_OT_SOURCE << 8) |
---|
109 | #define ROAR_NOTIFY_OE_GROUP_SAMPLES (ROAR_OT_SAMPLE << 8) |
---|
110 | |
---|
111 | #define ROAR_OE_BASICS_CHANGE_STATE ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_BASICS + 0) |
---|
112 | #define ROAR_OE_BASICS_CHANGE_FLAGS ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_BASICS + 5) |
---|
113 | #define ROAR_OE_BASICS_NEW ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_BASICS + 6) |
---|
114 | #define ROAR_OE_BASICS_DELETE ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_BASICS + 7) |
---|
115 | |
---|
116 | #define ROAR_OE_CLIENT_CONNECT ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_CLIENTS + 0) |
---|
117 | #define ROAR_OE_CLIENT_DISCONNECT ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_CLIENTS + 1) |
---|
118 | #define ROAR_OE_CLIENT_MSG ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_CLIENTS + 3) |
---|
119 | |
---|
120 | //#define ROAR_OE_STREAM_CHANGE_STATE ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 0) |
---|
121 | #define ROAR_OE_STREAM_EXEC ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 1) |
---|
122 | #define ROAR_OE_STREAM_EOF ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 2) |
---|
123 | #define ROAR_OE_STREAM_CON_STREAM ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 3) |
---|
124 | #define ROAR_OE_STREAM_PASSFH ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 4) |
---|
125 | //#define ROAR_OE_STREAM_CHANGE_FLAGS ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 5) |
---|
126 | #define ROAR_OE_STREAM_CHANGE_VOLUME ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 6) |
---|
127 | #define ROAR_OE_STREAM_XRUN ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 7) |
---|
128 | #define ROAR_OE_STREAM_META_UPDATE ROAR_NOTIFY_OE2EVENT(ROAR_NOTIFY_OE_GROUP_STREAMS + 8) |
---|
129 | |
---|
130 | #define ROAR_XRUN_NONE 0 |
---|
131 | #define ROAR_XRUN_UNDER_PRE 1 |
---|
132 | #define ROAR_XRUN_UNDER_POST 2 |
---|
133 | #define ROAR_XRUN_OVER_PRE 3 |
---|
134 | #define ROAR_XRUN_OVER_POST 4 |
---|
135 | |
---|
136 | // Data: |
---|
137 | #define ROAR_DATA_EVENT2DIR(ev) (((ev) & 0xFF00) >> 8) |
---|
138 | #define ROAR_DATA_EVENT2EVENT(ev) (((ev) & 0x00FF)) |
---|
139 | #define ROAR_DATA_GROUP(dir) ((dir) << 8) |
---|
140 | #define ROAR_DATA_GROUP_WAVEFORM ROAR_DATA_GROUP(ROAR_DIR_PLAY) |
---|
141 | #define ROAR_DATA_GROUP_MIDI ROAR_DATA_GROUP(ROAR_DIR_MIDI_IN) |
---|
142 | #define ROAR_DATA_GROUP_LIGHT ROAR_DATA_GROUP(ROAR_DIR_LIGHT_IN) |
---|
143 | #define ROAR_DATA_GROUP_RAW ROAR_DATA_GROUP(ROAR_DIR_RAW_IN) |
---|
144 | #define ROAR_DATA_GROUP_COMPLEX ROAR_DATA_GROUP(ROAR_DIR_COMPLEX_IN) |
---|
145 | #define ROAR_DATA_GROUP_RDTCS ROAR_DATA_GROUP(ROAR_DIR_RDTCS_IN) |
---|
146 | |
---|
147 | #define ROAR_DATA_DMX512_GROUP_CHANNEL (ROAR_DATA_GROUP_LIGHT + 0x00) |
---|
148 | #define ROAR_DATA_DMX512_GROUP_EVENT (ROAR_DATA_GROUP_LIGHT + 0x10) |
---|
149 | |
---|
150 | // should we really send channel updates? Latency? ...? |
---|
151 | // Emmiter: client ID, target: mixer or other stream, target_type: STREAM, |
---|
152 | // arg0: channel, arg1: new value |
---|
153 | // *: -1/NULL |
---|
154 | #define ROAR_DATA_DMX512_CHANNEL_UPDATE ROAR_NOTIFY_DATA2EVENT(ROAR_DATA_DMX512_GROUP_CHANNEL + 1) |
---|
155 | |
---|
156 | // Emmiter: client ID, target: mixer or other stream, target_type: STREAM, |
---|
157 | // arg0: event type (ROAR_ROARDMX_EVENT_*) |
---|
158 | // *: -1/NULL |
---|
159 | #define ROAR_DATA_DMX512_EVENT ROAR_NOTIFY_DATA2EVENT(ROAR_DATA_DMX512_GROUP_EVENT + 1) |
---|
160 | |
---|
161 | #endif |
---|
162 | |
---|
163 | //ll |
---|