Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# eaxac3.h

Go to the documentation of this file.

    00001 /************************************************************************************************
    00002 /
    00003 / EAX-AC3 Open AL Extension Header file
    00004 /
    00005 / Description : The EAX-AC3 extension to Open AL provides a way to playback Dolby Digital AC3
    00006 /               files on systems equipped with a SB Live! card.  The packaged AC3 data is output
    00007 /               via the MMSYSTEM Wave device.
    00008 /               If a SB Live! 5.1 card is installed then the AC3 data will be decoded by the
    00009 /               audio card.
    00010 /               If a legacy SB Live! card is installed then the AC3 data will be sent directly
    00011 /               to the S/PDIF Out.
    00012 /               The API supports multiple EAX-AC3 devices, and multiple AC3 streams. However
    00013 /               the current implementation provides one EAX-AC3 device capable of playing
    00014 /               one AC3 Stream at a time.
    00015 /
    00016 / Programmer  : Daniel Peacock      Creative Labs, Inc  February 2001
    00017 /
    00018 /************************************************************************************************/
    00019
    00020 #ifndef _EAXAC3_H_
    00021 #define _EAXAC3_H_
    00022
    00023 // Do not define the symbol EAXAC3_EXPORTS in any projects that use the EAX-AC3 Open AL Extension
    00024 #ifdef EAXAC3_EXPORTS
    00025 #define EAXAC3_API __declspec(dllexport)
    00026 #else
    00027 #define EAXAC3_API __declspec(dllimport)
    00028 #endif
    00029
    00030 #ifdef __cplusplus
    00031 extern "C" {
    00032 #endif
    00033
    00034 #ifndef _HRESULT_DEFINED
    00035 #define _HRESULT_DEFINED
    00036 typedef signed long HRESULT;
    00037 #endif
    00038
    00039 enum POSFORMAT { MILLISECONDS, BYTES, AC3FRAMES };
    00040
    00041 enum SOURCE { AC3FILE, MEMORY };
    00042
    00043 // Success Codes
    00044 #define EAXAC3_OK                                       0
    00045 #define EAXAC3_ALREADYPLAYING                           1
    00046 #define EAXAC3_EOF                                      2
    00047
    00048 // Error Codes
    00049 #define EAXAC3ERR_UNABLETOOPENEAXAC3DEVICE               -1
    00050 #define EAXAC3ERR_WAVEOUTPREPAREHEADERFAILURE            -2
    00051 #define EAXAC3ERR_OUTOFMEMORY                            -3
    00052 #define EAXAC3ERR_FILENOTFOUND                           -4
    00053 #define EAXAC3ERR_AC3FILETOBIG                           -5
    00054 #define EAXAC3ERR_AC3FRAMENOTFOUND                       -6
    00055 #define EAXAC3ERR_AC3NOTAT48KHZ                          -7
    00056 #define EAXAC3ERR_INVALIDAC3FRAME                        -8
    00057 #define EAXAC3ERR_AC3FILENOTOPEN                         -9
    00058 #define EAXAC3ERR_BUFFERNOTMULTIPLEOFAC3FRAMESIZE       -10
    00059 #define EAXAC3ERR_WAVEOUTERROR                          -11
    00060 #define EAXAC3ERR_FAILEDTOCREATEEVENT                   -12
    00061 #define EAXAC3ERR_EAXAC3DEVICENOTOPEN                   -13
    00062 #define EAXAC3ERR_AC3STREAMALREADYOPEN                  -14
    00063 #define EAXAC3ERR_POSITIONOUTOFRANGE                    -15
    00064 #define EAXAC3ERR_NOTATSTARTOFAC3FRAME                  -16
    00065 #define EAXAC3ERR_AC3STREAMNOTOPEN                      -17
    00066 #define EAXAC3ERR_SETPOSITIONONLYWORKSONAC3FILES        -18
    00067 #define EAXAC3ERR_WRITEDATAONLYWORKSWITHMEMORYSTREAMS   -19
    00068 #define EAXAC3ERR_INVALIDPARAMETER                      -20
    00069 #define EAXAC3ERR_NOTENOUGHAC3DATAINAC3DATABUFFER       -21
    00070 #define EAXAC3ERR_NOTENOUGHDATA                         -22
    00071 #define EAXAC3ERR_EAXAC3DEVICEALREADYOPEN               -23
    00072 #define EAXAC3ERR_EAXAC3DEVICENOTFOUND                  -24
    00073 #define EAXAC3ERR_UNSUPPORTED                           -25
    00074 #define EAXAC3ERR_FAILEDTOCREATEFNTABLE                 -26
    00075
    00076 #define DEFAULTEAXAC3DEVICE 0
    00077
    00078 #define ENTIREBUFFER    0
    00079 #define FROMWRITECURSOR 1
    00080
    00081 #define LOOPING     1
    00082
    00083 #define ENDOFDATA   1
    00084
    00085 typedef unsigned int EAXAC3HANDLE;
    00086
    00087 typedef unsigned int AC3STREAM;
    00088
    00089 // Callback function
    00090 typedef void (__stdcall *LPAC3CALLBACK)(AC3STREAM AC3Stream, int msg);
    00091
    00092 // Callback messages
    00093 #define EAXAC3NEEDMOREDATA  0
    00094 #define EAXAC3REACHEDEND    1
    00095
    00096 typedef struct
    00097 {
    00098     unsigned int nNumOfAC3Frames;
    00099     unsigned int nAC3FrameSize;
    00100     unsigned int nSizeOfFile;
    00101     unsigned int nDuration;
    00102     unsigned int nFrequency;
    00103 } AC3FILEINFO, *LPAC3FILEINFO;
    00104
    00105 #define UNKNOWN         1
    00106 #define SPDIFPASSTHRU   2
    00107 #define FULLDECODE      4
    00108
    00109 typedef struct
    00110 {
    00111     char szDeviceName[256];
    00112     unsigned int uFlags;
    00113     unsigned int uStreams;
    00114     unsigned int uReserved;
    00115 } EAXAC3DEVICEINFO, *LPEAXAC3DEVICEINFO;
    00116
    00117 // Function typedefs
    00118
    00119 typedef int     (*LPEAXAC3QUERYNUMBEROFDEVICES)     (void);
    00120 typedef HRESULT (*LPEAXAC3QUERYFILE)                (char *, LPAC3FILEINFO, int);
    00121 typedef HRESULT (*LPEAXAC3QUERYMEMORY)              (char *, int, LPAC3FILEINFO, int);
    00122 typedef int     (*LPEAXAC3QUERYNOOFFRAMESREQFORPLAYBACK)    (AC3STREAM);
    00123 typedef HRESULT (*LPEAXAC3OPENPLAYBACKDEVICE)       (EAXAC3HANDLE);
    00124 typedef HRESULT (*LPEAXAC3CLOSEPLAYBACKDEVICE)      (EAXAC3HANDLE);
    00125 typedef HRESULT (*LPEAXAC3QUERYDEVICECAPS)          (EAXAC3HANDLE, LPEAXAC3DEVICEINFO, int);
    00126 typedef HRESULT (*LPEAXAC3GETPOSITION)              (AC3STREAM, enum POSFORMAT, int *);
    00127 typedef HRESULT (*LPEAXAC3SETFILEPOSITION)          (AC3STREAM, enum POSFORMAT, int);
    00128 typedef HRESULT (*LPEAXAC3OPENSTREAM)               (EAXAC3HANDLE, AC3STREAM *, LPAC3CALLBACK, char *, enum SOURCE);
    00129 typedef HRESULT (*LPEAXAC3CLOSESTREAM)              (AC3STREAM);
    00130 typedef HRESULT (*LPEAXAC3PREPLAYSTREAM)            (AC3STREAM);
    00131 typedef HRESULT (*LPEAXAC3PLAYSTREAM)               (AC3STREAM, int);
    00132 typedef HRESULT (*LPEAXAC3STOPSTREAM)               (AC3STREAM);
    00133 typedef HRESULT (*LPEAXAC3PAUSESTREAM)              (AC3STREAM);
    00134 typedef HRESULT (*LPEAXAC3RESUMESTREAM)             (AC3STREAM);
    00135 typedef HRESULT (*LPEAXAC3LOCKBUFFER)               (AC3STREAM, unsigned long, void **, unsigned long *, void **,
    00136                                                         unsigned long *, unsigned long);
    00137 typedef HRESULT (*LPEAXAC3UNLOCKBUFFER)             (AC3STREAM, void *, unsigned long, void *, unsigned long, int);
    00138 typedef HRESULT (*LPEAXAC3SETPLAYBACKMODE)          (EAXAC3HANDLE, unsigned int);
    00139 typedef char *  (*LPEAXAC3GETERRORSTRING)           (HRESULT, char *, int);
    00140 typedef HRESULT (*LPEAXAC3GETLASTERROR)             (HRESULT *);
    00141
    00142 // Function table declaration
    00143 typedef struct
    00144 {
    00145     LPEAXAC3QUERYNUMBEROFDEVICES                    EAXAC3QueryNumberOfDevices;
    00146     LPEAXAC3QUERYFILE                               EAXAC3QueryFile;
    00147     LPEAXAC3QUERYMEMORY                             EAXAC3QueryMemory;
    00148     LPEAXAC3QUERYNOOFFRAMESREQFORPLAYBACK           EAXAC3QueryNoOfFramesReqForPlayback;
    00149     LPEAXAC3OPENPLAYBACKDEVICE                      EAXAC3OpenPlaybackDevice;
    00150     LPEAXAC3CLOSEPLAYBACKDEVICE                     EAXAC3ClosePlaybackDevice;
    00151     LPEAXAC3QUERYDEVICECAPS                         EAXAC3QueryDeviceCaps;
    00152     LPEAXAC3GETPOSITION                             EAXAC3GetPosition;
    00153     LPEAXAC3SETFILEPOSITION                         EAXAC3SetFilePosition;
    00154     LPEAXAC3OPENSTREAM                              EAXAC3OpenStream;
    00155     LPEAXAC3CLOSESTREAM                             EAXAC3CloseStream;
    00156     LPEAXAC3PREPLAYSTREAM                           EAXAC3PrePlayStream;
    00157     LPEAXAC3PLAYSTREAM                              EAXAC3PlayStream;
    00158     LPEAXAC3STOPSTREAM                              EAXAC3StopStream;
    00159     LPEAXAC3PAUSESTREAM                             EAXAC3PauseStream;
    00160     LPEAXAC3RESUMESTREAM                            EAXAC3ResumeStream;
    00161     LPEAXAC3LOCKBUFFER                              EAXAC3LockBuffer;
    00162     LPEAXAC3UNLOCKBUFFER                            EAXAC3UnLockBuffer;
    00163     LPEAXAC3SETPLAYBACKMODE                         EAXAC3SetPlaybackMode;
    00164     LPEAXAC3GETERRORSTRING                          EAXAC3GetErrorString;
    00165     LPEAXAC3GETLASTERROR                            EAXAC3GetLastError;
    00166 } EAXAC3FNTABLE, *LPEAXAC3FNTABLE;
    00167
    00168
    00169 #ifndef OPENAL
    00170 typedef EAXAC3_API HRESULT (*LPEAXAC3GETFUNCTIONTABLE)      (LPEAXAC3FNTABLE);
    00171 #else
    00172 typedef ALboolean (*LPALEAXAC3GETFUNCTIONTABLE) (LPEAXAC3FNTABLE);
    00173 #endif
    00174
    00175 // Functions exposed in the DLL
    00176
    00177 EAXAC3_API HRESULT EAXAC3GetFunctionTable(LPEAXAC3FNTABLE lpEAXAC3FnTable);
    00178
    00179 EAXAC3_API int     EAXAC3QueryNumberOfDevices();
    00180
    00181 EAXAC3_API HRESULT EAXAC3QueryFile(char *szAC3Filename, LPAC3FILEINFO lpAC3Caps, int nSizeOfAC3FileInfoStruct);
    00182
    00183 EAXAC3_API HRESULT EAXAC3QueryMemory(char *lpBuffer, int nSizeOfBuffer, LPAC3FILEINFO lpAC3FileInfo,
    00184                                      int nSizeOfAC3FileInfoStruct);
    00185
    00186 EAXAC3_API int     EAXAC3QueryNoOfFramesReqForPlayback(AC3STREAM AC3Stream);
    00187
    00188 EAXAC3_API HRESULT EAXAC3OpenPlaybackDevice(EAXAC3HANDLE EAXAC3Handle);
    00189
    00190 EAXAC3_API HRESULT EAXAC3ClosePlaybackDevice(EAXAC3HANDLE EAXAC3Handle);
    00191
    00192 EAXAC3_API HRESULT EAXAC3QueryDeviceCaps(EAXAC3HANDLE EAXAC3Handle, LPEAXAC3DEVICEINFO lpEAXAC3DeviceInfo,
    00193                                          int nSizeOfAC3DeviceInfoStruct);
    00194
    00195 EAXAC3_API HRESULT EAXAC3GetPosition(AC3STREAM AC3Stream, enum POSFORMAT posFormat, int *lpAmount);
    00196
    00197 EAXAC3_API HRESULT EAXAC3SetFilePosition(AC3STREAM AC3Stream, enum POSFORMAT posFormat, int nAmount);
    00198
    00199 EAXAC3_API HRESULT EAXAC3OpenStream(EAXAC3HANDLE EAXAC3Handle, AC3STREAM *lpAC3Stream,
    00200                                     LPAC3CALLBACK pAC3CallbackFn, char *szAC3Filename, enum SOURCE src);
    00201
    00202 EAXAC3_API HRESULT EAXAC3CloseStream(AC3STREAM AC3Stream);
    00203
    00204 EAXAC3_API HRESULT EAXAC3PrePlayStream(AC3STREAM AC3Stream);
    00205
    00206 EAXAC3_API HRESULT EAXAC3PlayStream(AC3STREAM AC3Stream, int nLooping);
    00207
    00208 EAXAC3_API HRESULT EAXAC3StopStream(AC3STREAM AC3Stream);
    00209
    00210 EAXAC3_API HRESULT EAXAC3PauseStream(AC3STREAM AC3Stream);
    00211
    00212 EAXAC3_API HRESULT EAXAC3ResumeStream(AC3STREAM AC3Stream);
    00213
    00214 EAXAC3_API HRESULT EAXAC3LockBuffer(AC3STREAM AC3Stream, unsigned long ulBytes, void **ppvPointer1,
    00215                                     unsigned long *pdwBytes1, void **ppvPointer2, unsigned long *pdwBytes2,
    00216                                     unsigned long ulFlags);
    00217
    00218 EAXAC3_API HRESULT EAXAC3UnLockBuffer(AC3STREAM AC3Stream, void *pvPointer1, unsigned long ulSize1,
    00219                                       void *pvPointer2, unsigned long ulSize2, int nFinished);
    00220
    00221 EAXAC3_API HRESULT EAXAC3SetPlaybackMode(EAXAC3HANDLE EAXAC3Handle, unsigned int ulPlayMode);
    00222
    00223 EAXAC3_API char *  EAXAC3GetErrorString(HRESULT hr, char *szErrorString, int nSizeOfErrorString);
    00224
    00225 EAXAC3_API HRESULT EAXAC3GetLastError(HRESULT *hr);
    00226
    00227 #ifdef __cplusplus
    00228 }
    00229 #endif
    00230
    00231 #endif