diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/OSC-client.h')
-rw-r--r-- | apps/plugins/pdbox/PDa/extra/OSC-client.h | 187 |
1 files changed, 0 insertions, 187 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/OSC-client.h b/apps/plugins/pdbox/PDa/extra/OSC-client.h index 196143f8e7..fe2c37b5cb 100644 --- a/apps/plugins/pdbox/PDa/extra/OSC-client.h +++ b/apps/plugins/pdbox/PDa/extra/OSC-client.h | |||
@@ -186,191 +186,4 @@ extern char *OSC_errorMessage; | |||
186 | string? The length of the string, plus the null char, plus any padding | 186 | string? The length of the string, plus the null char, plus any padding |
187 | needed for 4-byte alignment. */ | 187 | needed for 4-byte alignment. */ |
188 | int OSC_effectiveStringLength(char *string); | 188 | int OSC_effectiveStringLength(char *string); |
189 | /* | ||
190 | Written by Matt Wright, The Center for New Music and Audio Technologies, | ||
191 | University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 | ||
192 | The Regents of the University of California (Regents). | ||
193 | |||
194 | Permission to use, copy, modify, distribute, and distribute modified versions | ||
195 | of this software and its documentation without fee and without a signed | ||
196 | licensing agreement, is hereby granted, provided that the above copyright | ||
197 | notice, this paragraph and the following two paragraphs appear in all copies, | ||
198 | modifications, and distributions. | ||
199 | |||
200 | IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, | ||
201 | SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING | ||
202 | OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS | ||
203 | BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
204 | |||
205 | REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
206 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
207 | PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED | ||
208 | HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE | ||
209 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | ||
210 | */ | ||
211 | |||
212 | /* | ||
213 | |||
214 | OSC-client.h: library for constructing OpenSoundControl messages. | ||
215 | Derived from SynthControl.h | ||
216 | Author: Matt Wright | ||
217 | Version 0.1: 6/13/97 | ||
218 | Version 0.2: 7/21/2000: Support for type-tagged messages | ||
219 | |||
220 | |||
221 | General notes: | ||
222 | |||
223 | This library abstracts away the data format for the OpenSoundControl | ||
224 | protocol. Users of this library can construct OpenSoundControl packets | ||
225 | with a function call interface instead of knowing how to lay out the bits. | ||
226 | |||
227 | All issues of memory allocation are deferred to the user of this library. | ||
228 | There are two data structures that the user must allocate. The first | ||
229 | is the actual buffer that the message will be written into. This buffer | ||
230 | can be any size, but if it's too small there's a possibility that it | ||
231 | will become overfull. The other data structure is called an OSCbuf, | ||
232 | and it holds all the state used by the library as it's constructing | ||
233 | a buffer. | ||
234 | |||
235 | All procedures that have the possibility of an error condition return int, | ||
236 | with 0 indicating no error and nonzero indicating an error. The variable | ||
237 | OSC_errorMessage will be set to point to a string containing an error | ||
238 | message explaining what the problem is. | ||
239 | |||
240 | */ | ||
241 | |||
242 | |||
243 | |||
244 | /* The int4byte type has to be a 4-byte integer. You may have to | ||
245 | change this to long or something else on your system. */ | ||
246 | #ifdef __MWERKS__ | ||
247 | /* In Metrowerks you can set ints to be 2 or 4 bytes on 68K, but long is | ||
248 | always 4 bytes */ | ||
249 | typedef long int4byte; | ||
250 | #else | ||
251 | typedef int int4byte; | ||
252 | #endif | ||
253 | |||
254 | /* OSC_timetag.h */ | ||
255 | |||
256 | typedef struct { | ||
257 | int seconds; | ||
258 | int fraction; | ||
259 | } OSCTimeTag; | ||
260 | 189 | ||
261 | OSCTimeTag OSCTT_Immediately(void); | ||
262 | OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset); | ||
263 | OSCTimeTag OSCTT_CurrentTime(void); | ||
264 | |||
265 | |||
266 | |||
267 | /* The maximum depth of bundles within bundles within bundles within... | ||
268 | This is the size of a static array. If you exceed this limit you'll | ||
269 | get an error message. */ | ||
270 | #define MAX_BUNDLE_NESTING 32 | ||
271 | |||
272 | |||
273 | /* Don't ever manipulate the data in the OSCbuf struct directly. (It's | ||
274 | declared here in the header file only so your program will be able to | ||
275 | declare variables of type OSCbuf and have the right amount of memory | ||
276 | be allocated.) */ | ||
277 | |||
278 | typedef struct OSCbuf_struct { | ||
279 | char *buffer; /* The buffer to hold the OSC packet */ | ||
280 | int size; /* Size of the buffer */ | ||
281 | char *bufptr; /* Current position as we fill the buffer */ | ||
282 | int state; /* State of partially-constructed message */ | ||
283 | int4byte *thisMsgSize; /* Pointer to count field before | ||
284 | currently-being-written message */ | ||
285 | int4byte *prevCounts[MAX_BUNDLE_NESTING]; | ||
286 | /* Pointers to count field before each currently | ||
287 | open bundle */ | ||
288 | int bundleDepth; /* How many sub-sub-bundles are we in now? */ | ||
289 | char *typeStringPtr; /* This pointer advances through the type | ||
290 | tag string as you add arguments. */ | ||
291 | int gettingFirstUntypedArg; /* nonzero if this message doesn't have | ||
292 | a type tag and we're waiting for the 1st arg */ | ||
293 | } OSCbuf; | ||
294 | |||
295 | |||
296 | |||
297 | /* Initialize the given OSCbuf. The user of this module must pass in the | ||
298 | block of memory that this OSCbuf will use for a buffer, and the number of | ||
299 | bytes in that block. (It's the user's job to allocate the memory because | ||
300 | you do it differently in different systems.) */ | ||
301 | void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray); | ||
302 | |||
303 | |||
304 | /* Reset the given OSCbuf. Do this after you send out the contents of | ||
305 | the buffer and want to start writing new data into it. */ | ||
306 | void OSC_resetBuffer(OSCbuf *buf); | ||
307 | |||
308 | |||
309 | /* Is the buffer empty? (I.e., would it be stupid to send the buffer | ||
310 | contents to the synth?) */ | ||
311 | int OSC_isBufferEmpty(OSCbuf *buf); | ||
312 | |||
313 | |||
314 | /* How much space is left in the buffer? */ | ||
315 | int OSC_freeSpaceInBuffer(OSCbuf *buf); | ||
316 | |||
317 | /* Does the buffer contain a valid OSC packet? (Returns nonzero if yes.) */ | ||
318 | int OSC_isBufferDone(OSCbuf *buf); | ||
319 | |||
320 | /* When you're ready to send out the buffer (i.e., when OSC_isBufferDone() | ||
321 | returns true), call these two procedures to get the OSC packet that's been | ||
322 | assembled and its size in bytes. (And then call OSC_resetBuffer() if you | ||
323 | want to re-use this OSCbuf for the next packet.) */ | ||
324 | char *OSC_getPacket(OSCbuf *buf); | ||
325 | int OSC_packetSize(OSCbuf *buf); | ||
326 | |||
327 | |||
328 | |||
329 | /* Here's the basic model for building up OSC messages in an OSCbuf: | ||
330 | |||
331 | - Make sure the OSCbuf has been initialized with OSC_initBuffer(). | ||
332 | |||
333 | - To open a bundle, call OSC_openBundle(). You can then write | ||
334 | messages or open new bundles within the bundle you opened. | ||
335 | Call OSC_closeBundle() to close the bundle. Note that a packet | ||
336 | does not have to have a bundle; it can instead consist of just a | ||
337 | single message. | ||
338 | |||
339 | |||
340 | - For each message you want to send: | ||
341 | |||
342 | - Call OSC_writeAddress() with the name of your message. (In | ||
343 | addition to writing your message name into the buffer, this | ||
344 | procedure will also leave space for the size count of this message.) | ||
345 | |||
346 | - Alternately, call OSC_writeAddressAndTypes() with the name of | ||
347 | your message and with a type string listing the types of all the | ||
348 | arguments you will be putting in this message. | ||
349 | |||
350 | - Now write each of the arguments into the buffer, by calling one of: | ||
351 | OSC_writeFloatArg() | ||
352 | OSC_writeFloatArgs() | ||
353 | OSC_writeIntArg() | ||
354 | OSC_writeStringArg() | ||
355 | |||
356 | - Now your message is complete; you can send out the buffer or you can | ||
357 | add another message to it. | ||
358 | */ | ||
359 | |||
360 | int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt); | ||
361 | int OSC_closeBundle(OSCbuf *buf); | ||
362 | int OSC_closeAllBundles(OSCbuf *buf); | ||
363 | |||
364 | int OSC_writeAddress(OSCbuf *buf, char *name); | ||
365 | int OSC_writeAddressAndTypes(OSCbuf *buf, char *name, char *types); | ||
366 | int OSC_writeFloatArg(OSCbuf *buf, float arg); | ||
367 | int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args); | ||
368 | int OSC_writeIntArg(OSCbuf *buf, int4byte arg); | ||
369 | int OSC_writeStringArg(OSCbuf *buf, char *arg); | ||
370 | |||
371 | extern char *OSC_errorMessage; | ||
372 | |||
373 | /* How many bytes will be needed in the OSC format to hold the given | ||
374 | string? The length of the string, plus the null char, plus any padding | ||
375 | needed for 4-byte alignment. */ | ||
376 | int OSC_effectiveStringLength(char *string); | ||