Tizen 2.0 Release
[platform/upstream/libremix.git] / include / remix / remix_types.h
1 /*
2  * libremix -- An audio mixing and sequencing library.
3  *
4  * Copyright (C) 2001 Commonwealth Scientific and Industrial Research
5  * Organisation (CSIRO), Australia.
6  * Copyright (C) 2003 Conrad Parker
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  *
22  */
23
24 /** \file
25  * Base types and public interfaces to libremix
26  *
27  */
28
29 /*
30  * Conrad Parker <conrad@metadecks.org>, August 2001
31  */
32
33 #ifndef __REMIX_TYPES_H__
34 #define __REMIX_TYPES_H__
35
36 #include <limits.h>
37
38 #include "ctxdata.h"
39
40 #define RemixNone NULL
41
42 typedef int RemixError;
43
44 typedef float RemixPCM;
45
46 typedef long RemixCount;
47 #define REMIX_COUNT_MAX (LONG_MAX - 1L)
48 #define REMIX_COUNT_MIN LONG_MIN
49 #define REMIX_COUNT_INFINITE REMIX_COUNT_MAX
50
51 typedef void RemixOpaque;
52
53 #if defined (__REMIX__)
54 typedef struct _RemixBase RemixBase;
55 #else
56 typedef RemixOpaque RemixBase;
57 #endif
58
59 typedef CDScalar RemixParameter;
60
61 typedef int RemixFlags;
62 typedef double RemixSamplerate;
63 typedef double RemixTempo;
64 typedef union _RemixTime RemixTime;
65
66
67 /* Errors */
68 #define REMIX_ERROR_OK              0
69 #define REMIX_ERROR_INVALID         1
70 #define REMIX_ERROR_NOENTITY        2
71 #define REMIX_ERROR_EXISTS          3
72 #define REMIX_ERROR_SILENCE         4
73 #define REMIX_ERROR_NOOP            5
74 #define REMIX_ERROR_SYSTEM          6
75
76 typedef enum {
77   REMIX_CHANNEL_LEFT,
78   REMIX_CHANNEL_RIGHT,
79   REMIX_CHANNEL_CENTRE,
80   REMIX_CHANNEL_REAR,
81   REMIX_CHANNEL_REAR_LEFT,
82   REMIX_CHANNEL_REAR_RIGHT,
83   REMIX_CHANNEL_REAR_CENTRE,
84   REMIX_CHANNEL_LFE /* Low Frequency Effects */
85 } RemixChannelName;
86
87 typedef enum {
88   REMIX_TIME_INVALID,
89   REMIX_TIME_SAMPLES,
90   REMIX_TIME_SECONDS,
91   REMIX_TIME_BEAT24S
92 } RemixTimeType;
93
94 /* Envelope types */
95 typedef enum {
96   REMIX_ENVELOPE_LINEAR,
97   REMIX_ENVELOPE_SPLINE
98 } RemixEnvelopeType;
99
100 union _RemixTime {
101   long TIME;
102   RemixCount samples;
103   float seconds;
104   int beat24s;
105 };
106
107 typedef enum {
108   REMIX_TYPE_BOOL = 0,
109   REMIX_TYPE_INT,
110   REMIX_TYPE_FLOAT,
111   REMIX_TYPE_STRING,
112   REMIX_TYPE_BASE
113 } RemixParameterType;
114
115 typedef enum {
116   REMIX_CONSTRAINT_TYPE_NONE = 0,
117   REMIX_CONSTRAINT_TYPE_LIST,
118   REMIX_CONSTRAINT_TYPE_RANGE
119 } RemixConstraintType;
120
121
122 #define REMIX_RANGE_LOWER_BOUND_VALID (1<<0)
123 #define REMIX_RANGE_UPPER_BOUND_VALID (1<<1)
124 #define REMIX_RANGE_STEP_VALID        (1<<2)
125 #define REMIX_RANGE_ALL_VALID (REMIX_RANGE_LOWER_BOUND_VALID | \
126                               REMIX_RANGE_UPPER_BOUND_VALID | \
127                               REMIX_RANGE_STEP_VALID)
128
129 #define REMIX_HINT_DEFAULT  (0)
130 #define REMIX_HINT_LOG      (1<<0)
131 #define REMIX_HINT_TIME     (1<<1)
132 #define REMIX_HINT_FILENAME (1<<2)
133
134 #define REMIX_CONSTRAINT_EMPTY ((RemixConstraint){NULL})
135
136 #define REMIX_SAMPLES(x) ((RemixTime){(RemixCount)(x)})
137 #define REMIX_SECONDS(x) ((RemixTime){(float)(x)})
138 #define REMIX_BEAT24S(x) ((RemixTime){(int)(x)})
139
140
141 #if (defined(__REMIX__) || defined(__REMIX_PLUGIN__))
142 #include <remix/remix_plugin.h>
143 #else
144 typedef RemixOpaque RemixEnv;
145 typedef RemixOpaque RemixPoint;
146 typedef RemixOpaque RemixEnvelope;
147 typedef RemixOpaque RemixChunk;
148 typedef RemixOpaque RemixChannel;
149 typedef RemixOpaque RemixStream;
150 typedef RemixOpaque RemixDeck;
151 typedef RemixOpaque RemixTrack;
152 typedef RemixOpaque RemixLayer;
153 typedef RemixOpaque RemixSound;
154 typedef RemixOpaque RemixMetaAuthor;
155 typedef RemixOpaque RemixMetaText;
156 typedef RemixOpaque RemixPlugin;
157 typedef RemixOpaque RemixSquareTone;
158 typedef RemixOpaque RemixMonitor;
159 #endif
160
161 #if defined(__cplusplus)
162 }
163 #endif
164
165 #endif /* __REMIX_TYPES_H__ */