eas.h revision e442bb7cd6a085b33a4dd52c0e20a157ada7feb1
1/*----------------------------------------------------------------------------
2 *
3 * File:
4 * eas.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. 2005, 2006
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: 852 $
31 *   $Date: 2007-09-04 11:43:49 -0700 (Tue, 04 Sep 2007) $
32 *----------------------------------------------------------------------------
33*/
34
35#ifndef _EAS_H
36#define _EAS_H
37
38#include "eas_types.h"
39
40/* for C++ linkage */
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45/* library version macro */
46#define MAKE_LIB_VERSION(a,b,c,d) (((((((EAS_U32) a <<8) | (EAS_U32) b) << 8) | (EAS_U32) c) << 8) | (EAS_U32) d)
47#define LIB_VERSION MAKE_LIB_VERSION(3, 6, 10, 14)
48
49typedef struct
50{
51	EAS_U32		libVersion;
52	EAS_BOOL	checkedVersion;
53	EAS_I32		maxVoices;
54	EAS_I32		numChannels;
55	EAS_I32		sampleRate;
56	EAS_I32		mixBufferSize;
57	EAS_BOOL	filterEnabled;
58	EAS_U32		buildTimeStamp;
59	EAS_CHAR 	*buildGUID;
60} S_EAS_LIB_CONFIG;
61
62/* enumerated effects module numbers for configuration */
63typedef enum
64{
65	EAS_MODULE_ENHANCER = 0,
66	EAS_MODULE_COMPRESSOR,
67	EAS_MODULE_REVERB,
68	EAS_MODULE_CHORUS,
69	EAS_MODULE_WIDENER,
70	EAS_MODULE_GRAPHIC_EQ,
71	EAS_MODULE_WOW,
72	EAS_MODULE_MAXIMIZER,
73	EAS_MODULE_TONECONTROLEQ,
74	NUM_EFFECTS_MODULES
75} E_FX_MODULES;
76
77/* enumerated optional module numbers for configuration */
78typedef enum
79{
80	EAS_MODULE_MMAPI_TONE_CONTROL = 0,
81	EAS_MODULE_METRICS
82} E_OPT_MODULES;
83#define NUM_OPTIONAL_MODULES	2
84
85/* enumerated audio decoders for configuration */
86typedef enum
87{
88	EAS_DECODER_PCM = 0,
89	EAS_DECODER_SMAF_ADPCM,
90	EAS_DECODER_IMA_ADPCM,
91	EAS_DECODER_7BIT_SMAF_ADPCM,
92	EAS_DECODER_NOT_SUPPORTED
93} E_DECODER_MODULES;
94#define NUM_DECODER_MODULES		4
95
96/* defines for EAS_PEOpenStream flags parameter */
97#define PCM_FLAGS_STEREO		0x00000100	/* stream is stereo */
98#define PCM_FLAGS_8_BIT			0x00000001	/* 8-bit format */
99#define PCM_FLAGS_UNSIGNED		0x00000010	/* unsigned format */
100#define PCM_FLAGS_STREAMING		0x80000000	/* streaming mode */
101
102/* maximum volume setting */
103#define EAS_MAX_VOLUME			100
104
105/*----------------------------------------------------------------------------
106 * EAS_Init()
107 *----------------------------------------------------------------------------
108 * Purpose:
109 * Initialize the synthesizer library
110 *
111 * Inputs:
112 *  polyphony		- number of voices to play (dynamic memory model only)
113 *	ppLibData		- pointer to data handle variable for this instance
114 *
115 * Outputs:
116 *
117 *----------------------------------------------------------------------------
118*/
119EAS_PUBLIC EAS_RESULT EAS_Init (EAS_DATA_HANDLE *ppEASData);
120
121/*----------------------------------------------------------------------------
122 * EAS_Config()
123 *----------------------------------------------------------------------------
124 * Purpose:
125 * Returns a pointer to a structure containing the configuration options
126 * in this library build.
127 *
128 * Inputs:
129 *
130 * Outputs:
131 *
132 *----------------------------------------------------------------------------
133*/
134EAS_PUBLIC const S_EAS_LIB_CONFIG *EAS_Config (void);
135
136/*----------------------------------------------------------------------------
137 * EAS_Shutdown()
138 *----------------------------------------------------------------------------
139 * Purpose:
140 * Shuts down the library. Deallocates any memory associated with the
141 * synthesizer (dynamic memory model only)
142 *
143 * Inputs:
144 *	pEASData		- handle to data for this instance
145 *
146 * Outputs:
147 *
148 *----------------------------------------------------------------------------
149*/
150EAS_PUBLIC EAS_RESULT EAS_Shutdown (EAS_DATA_HANDLE pEASData);
151
152/*----------------------------------------------------------------------------
153 * EAS_Render()
154 *----------------------------------------------------------------------------
155 * Purpose:
156 * Parse the Midi data and render PCM audio data.
157 *
158 * Inputs:
159 *  pEASData        - buffer for internal EAS data
160 *	pOut			- output buffer pointer
161 *	nNumRequested	- requested num samples to generate
162 *	pnNumGenerated	- actual number of samples generated
163 *
164 * Outputs:
165 *	EAS_SUCCESS if PCM data was successfully rendered
166 *
167 *----------------------------------------------------------------------------
168*/
169EAS_PUBLIC EAS_RESULT EAS_Render (EAS_DATA_HANDLE pEASData, EAS_PCM *pOut, EAS_I32 numRequested, EAS_I32 *pNumGenerated);
170
171/*----------------------------------------------------------------------------
172 * EAS_SetRepeat()
173 *----------------------------------------------------------------------------
174 * Purpose:
175 * Set the selected stream to repeat.
176 *
177 * Inputs:
178 *	pEASData		- handle to data for this instance
179 *	streamHandle	- handle to stream
180 *	repeatCount		- repeat count (0 = no repeat, -1 = repeat forever)
181 *
182 * Outputs:
183 *
184 * Side Effects:
185 *
186 * Notes:
187 *	0 = no repeat
188 *	1 = repeat once, i.e. play through twice
189 *  -1 = repeat forever
190 *----------------------------------------------------------------------------
191*/
192EAS_PUBLIC EAS_RESULT EAS_SetRepeat (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 repeatCount);
193
194/*----------------------------------------------------------------------------
195 * EAS_GetRepeat()
196 *----------------------------------------------------------------------------
197 * Purpose:
198 * Gets the current repeat count for the selected stream.
199 *
200 * Inputs:
201 *	pEASData		- handle to data for this instance
202 *	streamHandle	- handle to stream
203 *	pRrepeatCount	- pointer to variable to hold repeat count
204 *
205 * Outputs:
206 *
207 * Side Effects:
208 *
209 * Notes:
210 *	0 = no repeat
211 *	1 = repeat once, i.e. play through twice
212 *  -1 = repeat forever
213 *----------------------------------------------------------------------------
214*/
215EAS_PUBLIC EAS_RESULT EAS_GetRepeat (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pRepeatCount);
216
217/*----------------------------------------------------------------------------
218 * EAS_SetPlaybackRate()
219 *----------------------------------------------------------------------------
220 * Purpose:
221 * Set the playback rate.
222 *
223 * Inputs:
224 *	pEASData		- handle to data for this instance
225 *	streamHandle	- handle to stream
226 *	rate			- rate (28-bit fractional amount)
227 *
228 * Outputs:
229 *
230 * Side Effects:
231 *
232 *----------------------------------------------------------------------------
233*/
234EAS_PUBLIC EAS_RESULT EAS_SetPlaybackRate (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U32 rate);
235#define MAX_PLAYBACK_RATE	(EAS_U32)(1L << 29)
236#define MIN_PLAYBACK_RATE	(EAS_U32)(1L << 27)
237
238/*----------------------------------------------------------------------------
239 * EAS_SetTransposition)
240 *----------------------------------------------------------------------------
241 * Purpose:
242 * Sets the key tranposition for the synthesizer. Transposes all
243 * melodic instruments by the specified amount. Range is limited
244 * to +/-12 semitones.
245 *
246 * Inputs:
247 *	pEASData		- handle to data for this instance
248 *	streamHandle	- handle to stream
249 *	transposition	- +/-12 semitones
250 *
251 * Outputs:
252 *
253 * Side Effects:
254 *
255 *----------------------------------------------------------------------------
256*/
257EAS_PUBLIC EAS_RESULT EAS_SetTransposition (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 transposition);
258#define MAX_TRANSPOSE		12
259
260/*----------------------------------------------------------------------------
261 * EAS_SetSynthPolyphony()
262 *----------------------------------------------------------------------------
263 * Purpose:
264 * Set the polyphony of the synthesizer. Value must be >= 1 and <= the
265 * maximum number of voices. This function will pin the polyphony
266 * at those limits
267 *
268 * Inputs:
269 * pEASData			- pointer to overall EAS data structure
270 * synthNum			- synthesizer number (0 = onboard, 1 = DSP)
271 * polyphonyCount	- the desired polyphony count
272 *
273 * Outputs:
274 *
275 * Side Effects:
276 *
277 *----------------------------------------------------------------------------
278*/
279EAS_PUBLIC EAS_RESULT EAS_SetSynthPolyphony (EAS_DATA_HANDLE pEASData, EAS_I32 synthNum, EAS_I32 polyphonyCount);
280
281/*----------------------------------------------------------------------------
282 * EAS_GetSynthPolyphony()
283 *----------------------------------------------------------------------------
284 * Purpose:
285 * Returns the current polyphony setting of the synthesizer
286 *
287 * Inputs:
288 * pEASData			- pointer to overall EAS data structure
289 * synthNum			- synthesizer number (0 = onboard, 1 = DSP)
290 * pPolyphonyCount	- pointer to variable to receive polyphony count
291 *
292 * Outputs:
293 *
294 * Side Effects:
295 *
296 *----------------------------------------------------------------------------
297*/
298EAS_PUBLIC EAS_RESULT EAS_GetSynthPolyphony (EAS_DATA_HANDLE pEASData, EAS_I32 synthNum, EAS_I32 *pPolyphonyCount);
299
300/*----------------------------------------------------------------------------
301 * EAS_SetPolyphony()
302 *----------------------------------------------------------------------------
303 * Purpose:
304 * Set the polyphony of the stream. Value must be >= 1 and <= the
305 * maximum number of voices. This function will pin the polyphony
306 * at those limits
307 *
308 * Inputs:
309 * pEASData			- pointer to overall EAS data structure
310 * streamHandle		- handle returned by EAS_OpenFile
311 * polyphonyCount	- the desired polyphony count
312 *
313 * Outputs:
314 *
315 * Side Effects:
316 *
317 *----------------------------------------------------------------------------
318*/
319EAS_PUBLIC EAS_RESULT EAS_SetPolyphony (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 polyphonyCount);
320
321/*----------------------------------------------------------------------------
322 * EAS_GetPolyphony()
323 *----------------------------------------------------------------------------
324 * Purpose:
325 * Returns the current polyphony setting of the stream
326 *
327 * Inputs:
328 * pEASData			- pointer to overall EAS data structure
329 * streamHandle		- handle returned by EAS_OpenFile
330 * pPolyphonyCount	- pointer to variable to receive polyphony count
331 *
332 * Outputs:
333 *
334 * Side Effects:
335 *
336 *----------------------------------------------------------------------------
337*/
338EAS_PUBLIC EAS_RESULT EAS_GetPolyphony (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPolyphonyCount);
339
340/*----------------------------------------------------------------------------
341 * EAS_SetPriority()
342 *----------------------------------------------------------------------------
343 * Purpose:
344 * Set the priority of the stream. Determines which stream's voices
345 * are stolen when there are insufficient voices for all notes.
346 * Value must be in the range of 1-255, lower values are higher
347 * priority. The default priority is 50.
348 *
349 * Inputs:
350 * pEASData			- pointer to overall EAS data structure
351 * streamHandle		- handle returned by EAS_OpenFile
352 * polyphonyCount	- the desired polyphony count
353 *
354 * Outputs:
355 *
356 * Side Effects:
357 *
358 *----------------------------------------------------------------------------
359*/
360EAS_PUBLIC EAS_RESULT EAS_SetPriority (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 priority);
361
362/*----------------------------------------------------------------------------
363 * EAS_GetPriority()
364 *----------------------------------------------------------------------------
365 * Purpose:
366 * Returns the current priority setting of the stream
367 *
368 * Inputs:
369 * pEASData			- pointer to overall EAS data structure
370 * streamHandle		- handle returned by EAS_OpenFile
371 * pPriority		- pointer to variable to receive priority
372 *
373 * Outputs:
374 *
375 * Side Effects:
376 *
377 *----------------------------------------------------------------------------
378*/
379EAS_PUBLIC EAS_RESULT EAS_GetPriority (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPriority);
380
381/*----------------------------------------------------------------------------
382 * EAS_SetVolume()
383 *----------------------------------------------------------------------------
384 * Purpose:
385 * Set the master volume for the mixer. The default volume setting is
386 * 90 (-10 dB). The volume range is 0 to 100 in 1dB increments.
387 *
388 * Inputs:
389 * pEASData			- pointer to overall EAS data structure
390 * volume			- the desired master volume
391 *
392 * Outputs:
393 *
394 *
395 * Side Effects:
396 * overrides any previously set master volume from sysex
397 *
398 *----------------------------------------------------------------------------
399*/
400EAS_PUBLIC EAS_RESULT EAS_SetVolume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 volume);
401
402/*----------------------------------------------------------------------------
403 * EAS_GetVolume()
404 *----------------------------------------------------------------------------
405 * Purpose:
406 * Returns the master volume for the mixer in 1dB increments.
407 *
408 * Inputs:
409 * pEASData			- pointer to overall EAS data structure
410 * volume			- the desired master volume
411 *
412 * Outputs:
413 *
414 *
415 * Side Effects:
416 * overrides any previously set master volume from sysex
417 *
418 *----------------------------------------------------------------------------
419*/
420EAS_PUBLIC EAS_I32 EAS_GetVolume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
421
422/*----------------------------------------------------------------------------
423 * EAS_SetMaxLoad()
424 *----------------------------------------------------------------------------
425 * Purpose:
426 * Sets the maximum workload the parsers will do in a single call to
427 * EAS_Render. The units are currently arbitrary, but should correlate
428 * well to the actual CPU cycles consumed. The primary effect is to
429 * reduce the occasional peaks in CPU cycles consumed when parsing
430 * dense parts of a MIDI score. Setting maxWorkLoad to zero disables
431 * the workload limiting function.
432 *
433 * Inputs:
434 *	pEASData		- handle to data for this instance
435 *	maxLoad			- the desired maximum workload
436 *
437 * Outputs:
438 *
439 * Side Effects:
440 *
441 *----------------------------------------------------------------------------
442*/
443EAS_PUBLIC EAS_RESULT EAS_SetMaxLoad (EAS_DATA_HANDLE pEASData, EAS_I32 maxLoad);
444
445/*----------------------------------------------------------------------------
446 * EAS_SetMaxPCMStreams()
447 *----------------------------------------------------------------------------
448 * Sets the maximum number of PCM streams allowed in parsers that
449 * use PCM streaming.
450 *
451 * Inputs:
452 * pEASData			- pointer to overall EAS data structure
453 * streamHandle		- handle returned by EAS_OpenFile
454 * maxNumStreams	- maximum number of PCM streams
455 *----------------------------------------------------------------------------
456*/
457EAS_PUBLIC EAS_RESULT EAS_SetMaxPCMStreams (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 maxNumStreams);
458
459/*----------------------------------------------------------------------------
460 * EAS_OpenFile()
461 *----------------------------------------------------------------------------
462 * Purpose:
463 * Opens a file for audio playback.
464 *
465 * Inputs:
466 * pEASData			- pointer to overall EAS data structure
467 * locator			- pointer to filename or other locating information
468 * pStreamHandle	- pointer to stream handle variable
469 * memfailvar		- pointer to var to set to indicate memory access failure
470 *
471 * Outputs:
472 *
473 *
474 * Side Effects:
475 *
476 *----------------------------------------------------------------------------
477*/
478EAS_PUBLIC EAS_RESULT EAS_OpenFile (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR locator, EAS_HANDLE *pStreamHandle, int **memfailvar);
479
480#ifdef MMAPI_SUPPORT
481/*----------------------------------------------------------------------------
482 * EAS_MMAPIToneControl()
483 *----------------------------------------------------------------------------
484 * Purpose:
485 * Opens a ToneControl file for audio playback.
486 *
487 * Inputs:
488 * pEASData			- pointer to overall EAS data structure
489 * locator			- pointer to filename or other locating information
490 * pStreamHandle	- pointer to stream handle variable
491 *
492 * Outputs:
493 *
494 *
495 * Side Effects:
496 *
497 *----------------------------------------------------------------------------
498*/
499EAS_PUBLIC EAS_RESULT EAS_MMAPIToneControl (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR locator, EAS_HANDLE *pStreamHandle);
500
501/*----------------------------------------------------------------------------
502 * EAS_GetWaveFmtChunk
503 *----------------------------------------------------------------------------
504 * Helper function to retrieve WAVE file fmt chunk for MMAPI
505 *----------------------------------------------------------------------------
506 * pEASData			- pointer to EAS persistent data object
507 * streamHandle		- stream handle
508 * pFmtChunk		- pointer to pointer to FMT chunk data
509 *----------------------------------------------------------------------------
510*/
511EAS_PUBLIC EAS_RESULT EAS_GetWaveFmtChunk (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_VOID_PTR *ppFmtChunk);
512#endif
513
514/*----------------------------------------------------------------------------
515 * EAS_GetFileType
516 *----------------------------------------------------------------------------
517 * Returns the file type (see eas_types.h for enumerations)
518 *----------------------------------------------------------------------------
519 * pEASData			- pointer to EAS persistent data object
520 * streamHandle		- stream handle
521 * pFileType		- pointer to variable to receive file type
522 *----------------------------------------------------------------------------
523*/
524EAS_PUBLIC EAS_RESULT EAS_GetFileType (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pFileType);
525
526/*----------------------------------------------------------------------------
527 * EAS_ParseMetaData()
528 *----------------------------------------------------------------------------
529 * Purpose:
530 *
531 *
532 * Inputs:
533 * pEASData			- pointer to overall EAS data structure
534 * streamHandle		- file or stream handle
535 * playLength		- pointer to variable to store the play length (in msecs)
536 *
537 * Outputs:
538 *
539 *
540 * Side Effects:
541 *					- resets the parser to the start of the file
542 *----------------------------------------------------------------------------
543*/
544EAS_PUBLIC EAS_RESULT EAS_ParseMetaData (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pPlayLength);
545
546/*----------------------------------------------------------------------------
547 * EAS_Prepare()
548 *----------------------------------------------------------------------------
549 * Purpose:
550 * Prepares the synthesizer to play the file or stream. Parses the first
551 * frame of data from the file and arms the synthesizer.
552 *
553 * Inputs:
554 * pEASData			- pointer to overall EAS data structure
555 * streamHandle		- file or stream handle
556 *
557 * Outputs:
558 *
559 *
560 * Side Effects:
561 *
562 *----------------------------------------------------------------------------
563*/
564EAS_PUBLIC EAS_RESULT EAS_Prepare (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
565
566/*----------------------------------------------------------------------------
567 * EAS_State()
568 *----------------------------------------------------------------------------
569 * Purpose:
570 * Returns the state of an audio file or stream.
571 *
572 * Inputs:
573 * pEASData			- pointer to overall EAS data structure
574 * streamHandle		- file or stream handle
575 *
576 * Outputs:
577 *
578 *
579 * Side Effects:
580 *
581 *----------------------------------------------------------------------------
582*/
583EAS_PUBLIC EAS_RESULT EAS_State (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_STATE *pState);
584
585/*----------------------------------------------------------------------------
586 * EAS_RegisterMetaDataCallback()
587 *----------------------------------------------------------------------------
588 * Purpose:
589 * Registers a metadata callback function for parsed metadata. To
590 * de-register the callback, call this function again with parameter
591 * cbFunc set to NULL.
592 *
593 * Inputs:
594 * pEASData			- pointer to overall EAS data structure
595 * streamHandle		- file or stream handle
596 * cbFunc			- pointer to host callback function
597 * metaDataBuffer	- pointer to metadata buffer
598 * metaDataBufSize	- maximum size of the metadata buffer
599 *
600 * Outputs:
601 *
602 *
603 * Side Effects:
604 *
605 *----------------------------------------------------------------------------
606*/
607EAS_PUBLIC EAS_RESULT EAS_RegisterMetaDataCallback (
608	EAS_DATA_HANDLE pEASData,
609	EAS_HANDLE streamHandle,
610	EAS_METADATA_CBFUNC cbFunc,
611	char *metaDataBuffer,
612	EAS_I32 metaDataBufSize,
613	EAS_VOID_PTR pUserData);
614
615/*----------------------------------------------------------------------------
616 * EAS_GetNoteCount ()
617 *----------------------------------------------------------------------------
618 * Returns the total number of notes played in this stream
619 *
620 * Inputs:
621 * pEASData			- pointer to overall EAS data structure
622 * streamHandle		- file or stream handle
623 * pNoteCount		- pointer to variable to receive note count
624 *----------------------------------------------------------------------------
625*/
626EAS_PUBLIC EAS_RESULT EAS_GetNoteCount (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 *pNoteCount);
627
628/*----------------------------------------------------------------------------
629 * EAS_CloseFile()
630 *----------------------------------------------------------------------------
631 * Purpose:
632 * Closes an audio file or stream. Playback should have either paused or
633 * completed (EAS_State returns EAS_PAUSED or EAS_STOPPED).
634 *
635 * Inputs:
636 * pEASData			- pointer to overall EAS data structure
637 * streamHandle		- file or stream handle
638 *
639 * Outputs:
640 *
641 *
642 * Side Effects:
643 *
644 *----------------------------------------------------------------------------
645*/
646EAS_PUBLIC EAS_RESULT EAS_CloseFile (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
647
648/*----------------------------------------------------------------------------
649 * EAS_OpenMIDIStream()
650 *----------------------------------------------------------------------------
651 * Purpose:
652 * Opens a raw MIDI stream allowing the host to route MIDI cable data directly to the synthesizer
653 *
654 * Inputs:
655 * pEASData			- pointer to overall EAS data structure
656 * pStreamHandle	- pointer to variable to hold file or stream handle
657 * streamHandle		- open stream or NULL for new synthesizer instance
658 *
659 * Outputs:
660 *
661 *
662 * Side Effects:
663 *
664 *----------------------------------------------------------------------------
665*/
666EAS_PUBLIC EAS_RESULT EAS_OpenMIDIStream (EAS_DATA_HANDLE pEASData, EAS_HANDLE *pStreamHandle, EAS_HANDLE streamHandle);
667
668/*----------------------------------------------------------------------------
669 * EAS_WriteMIDIStream()
670 *----------------------------------------------------------------------------
671 * Purpose:
672 * Send data to the MIDI stream device
673 *
674 * Inputs:
675 * pEASData			- pointer to overall EAS data structure
676 * streamHandle		- stream handle
677 * pBuffer			- pointer to buffer
678 * count			- number of bytes to write
679 *
680 * Outputs:
681 *
682 *
683 * Side Effects:
684 *
685 *----------------------------------------------------------------------------
686*/
687EAS_PUBLIC EAS_RESULT EAS_WriteMIDIStream(EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U8 *pBuffer, EAS_I32 count);
688
689/*----------------------------------------------------------------------------
690 * EAS_CloseMIDIStream()
691 *----------------------------------------------------------------------------
692 * Purpose:
693 * Closes a raw MIDI stream
694 *
695 * Inputs:
696 * pEASData			- pointer to overall EAS data structure
697 * streamHandle		- stream handle
698 *
699 * Outputs:
700 *
701 *
702 * Side Effects:
703 *
704 *----------------------------------------------------------------------------
705*/
706EAS_PUBLIC EAS_RESULT EAS_CloseMIDIStream (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
707
708/*----------------------------------------------------------------------------
709 * EAS_Locate()
710 *----------------------------------------------------------------------------
711 * Purpose:
712 * Locate into the file associated with the handle.
713 *
714 * Inputs:
715 * pEASData 		- pointer to overall EAS data structure
716 * streamHandle		- file handle
717 * milliseconds		- playback offset from start of file in milliseconds
718 *
719 * Outputs:
720 *
721 *
722 * Side Effects:
723 * the actual offset will be quantized to the closest update period, typically
724 * a resolution of 5.9ms. Notes that are started prior to this time will not
725 * sound. Any notes currently playing will be shut off.
726 *
727 *----------------------------------------------------------------------------
728*/
729EAS_PUBLIC EAS_RESULT EAS_Locate (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 milliseconds, EAS_BOOL offset);
730
731/*----------------------------------------------------------------------------
732 * EAS_GetRenderTime()
733 *----------------------------------------------------------------------------
734 * Purpose:
735 * Returns the current playback offset
736 *
737 * Inputs:
738 * pEASData			- pointer to overall EAS data structure
739 *
740 * Outputs:
741 * Gets the render time clock in msecs.
742 *
743 * Side Effects:
744 *
745 *----------------------------------------------------------------------------
746*/
747EAS_PUBLIC EAS_RESULT EAS_GetRenderTime (EAS_DATA_HANDLE pEASData, EAS_I32 *pTime);
748
749/*----------------------------------------------------------------------------
750 * EAS_GetLocation()
751 *----------------------------------------------------------------------------
752 * Purpose:
753 * Returns the current playback offset
754 *
755 * Inputs:
756 * pEASData			- pointer to overall EAS data structure
757 * streamHandle		- file handle
758 *
759 * Outputs:
760 * The offset in milliseconds from the start of the current sequence, quantized
761 * to the nearest update period. Actual resolution is typically 5.9 ms.
762 *
763 * Side Effects:
764 *
765 *----------------------------------------------------------------------------
766*/
767EAS_PUBLIC EAS_RESULT EAS_GetLocation (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_I32 *pTime);
768
769/*----------------------------------------------------------------------------
770 * EAS_Pause()
771 *----------------------------------------------------------------------------
772 * Purpose:
773 * Pauses the playback of the data associated with this handle. The audio
774 * is gracefully ramped down to prevent clicks and pops. It may take several
775 * buffers of audio before the audio is muted.
776 *
777 * Inputs:
778 * psEASData		- pointer to overall EAS data structure
779 * streamHandle		- file or stream handle
780 *
781 * Outputs:
782 *
783 *
784 * Side Effects:
785 *
786 *
787 *----------------------------------------------------------------------------
788*/
789EAS_PUBLIC EAS_RESULT EAS_Pause (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
790
791/*----------------------------------------------------------------------------
792 * EAS_Resume()
793 *----------------------------------------------------------------------------
794 * Purpose:
795 * Resumes the playback of the data associated with this handle. The audio
796 * is gracefully ramped up to prevent clicks and pops.
797 *
798 * Inputs:
799 * psEASData		- pointer to overall EAS data structure
800 * streamHandle		- file or stream handle
801 *
802 * Outputs:
803 *
804 *
805 * Side Effects:
806 *
807 *
808 *----------------------------------------------------------------------------
809*/
810EAS_PUBLIC EAS_RESULT EAS_Resume (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle);
811
812/*----------------------------------------------------------------------------
813 * EAS_GetParameter()
814 *----------------------------------------------------------------------------
815 * Purpose:
816 * Set the parameter of a module. See E_MODULES for a list of modules
817 * and the header files of the modules for a list of parameters.
818 *
819 * Inputs:
820 * psEASData		- pointer to overall EAS data structure
821 * module			- enumerated module number
822 * param			- enumerated parameter number
823 * pValue			- pointer to variable to receive parameter value
824 *
825 * Outputs:
826 *
827 *
828 * Side Effects:
829 *
830 *
831 *----------------------------------------------------------------------------
832*/
833EAS_PUBLIC EAS_RESULT EAS_GetParameter (EAS_DATA_HANDLE pEASData, EAS_I32 module, EAS_I32 param, EAS_I32 *pValue);
834
835/*----------------------------------------------------------------------------
836 * EAS_SetParameter()
837 *----------------------------------------------------------------------------
838 * Purpose:
839 * Set the parameter of a module. See E_MODULES for a list of modules
840 * and the header files of the modules for a list of parameters.
841 *
842 * Inputs:
843 * psEASData		- pointer to overall EAS data structure
844 * handle			- file or stream handle
845 * module			- enumerated module number
846 * param			- enumerated parameter number
847 * value			- new parameter value
848 *
849 * Outputs:
850 *
851 *
852 * Side Effects:
853 *
854 *
855 *----------------------------------------------------------------------------
856*/
857EAS_PUBLIC EAS_RESULT EAS_SetParameter (EAS_DATA_HANDLE pEASData, EAS_I32 module, EAS_I32 param, EAS_I32 value);
858
859#ifdef _METRICS_ENABLED
860/*----------------------------------------------------------------------------
861 * EAS_MetricsReport()
862 *----------------------------------------------------------------------------
863 * Purpose:
864 * Displays the current metrics through the EAS_Report interface.
865 *
866 * Inputs:
867 * pEASData				- instance data handle
868 *
869 * Outputs:
870 *
871 *
872 * Side Effects:
873 *
874 *----------------------------------------------------------------------------
875*/
876EAS_PUBLIC EAS_RESULT EAS_MetricsReport (EAS_DATA_HANDLE pEASData);
877
878/*----------------------------------------------------------------------------
879 * EAS_MetricsReset()
880 *----------------------------------------------------------------------------
881 * Purpose:
882 * Displays the current metrics through the EAS_Report interface.
883 *
884 * Inputs:
885 * pEASData				- instance data handle
886 *
887 * Outputs:
888 *
889 *
890 * Side Effects:
891 *
892 *----------------------------------------------------------------------------
893*/
894EAS_PUBLIC EAS_RESULT EAS_MetricsReset (EAS_DATA_HANDLE pEASData);
895#endif
896
897/*----------------------------------------------------------------------------
898 * EAS_SetSoundLibrary()
899 *----------------------------------------------------------------------------
900 * Purpose:
901 * Sets the location of the sound library.
902 *
903 * Inputs:
904 * pEASData				- instance data handle
905 * streamHandle			- file or stream handle
906 * pSoundLib			- pointer to sound library
907 *
908 * Outputs:
909 *
910 *
911 * Side Effects:
912 *
913 *----------------------------------------------------------------------------
914*/
915EAS_PUBLIC EAS_RESULT EAS_SetSoundLibrary (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_SNDLIB_HANDLE pSndLib);
916
917/*----------------------------------------------------------------------------
918 * EAS_SetHeaderSearchFlag()
919 *----------------------------------------------------------------------------
920 * By default, when EAS_OpenFile is called, the parsers check the
921 * first few bytes of the file looking for a specific header. Some
922 * mobile devices may add a header to the start of a file, which
923 * will prevent the parser from recognizing the file. If the
924 * searchFlag is set to EAS_TRUE, the parser will search the entire
925 * file looking for the header. This may enable EAS to recognize
926 * some files that it would ordinarily reject. The negative is that
927 * it make take slightly longer to process the EAS_OpenFile request.
928 *
929 * Inputs:
930 * pEASData				- instance data handle
931 * searchFlag			- search flag (EAS_TRUE or EAS_FALSE)
932 *----------------------------------------------------------------------------
933*/
934EAS_PUBLIC EAS_RESULT EAS_SetHeaderSearchFlag (EAS_DATA_HANDLE pEASData, EAS_BOOL searchFlag);
935
936/*----------------------------------------------------------------------------
937 * EAS_SetPlayMode()
938 *----------------------------------------------------------------------------
939 * Some file formats support special play modes, such as iMode partial
940 * play mode. This call can be used to change the play mode. The
941 * default play mode (usually straight playback) is always zero.
942 *
943 * Inputs:
944 * pEASData				- instance data handle
945 * handle				- file or stream handle
946 * playMode				- play mode (see eas_types.h for enumerations)
947 *----------------------------------------------------------------------------
948*/
949EAS_PUBLIC EAS_RESULT EAS_SetPlayMode (EAS_DATA_HANDLE pEASData, EAS_HANDLE pStream, EAS_I32 playMode);
950
951#ifdef DLS_SYNTHESIZER
952/*----------------------------------------------------------------------------
953 * EAS_LoadDLSCollection()
954 *----------------------------------------------------------------------------
955 * Purpose:
956 * Downloads a DLS collection
957 *
958 * Inputs:
959 * pEASData				- instance data handle
960 * streamHandle			- file or stream handle
961 * locator				- file locator
962 *
963 * Outputs:
964 *
965 *
966 * Side Effects:
967 * May overlay instruments in the GM sound set
968 *
969 *----------------------------------------------------------------------------
970*/
971EAS_PUBLIC EAS_RESULT EAS_LoadDLSCollection (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_FILE_LOCATOR locator);
972#endif
973
974/*----------------------------------------------------------------------------
975 * EAS_SetFrameBuffer()
976 *----------------------------------------------------------------------------
977 * Purpose:
978 * Sets the frame buffer pointer passed to the IPC communications functions
979 *
980 * Inputs:
981 * pEASData				- instance data handle
982 * locator				- file locator
983 *
984 * Outputs:
985 *
986 *
987 * Side Effects:
988 * May overlay instruments in the GM sound set
989 *
990 *----------------------------------------------------------------------------
991*/
992EAS_PUBLIC EAS_RESULT EAS_SetFrameBuffer (EAS_DATA_HANDLE pEASData, EAS_FRAME_BUFFER_HANDLE pFrameBuffer);
993
994#ifdef EXTERNAL_AUDIO
995/*----------------------------------------------------------------------------
996 * EAS_RegExtAudioCallback()
997 *----------------------------------------------------------------------------
998 * Purpose:
999 * Registers callback functions for audio events.
1000 *
1001 * Inputs:
1002 * pEASData			- pointer to overall EAS data structure
1003 * streamHandle		- file or stream handle
1004 * cbProgChgFunc	- pointer to host callback function for program change
1005 * cbEventFunc		- pointer to host callback functio for note events
1006 *
1007 * Outputs:
1008 *
1009 *
1010 * Side Effects:
1011 *
1012 *----------------------------------------------------------------------------
1013*/
1014EAS_PUBLIC EAS_RESULT EAS_RegExtAudioCallback (EAS_DATA_HANDLE pEASData,
1015	EAS_HANDLE streamHandle,
1016	EAS_VOID_PTR pInstData,
1017	EAS_EXT_PRG_CHG_FUNC cbProgChgFunc,
1018	EAS_EXT_EVENT_FUNC cbEventFunc);
1019
1020/*----------------------------------------------------------------------------
1021 * EAS_GetMIDIControllers()
1022 *----------------------------------------------------------------------------
1023 * Purpose:
1024 * Returns the current state of MIDI controllers on the requested channel.
1025 *
1026 * Inputs:
1027 * pEASData			- pointer to overall EAS data structure
1028 * streamHandle		- file or stream handle
1029 * pControl			- pointer to structure to receive data
1030 *
1031 * Outputs:
1032 *
1033 *
1034 * Side Effects:
1035 *
1036 *----------------------------------------------------------------------------
1037*/
1038EAS_PUBLIC EAS_RESULT EAS_GetMIDIControllers (EAS_DATA_HANDLE pEASData, EAS_HANDLE streamHandle, EAS_U8 channel, S_MIDI_CONTROLLERS *pControl);
1039#endif
1040
1041/*----------------------------------------------------------------------------
1042 * EAS_SearchFile
1043 *----------------------------------------------------------------------------
1044 * Search file for specific sequence starting at current file
1045 * position. Returns offset to start of sequence.
1046 *
1047 * Inputs:
1048 * pEASData			- pointer to EAS persistent data object
1049 * fileHandle		- file handle
1050 * searchString		- pointer to search sequence
1051 * len				- length of search sequence
1052 * pOffset			- pointer to variable to store offset to sequence
1053 *
1054 * Returns EAS_EOF if end-of-file is reached
1055 *----------------------------------------------------------------------------
1056*/
1057EAS_RESULT EAS_SearchFile (EAS_DATA_HANDLE pEASData, EAS_FILE_HANDLE fileHandle, const EAS_U8 *searchString, EAS_I32 len, EAS_I32 *pOffset);
1058
1059#ifdef __cplusplus
1060} /* end extern "C" */
1061#endif
1062
1063#endif /* #ifndef _EAS_H */
1064