eas_types.h revision 7df30109963092559d3760c0661a020f9daf1030
1/*----------------------------------------------------------------------------
2 *
3 * File:
4 * eas_types.h
5 *
6 * Contents and purpose:
7 * The public interface header for the EAS synthesizer.
8 *
9 * This header only contains declarations that are specific
10 * to this implementation.
11 *
12 * DO NOT MODIFY THIS FILE!
13 *
14 * Copyright Sonic Network Inc. 2004
15
16 * Licensed under the Apache License, Version 2.0 (the "License");
17 * you may not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 *      http://www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an "AS IS" BASIS,
24 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 *
28 *----------------------------------------------------------------------------
29 * Revision Control:
30 *   $Revision: 726 $
31 *   $Date: 2007-06-14 23:10:46 -0700 (Thu, 14 Jun 2007) $
32 *----------------------------------------------------------------------------
33*/
34
35#ifndef _EAS_TYPES_H
36#define _EAS_TYPES_H
37
38/* EAS_RESULT return codes */
39typedef long EAS_RESULT;
40#define EAS_SUCCESS							0
41#define EAS_FAILURE							-1
42#define EAS_ERROR_INVALID_MODULE			-2
43#define EAS_ERROR_MALLOC_FAILED				-3
44#define EAS_ERROR_FILE_POS					-4
45#define EAS_ERROR_INVALID_FILE_MODE			-5
46#define EAS_ERROR_FILE_SEEK					-6
47#define EAS_ERROR_FILE_LENGTH				-7
48#define EAS_ERROR_NOT_IMPLEMENTED			-8
49#define EAS_ERROR_CLOSE_FAILED				-9
50#define EAS_ERROR_FILE_OPEN_FAILED			-10
51#define EAS_ERROR_INVALID_HANDLE			-11
52#define EAS_ERROR_NO_MIX_BUFFER				-12
53#define EAS_ERROR_PARAMETER_RANGE			-13
54#define EAS_ERROR_MAX_FILES_OPEN			-14
55#define EAS_ERROR_UNRECOGNIZED_FORMAT		-15
56#define EAS_BUFFER_SIZE_MISMATCH			-16
57#define EAS_ERROR_FILE_FORMAT				-17
58#define EAS_ERROR_SMF_NOT_INITIALIZED		-18
59#define EAS_ERROR_LOCATE_BEYOND_END			-19
60#define EAS_ERROR_INVALID_PCM_TYPE			-20
61#define EAS_ERROR_MAX_PCM_STREAMS			-21
62#define EAS_ERROR_NO_VOICE_ALLOCATED		-22
63#define EAS_ERROR_INVALID_CHANNEL			-23
64#define EAS_ERROR_ALREADY_STOPPED			-24
65#define EAS_ERROR_FILE_READ_FAILED			-25
66#define EAS_ERROR_HANDLE_INTEGRITY			-26
67#define EAS_ERROR_MAX_STREAMS_OPEN			-27
68#define EAS_ERROR_INVALID_PARAMETER			-28
69#define EAS_ERROR_FEATURE_NOT_AVAILABLE		-29
70#define EAS_ERROR_SOUND_LIBRARY				-30
71#define EAS_ERROR_NOT_VALID_IN_THIS_STATE	-31
72#define EAS_ERROR_NO_VIRTUAL_SYNTHESIZER	-32
73#define EAS_ERROR_FILE_ALREADY_OPEN			-33
74#define EAS_ERROR_FILE_ALREADY_CLOSED		-34
75#define EAS_ERROR_INCOMPATIBLE_VERSION		-35
76#define EAS_ERROR_QUEUE_IS_FULL				-36
77#define EAS_ERROR_QUEUE_IS_EMPTY			-37
78#define EAS_ERROR_FEATURE_ALREADY_ACTIVE	-38
79
80/* special return codes */
81#define EAS_EOF								3
82#define EAS_STREAM_BUFFERING				4
83#define EAS_BUFFER_FULL						5
84
85/* EAS_STATE return codes */
86typedef long EAS_STATE;
87typedef enum
88{
89	EAS_STATE_READY = 0,
90	EAS_STATE_PLAY,
91	EAS_STATE_STOPPING,
92	EAS_STATE_PAUSING,
93	EAS_STATE_STOPPED,
94	EAS_STATE_PAUSED,
95	EAS_STATE_OPEN,
96	EAS_STATE_ERROR,
97	EAS_STATE_EMPTY
98} E_EAS_STATE;
99
100/* constants */
101#ifndef EAS_CONST
102#define EAS_CONST const
103#endif
104
105/* definition for public interface functions */
106#ifndef EAS_PUBLIC
107#define EAS_PUBLIC
108#endif
109
110/* boolean values */
111typedef unsigned EAS_BOOL;
112typedef unsigned char EAS_BOOL8;
113
114#define EAS_FALSE	0
115#define EAS_TRUE	1
116
117/* scalar variable definitions */
118typedef unsigned char EAS_U8;
119typedef signed char EAS_I8;
120typedef char EAS_CHAR;
121
122typedef unsigned short EAS_U16;
123typedef short EAS_I16;
124
125typedef unsigned long EAS_U32;
126typedef long EAS_I32;
127
128typedef unsigned EAS_UINT;
129typedef int EAS_INT;
130typedef long EAS_LONG;
131
132/* audio output type */
133typedef short EAS_PCM;
134
135/* file open modes */
136typedef EAS_I32 EAS_FILE_MODE;
137#define EAS_FILE_READ	1
138#define EAS_FILE_WRITE	2
139
140/* file locator e.g. filename or memory pointer */
141typedef const void *EAS_FILE_LOCATOR;
142
143/* handle to stream */
144typedef struct s_eas_stream_tag *EAS_HANDLE;
145
146/* handle to file */
147typedef struct eas_hw_file_tag *EAS_FILE_HANDLE;
148
149/* handle for synthesizer data */
150typedef struct s_eas_data_tag *EAS_DATA_HANDLE;
151
152/* handle to persistent data for host wrapper interface */
153typedef struct eas_hw_inst_data_tag *EAS_HW_DATA_HANDLE;
154
155/* handle to sound library */
156typedef struct s_eas_sndlib_tag *EAS_SNDLIB_HANDLE;
157typedef struct s_eas_dls_tag *EAS_DLSLIB_HANDLE;
158
159/* pointer to frame buffer - used in split architecture only */
160typedef struct s_eas_frame_buffer_tag *EAS_FRAME_BUFFER_HANDLE;
161
162/* untyped pointer for instance data */
163typedef void *EAS_VOID_PTR;
164
165/* inline functions */
166#ifndef EAS_INLINE
167#if defined (__XCC__)
168#define EAS_INLINE __inline__
169#elif defined (__GNUC__)
170#define EAS_INLINE inline static
171#else
172#define EAS_INLINE __inline
173#endif
174#endif
175
176/* define NULL value */
177#ifndef NULL
178#define NULL 0
179#endif
180
181/* metadata types for metadata return codes */
182typedef enum
183{
184	EAS_METADATA_UNKNOWN = 0,
185	EAS_METADATA_TITLE,
186	EAS_METADATA_AUTHOR,
187	EAS_METADATA_COPYRIGHT,
188	EAS_METADATA_LYRIC,
189	EAS_METADATA_TEXT
190} E_EAS_METADATA_TYPE;
191
192/* metadata callback function */
193typedef void (*EAS_METADATA_CBFUNC) (E_EAS_METADATA_TYPE metaDataType, char *metaDataBuf, EAS_VOID_PTR pUserData);
194
195/* file types for metadata return codes */
196typedef enum
197{
198	EAS_FILE_UNKNOWN = 0,
199	EAS_FILE_SMF0,
200	EAS_FILE_SMF1,
201	EAS_FILE_SMAF_UNKNOWN,
202	EAS_FILE_SMAF_MA2,
203	EAS_FILE_SMAF_MA3,
204	EAS_FILE_SMAF_MA5,
205	EAS_FILE_CMX,
206	EAS_FILE_MFI,
207	EAS_FILE_OTA,
208	EAS_FILE_IMELODY,
209	EAS_FILE_RTTTL,
210	EAS_FILE_XMF0,
211	EAS_FILE_XMF1,
212	EAS_FILE_WAVE_PCM,
213	EAS_FILE_WAVE_IMA_ADPCM,
214	EAS_FILE_MMAPI_TONE_CONTROL
215} E_EAS_FILE_TYPE;
216
217/* enumeration for synthesizers */
218typedef enum
219{
220	EAS_MCU_SYNTH = 0,
221	EAS_DSP_SYNTH
222} E_SYNTHESIZER;
223
224/* external audio callback program change */
225typedef struct s_ext_audio_prg_chg_tag
226{
227	EAS_U16 	bank;
228	EAS_U8		program;
229	EAS_U8		channel;
230} S_EXT_AUDIO_PRG_CHG;
231
232/* external audio callback event */
233typedef struct s_ext_audio_event_tag
234{
235	EAS_U8		channel;
236	EAS_U8		note;
237	EAS_U8		velocity;
238	EAS_BOOL8	noteOn;
239} S_EXT_AUDIO_EVENT;
240
241typedef struct s_midi_controllers_tag
242{
243	EAS_U8		modWheel;			/* CC1 */
244	EAS_U8		volume;				/* CC7 */
245	EAS_U8		pan;				/* CC10 */
246	EAS_U8		expression;			/* CC11 */
247	EAS_U8		channelPressure;	/* MIDI channel pressure */
248
249#ifdef	_REVERB
250	EAS_U8		reverbSend;			/* CC91 */
251#endif
252
253#ifdef	_CHORUS
254	EAS_U8		chorusSend;			/* CC93 */
255#endif
256} S_MIDI_CONTROLLERS;
257
258/* iMode play modes enumeration for EAS_SetPlayMode */
259typedef enum
260{
261	IMODE_PLAY_ALL = 0,
262	IMODE_PLAY_PARTIAL
263} E_I_MODE_PLAY_MODE;
264
265typedef EAS_BOOL (*EAS_EXT_PRG_CHG_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_PRG_CHG *pPrgChg);
266typedef EAS_BOOL (*EAS_EXT_EVENT_FUNC) (EAS_VOID_PTR pInstData, S_EXT_AUDIO_EVENT *pEvent);
267
268#endif /* #ifndef _EAS_TYPES_H */
269