doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
eaxac3.h
Go to the documentation of this file.
1 /************************************************************************************************
2 /
3 / EAX-AC3 Open AL Extension Header file
4 /
5 / Description : The EAX-AC3 extension to Open AL provides a way to playback Dolby Digital AC3
6 / files on systems equipped with a SB Live! card. The packaged AC3 data is output
7 / via the MMSYSTEM Wave device.
8 / If a SB Live! 5.1 card is installed then the AC3 data will be decoded by the
9 / audio card.
10 / If a legacy SB Live! card is installed then the AC3 data will be sent directly
11 / to the S/PDIF Out.
12 / The API supports multiple EAX-AC3 devices, and multiple AC3 streams. However
13 / the current implementation provides one EAX-AC3 device capable of playing
14 / one AC3 Stream at a time.
15 /
16 / Programmer : Daniel Peacock Creative Labs, Inc February 2001
17 /
18 /************************************************************************************************/
19 
20 #ifndef _EAXAC3_H_
21 #define _EAXAC3_H_
22 
23 // Do not define the symbol EAXAC3_EXPORTS in any projects that use the EAX-AC3 Open AL Extension
24 #ifdef EAXAC3_EXPORTS
25 #define EAXAC3_API __declspec(dllexport)
26 #else
27 #define EAXAC3_API __declspec(dllimport)
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef _HRESULT_DEFINED
35 #define _HRESULT_DEFINED
36 typedef signed long HRESULT;
37 #endif
38 
39 enum POSFORMAT { MILLISECONDS, BYTES, AC3FRAMES };
40 
41 enum SOURCE { AC3FILE, MEMORY };
42 
43 // Success Codes
44 #define EAXAC3_OK 0
45 #define EAXAC3_ALREADYPLAYING 1
46 #define EAXAC3_EOF 2
47 
48 // Error Codes
49 #define EAXAC3ERR_UNABLETOOPENEAXAC3DEVICE -1
50 #define EAXAC3ERR_WAVEOUTPREPAREHEADERFAILURE -2
51 #define EAXAC3ERR_OUTOFMEMORY -3
52 #define EAXAC3ERR_FILENOTFOUND -4
53 #define EAXAC3ERR_AC3FILETOBIG -5
54 #define EAXAC3ERR_AC3FRAMENOTFOUND -6
55 #define EAXAC3ERR_AC3NOTAT48KHZ -7
56 #define EAXAC3ERR_INVALIDAC3FRAME -8
57 #define EAXAC3ERR_AC3FILENOTOPEN -9
58 #define EAXAC3ERR_BUFFERNOTMULTIPLEOFAC3FRAMESIZE -10
59 #define EAXAC3ERR_WAVEOUTERROR -11
60 #define EAXAC3ERR_FAILEDTOCREATEEVENT -12
61 #define EAXAC3ERR_EAXAC3DEVICENOTOPEN -13
62 #define EAXAC3ERR_AC3STREAMALREADYOPEN -14
63 #define EAXAC3ERR_POSITIONOUTOFRANGE -15
64 #define EAXAC3ERR_NOTATSTARTOFAC3FRAME -16
65 #define EAXAC3ERR_AC3STREAMNOTOPEN -17
66 #define EAXAC3ERR_SETPOSITIONONLYWORKSONAC3FILES -18
67 #define EAXAC3ERR_WRITEDATAONLYWORKSWITHMEMORYSTREAMS -19
68 #define EAXAC3ERR_INVALIDPARAMETER -20
69 #define EAXAC3ERR_NOTENOUGHAC3DATAINAC3DATABUFFER -21
70 #define EAXAC3ERR_NOTENOUGHDATA -22
71 #define EAXAC3ERR_EAXAC3DEVICEALREADYOPEN -23
72 #define EAXAC3ERR_EAXAC3DEVICENOTFOUND -24
73 #define EAXAC3ERR_UNSUPPORTED -25
74 #define EAXAC3ERR_FAILEDTOCREATEFNTABLE -26
75 
76 #define DEFAULTEAXAC3DEVICE 0
77 
78 #define ENTIREBUFFER 0
79 #define FROMWRITECURSOR 1
80 
81 #define LOOPING 1
82 
83 #define ENDOFDATA 1
84 
85 typedef unsigned int EAXAC3HANDLE;
86 
87 typedef unsigned int AC3STREAM;
88 
89 // Callback function
90 typedef void (__stdcall *LPAC3CALLBACK)(AC3STREAM AC3Stream, int msg);
91 
92 // Callback messages
93 #define EAXAC3NEEDMOREDATA 0
94 #define EAXAC3REACHEDEND 1
95 
96 typedef struct
97 {
98  unsigned int nNumOfAC3Frames;
99  unsigned int nAC3FrameSize;
100  unsigned int nSizeOfFile;
101  unsigned int nDuration;
102  unsigned int nFrequency;
103 } AC3FILEINFO, *LPAC3FILEINFO;
104 
105 #define UNKNOWN 1
106 #define SPDIFPASSTHRU 2
107 #define FULLDECODE 4
108 
109 typedef struct
110 {
111  char szDeviceName[256];
112  unsigned int uFlags;
113  unsigned int uStreams;
114  unsigned int uReserved;
115 } EAXAC3DEVICEINFO, *LPEAXAC3DEVICEINFO;
116 
117 // Function typedefs
118 
119 typedef int (*LPEAXAC3QUERYNUMBEROFDEVICES) (void);
120 typedef HRESULT (*LPEAXAC3QUERYFILE) (char *, LPAC3FILEINFO, int);
121 typedef HRESULT (*LPEAXAC3QUERYMEMORY) (char *, int, LPAC3FILEINFO, int);
122 typedef int (*LPEAXAC3QUERYNOOFFRAMESREQFORPLAYBACK) (AC3STREAM);
123 typedef HRESULT (*LPEAXAC3OPENPLAYBACKDEVICE) (EAXAC3HANDLE);
124 typedef HRESULT (*LPEAXAC3CLOSEPLAYBACKDEVICE) (EAXAC3HANDLE);
125 typedef HRESULT (*LPEAXAC3QUERYDEVICECAPS) (EAXAC3HANDLE, LPEAXAC3DEVICEINFO, int);
126 typedef HRESULT (*LPEAXAC3GETPOSITION) (AC3STREAM, enum POSFORMAT, int *);
127 typedef HRESULT (*LPEAXAC3SETFILEPOSITION) (AC3STREAM, enum POSFORMAT, int);
128 typedef HRESULT (*LPEAXAC3OPENSTREAM) (EAXAC3HANDLE, AC3STREAM *, LPAC3CALLBACK, char *, enum SOURCE);
129 typedef HRESULT (*LPEAXAC3CLOSESTREAM) (AC3STREAM);
130 typedef HRESULT (*LPEAXAC3PREPLAYSTREAM) (AC3STREAM);
131 typedef HRESULT (*LPEAXAC3PLAYSTREAM) (AC3STREAM, int);
132 typedef HRESULT (*LPEAXAC3STOPSTREAM) (AC3STREAM);
133 typedef HRESULT (*LPEAXAC3PAUSESTREAM) (AC3STREAM);
134 typedef HRESULT (*LPEAXAC3RESUMESTREAM) (AC3STREAM);
135 typedef HRESULT (*LPEAXAC3LOCKBUFFER) (AC3STREAM, unsigned long, void **, unsigned long *, void **,
136  unsigned long *, unsigned long);
137 typedef HRESULT (*LPEAXAC3UNLOCKBUFFER) (AC3STREAM, void *, unsigned long, void *, unsigned long, int);
138 typedef HRESULT (*LPEAXAC3SETPLAYBACKMODE) (EAXAC3HANDLE, unsigned int);
139 typedef char * (*LPEAXAC3GETERRORSTRING) (HRESULT, char *, int);
140 typedef HRESULT (*LPEAXAC3GETLASTERROR) (HRESULT *);
141 
142 // Function table declaration
143 typedef struct
144 {
145  LPEAXAC3QUERYNUMBEROFDEVICES EAXAC3QueryNumberOfDevices;
146  LPEAXAC3QUERYFILE EAXAC3QueryFile;
147  LPEAXAC3QUERYMEMORY EAXAC3QueryMemory;
148  LPEAXAC3QUERYNOOFFRAMESREQFORPLAYBACK EAXAC3QueryNoOfFramesReqForPlayback;
149  LPEAXAC3OPENPLAYBACKDEVICE EAXAC3OpenPlaybackDevice;
150  LPEAXAC3CLOSEPLAYBACKDEVICE EAXAC3ClosePlaybackDevice;
151  LPEAXAC3QUERYDEVICECAPS EAXAC3QueryDeviceCaps;
152  LPEAXAC3GETPOSITION EAXAC3GetPosition;
153  LPEAXAC3SETFILEPOSITION EAXAC3SetFilePosition;
154  LPEAXAC3OPENSTREAM EAXAC3OpenStream;
155  LPEAXAC3CLOSESTREAM EAXAC3CloseStream;
156  LPEAXAC3PREPLAYSTREAM EAXAC3PrePlayStream;
157  LPEAXAC3PLAYSTREAM EAXAC3PlayStream;
158  LPEAXAC3STOPSTREAM EAXAC3StopStream;
159  LPEAXAC3PAUSESTREAM EAXAC3PauseStream;
160  LPEAXAC3RESUMESTREAM EAXAC3ResumeStream;
161  LPEAXAC3LOCKBUFFER EAXAC3LockBuffer;
162  LPEAXAC3UNLOCKBUFFER EAXAC3UnLockBuffer;
163  LPEAXAC3SETPLAYBACKMODE EAXAC3SetPlaybackMode;
164  LPEAXAC3GETERRORSTRING EAXAC3GetErrorString;
165  LPEAXAC3GETLASTERROR EAXAC3GetLastError;
166 } EAXAC3FNTABLE, *LPEAXAC3FNTABLE;
167 
168 
169 #ifndef OPENAL
170 typedef EAXAC3_API HRESULT (*LPEAXAC3GETFUNCTIONTABLE) (LPEAXAC3FNTABLE);
171 #else
172 typedef ALboolean (*LPALEAXAC3GETFUNCTIONTABLE) (LPEAXAC3FNTABLE);
173 #endif
174 
175 // Functions exposed in the DLL
176 
177 EAXAC3_API HRESULT EAXAC3GetFunctionTable(LPEAXAC3FNTABLE lpEAXAC3FnTable);
178 
179 EAXAC3_API int EAXAC3QueryNumberOfDevices();
180 
181 EAXAC3_API HRESULT EAXAC3QueryFile(char *szAC3Filename, LPAC3FILEINFO lpAC3Caps, int nSizeOfAC3FileInfoStruct);
182 
183 EAXAC3_API HRESULT EAXAC3QueryMemory(char *lpBuffer, int nSizeOfBuffer, LPAC3FILEINFO lpAC3FileInfo,
184  int nSizeOfAC3FileInfoStruct);
185 
186 EAXAC3_API int EAXAC3QueryNoOfFramesReqForPlayback(AC3STREAM AC3Stream);
187 
188 EAXAC3_API HRESULT EAXAC3OpenPlaybackDevice(EAXAC3HANDLE EAXAC3Handle);
189 
190 EAXAC3_API HRESULT EAXAC3ClosePlaybackDevice(EAXAC3HANDLE EAXAC3Handle);
191 
192 EAXAC3_API HRESULT EAXAC3QueryDeviceCaps(EAXAC3HANDLE EAXAC3Handle, LPEAXAC3DEVICEINFO lpEAXAC3DeviceInfo,
193  int nSizeOfAC3DeviceInfoStruct);
194 
195 EAXAC3_API HRESULT EAXAC3GetPosition(AC3STREAM AC3Stream, enum POSFORMAT posFormat, int *lpAmount);
196 
197 EAXAC3_API HRESULT EAXAC3SetFilePosition(AC3STREAM AC3Stream, enum POSFORMAT posFormat, int nAmount);
198 
199 EAXAC3_API HRESULT EAXAC3OpenStream(EAXAC3HANDLE EAXAC3Handle, AC3STREAM *lpAC3Stream,
200  LPAC3CALLBACK pAC3CallbackFn, char *szAC3Filename, enum SOURCE src);
201 
202 EAXAC3_API HRESULT EAXAC3CloseStream(AC3STREAM AC3Stream);
203 
204 EAXAC3_API HRESULT EAXAC3PrePlayStream(AC3STREAM AC3Stream);
205 
206 EAXAC3_API HRESULT EAXAC3PlayStream(AC3STREAM AC3Stream, int nLooping);
207 
208 EAXAC3_API HRESULT EAXAC3StopStream(AC3STREAM AC3Stream);
209 
210 EAXAC3_API HRESULT EAXAC3PauseStream(AC3STREAM AC3Stream);
211 
212 EAXAC3_API HRESULT EAXAC3ResumeStream(AC3STREAM AC3Stream);
213 
214 EAXAC3_API HRESULT EAXAC3LockBuffer(AC3STREAM AC3Stream, unsigned long ulBytes, void **ppvPointer1,
215  unsigned long *pdwBytes1, void **ppvPointer2, unsigned long *pdwBytes2,
216  unsigned long ulFlags);
217 
218 EAXAC3_API HRESULT EAXAC3UnLockBuffer(AC3STREAM AC3Stream, void *pvPointer1, unsigned long ulSize1,
219  void *pvPointer2, unsigned long ulSize2, int nFinished);
220 
221 EAXAC3_API HRESULT EAXAC3SetPlaybackMode(EAXAC3HANDLE EAXAC3Handle, unsigned int ulPlayMode);
222 
223 EAXAC3_API char * EAXAC3GetErrorString(HRESULT hr, char *szErrorString, int nSizeOfErrorString);
224 
225 EAXAC3_API HRESULT EAXAC3GetLastError(HRESULT *hr);
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif
232 
case const int
Definition: Callbacks.cpp:52
GLuint src
Definition: glext.h:5390
char ALboolean
OpenAL cross platform audio library Copyright (C) 1999-2000 by authors.
Definition: altypes.h:30
DWORD UINT uFlags
Definition: wglext.h:572
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
LPDIRECTSOUND IUnknown FAR *typedef HRESULT(FAR PASCAL *LPEAXDIRECTSOUNDCREATE)(GUID *