1 /*----------------------------------------------------------------------------
2  *
3  * File:
4  * jet.h
5  *
6  * Contents and purpose:
7  * Public interface for JET sound engine
8  *
9  * Copyright (c) 2006 Sonic Network Inc.
10 
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  *----------------------------------------------------------------------------
23  * Revision Control:
24  *   $Revision: 554 $
25  *   $Date: 2007-02-02 11:06:10 -0800 (Fri, 02 Feb 2007) $
26  *----------------------------------------------------------------------------
27 */
28 
29 #ifndef _JET_H
30 #define _JET_H
31 
32 #include "eas_types.h"
33 #include "eas.h"
34 
35 /* for C++ linkage */
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* opaque handle types for JET interface */
41 typedef struct s_jet_data_tag *JET_DATA_HANDLE;
42 
43 typedef struct s_jet_config_tag
44 {
45     EAS_U8      appEventRangeLow;
46     EAS_U8      appEventRangeHigh;
47 } S_JET_CONFIG;
48 
49 typedef struct s_jet_status_tag
50 {
51     EAS_INT     currentUserID;
52     EAS_INT     segmentRepeatCount;
53     EAS_INT     numQueuedSegments;
54     EAS_BOOL    paused;
55     EAS_I32     location;
56     EAS_U8      currentPlayingSegment;
57     EAS_U8      currentQueuedSegment;
58 } S_JET_STATUS;
59 
60 typedef struct s_jet_event_tag
61 {
62     EAS_U8      segment;
63     EAS_U8      channel;
64     EAS_U8      track;
65     EAS_U8      controller;
66     EAS_U8      value;
67 } S_JET_EVENT;
68 
69 /*----------------------------------------------------------------------------
70  * JET_Init()
71  *----------------------------------------------------------------------------
72  * Initializes the JET library, allocates memory, etc. Call
73  * JET_Shutdown to de-allocate memory. Pass NULL for pConfig
74  * to use defaults. If passing config data, configSize should be
75  * sizeof(S_JET_CONFIG). This allows for future expansion of the
76  * config structure while maintaining compatibility.
77  *----------------------------------------------------------------------------
78 */
79 EAS_PUBLIC EAS_RESULT JET_Init (EAS_DATA_HANDLE easHandle, const S_JET_CONFIG *pConfig, EAS_INT configSize);
80 
81 /*----------------------------------------------------------------------------
82  * JET_Shutdown()
83  *----------------------------------------------------------------------------
84  * Frees any memory used by the JET library
85  *----------------------------------------------------------------------------
86 */
87 EAS_PUBLIC EAS_RESULT JET_Shutdown (EAS_DATA_HANDLE easHandle);
88 
89 /*----------------------------------------------------------------------------
90  * JET_OpenFile()
91  *----------------------------------------------------------------------------
92  * Opens a JET content file for playback
93  *----------------------------------------------------------------------------
94 */
95 EAS_PUBLIC EAS_RESULT JET_OpenFile (EAS_DATA_HANDLE easHandle, EAS_FILE_LOCATOR locator);
96 
97 /*----------------------------------------------------------------------------
98  * JET_GetAppData()
99  *----------------------------------------------------------------------------
100  * Returns location and size of application data in the JET file
101  *----------------------------------------------------------------------------
102 */
103 EAS_RESULT JET_GetAppData (EAS_DATA_HANDLE easHandle, EAS_I32 *pAppDataOffset, EAS_I32 *pAppDataSize);
104 
105 /*----------------------------------------------------------------------------
106  * JET_CloseFile()
107  *----------------------------------------------------------------------------
108  * Closes a JET content file and releases associated resources
109  *----------------------------------------------------------------------------
110 */
111 EAS_PUBLIC EAS_RESULT JET_CloseFile (EAS_DATA_HANDLE easHandle);
112 
113 /*----------------------------------------------------------------------------
114  * JET_Status()
115  *----------------------------------------------------------------------------
116  * Returns current status
117  *----------------------------------------------------------------------------
118 */
119 EAS_PUBLIC EAS_RESULT JET_Status (EAS_DATA_HANDLE easHandle, S_JET_STATUS *pStatus);
120 
121 /*----------------------------------------------------------------------------
122  * JET_GetEvent()
123  *----------------------------------------------------------------------------
124  * Checks for application events
125  *----------------------------------------------------------------------------
126 */
127 EAS_PUBLIC EAS_BOOL JET_GetEvent (EAS_DATA_HANDLE easHandle, EAS_U32 *pEventRaw, S_JET_EVENT *pEvent);
128 
129 /*----------------------------------------------------------------------------
130  * JET_ParseEvent()
131  *----------------------------------------------------------------------------
132  * Returns current status
133  *----------------------------------------------------------------------------
134 */
135 EAS_PUBLIC void JET_ParseEvent (EAS_U32 event, S_JET_EVENT *pEvent);
136 
137 /*----------------------------------------------------------------------------
138  * JET_QueueSegment()
139  *----------------------------------------------------------------------------
140  * Queue a segment for playback
141  *----------------------------------------------------------------------------
142 */
143 EAS_PUBLIC EAS_RESULT JET_QueueSegment (EAS_DATA_HANDLE easHandle, EAS_INT segmentNum, EAS_INT libNum, EAS_INT repeatCount, EAS_INT transpose, EAS_U32 muteFlags, EAS_U8 userID);
144 
145 /*----------------------------------------------------------------------------
146  * JET_Play()
147  *----------------------------------------------------------------------------
148  * Starts playback of the file
149  *----------------------------------------------------------------------------
150 */
151 EAS_PUBLIC EAS_RESULT JET_Play (EAS_DATA_HANDLE easHandle);
152 
153 /*----------------------------------------------------------------------------
154  * JET_Pause()
155  *----------------------------------------------------------------------------
156  * Pauses playback of the file
157  *----------------------------------------------------------------------------
158 */
159 EAS_PUBLIC EAS_RESULT JET_Pause (EAS_DATA_HANDLE easHandle);
160 
161 /*----------------------------------------------------------------------------
162  * JET_SetMuteFlags()
163  *----------------------------------------------------------------------------
164  * Change the state of the mute flags
165  *----------------------------------------------------------------------------
166 */
167 EAS_PUBLIC EAS_RESULT JET_SetMuteFlags (EAS_DATA_HANDLE easHandle, EAS_U32 muteFlags, EAS_BOOL sync);
168 
169 /*----------------------------------------------------------------------------
170  * JET_SetMuteFlag()
171  *----------------------------------------------------------------------------
172  * Change the state of a single mute flag
173  *----------------------------------------------------------------------------
174 */
175 EAS_PUBLIC EAS_RESULT JET_SetMuteFlag (EAS_DATA_HANDLE easHandle, EAS_INT trackNum, EAS_BOOL muteFlag, EAS_BOOL sync);
176 
177 /*----------------------------------------------------------------------------
178  * JET_TriggerClip()
179  *----------------------------------------------------------------------------
180  * Unmute a track and then mute it when it is complete
181  *----------------------------------------------------------------------------
182 */
183 EAS_PUBLIC EAS_RESULT JET_TriggerClip (EAS_DATA_HANDLE easHandle, EAS_INT clipID);
184 
185 /*----------------------------------------------------------------------------
186  * JET_Clear_Queue()
187  *----------------------------------------------------------------------------
188  * Clears all segments in the queue
189  *----------------------------------------------------------------------------
190 */
191 EAS_PUBLIC EAS_RESULT JET_Clear_Queue (EAS_DATA_HANDLE easHandle);
192 
193 #ifdef __cplusplus
194 } /* end extern "C" */
195 #endif
196 
197 
198 #endif
199 
200