[go: up one dir, main page]

Menu

[205fcb]: / lo / lo_osc_types.h  Maximize  Restore  History

Download this file

169 lines (153 with data), 4.3 kB

  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
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
* Copyright (C) 2004 Steve Harris
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* $Id$
*/
#ifndef LO_OSC_TYPES_H
#define LO_OSC_TYPES_H
/**
* \file lo_osc_types.h A liblo header defining OSC-related types and
* constants.
*/
#ifdef _MSC_VER
#ifndef UINTSDEFINED
#define UINTSDEFINED
#define int32_t __int32
#define int64_t __int64
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#define uint8_t unsigned __int8
#endif
#else
#include <stdint.h>
#endif
/**
* \addtogroup liblo
* @{
*/
/**
* \brief A structure to store OSC TimeTag values.
*/
typedef struct {
/** The number of seconds since Jan 1st 1900 in the UTC timezone. */
uint32_t sec;
/** The fractions of a second offset from above, expressed as 1/2^32nds
* of a second */
uint32_t frac;
} lo_timetag;
/**
* \brief An enumeration of bundle element types liblo can handle.
*
* The element of a bundle can either be a message or an other bundle.
*/
typedef enum {
/** bundle element is a message */
LO_ELEMENT_MESSAGE = 1,
/** bundle element is a bundle */
LO_ELEMENT_BUNDLE = 2
} lo_element_type;
/**
* \brief An enumeration of the OSC types liblo can send and receive.
*
* The value of the enumeration is the typechar used to tag messages and to
* specify arguments with lo_send().
*/
typedef enum {
/* basic OSC types */
/** 32 bit signed integer. */
LO_INT32 = 'i',
/** 32 bit IEEE-754 float. */
LO_FLOAT = 'f',
/** Standard C, NULL terminated string. */
LO_STRING = 's',
/** OSC binary blob type. Accessed using the lo_blob_*() functions. */
LO_BLOB = 'b',
/* extended OSC types */
/** 64 bit signed integer. */
LO_INT64 = 'h',
/** OSC TimeTag type, represented by the lo_timetag structure. */
LO_TIMETAG = 't',
/** 64 bit IEEE-754 double. */
LO_DOUBLE = 'd',
/** Standard C, NULL terminated, string. Used in systems which
* distinguish strings and symbols. */
LO_SYMBOL = 'S',
/** Standard C, 8 bit, char variable. */
LO_CHAR = 'c',
/** A 4 byte MIDI packet. */
LO_MIDI = 'm',
/** Sybol representing the value True. */
LO_TRUE = 'T',
/** Sybol representing the value False. */
LO_FALSE = 'F',
/** Sybol representing the value Nil. */
LO_NIL = 'N',
/** Sybol representing the value Infinitum. */
LO_INFINITUM = 'I'
} lo_type;
/**
* \brief Union used to read values from incoming messages.
*
* Types can generally be read using argv[n]->t where n is the argument number
* and t is the type character, with the exception of strings and symbols which
* must be read with &argv[n]->t.
*/
typedef union {
/** 32 bit signed integer. */
int32_t i;
/** 32 bit signed integer. */
int32_t i32;
/** 64 bit signed integer. */
int64_t h;
/** 64 bit signed integer. */
int64_t i64;
/** 32 bit IEEE-754 float. */
float f;
/** 32 bit IEEE-754 float. */
float f32;
/** 64 bit IEEE-754 double. */
double d;
/** 64 bit IEEE-754 double. */
double f64;
/** Standard C, NULL terminated string. */
char s;
/** Standard C, NULL terminated, string. Used in systems which
* distinguish strings and symbols. */
char S;
/** Standard C, 8 bit, char. */
unsigned char c;
/** A 4 byte MIDI packet. */
uint8_t m[4];
/** OSC TimeTag value. */
lo_timetag t;
} lo_arg;
/* Note: No struct literals in MSVC */
#ifdef _MSC_VER
#ifndef USE_ANSI_C
#define USE_ANSI_C
#endif
#endif
#ifdef DLL_EXPORT
#ifndef USE_ANSI_C
#define USE_ANSI_C
#endif
#endif
/** \brief A timetag constant representing "now". */
#ifdef USE_ANSI_C
lo_timetag lo_get_tt_immediate();
#define LO_TT_IMMEDIATE lo_get_tt_immediate()
#else // !USE_ANSI_C
#define LO_TT_IMMEDIATE ((lo_timetag){0U,1U})
#endif // USE_ANSI_C
/** @} */
#endif