home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************
- *
- * File : wmwatcom.c
- *
- * Abstract : Wavemix wrappers for Watcom C
- *
- **********************************************************************
- *
- * This file is a product of Criterion Software Ltd.
- *
- * This file is provided as is with no warranties of any kind and is
- * provided without any obligation on Criterion Software Ltd. or
- * Canon Inc. to assist in its use or modification.
- *
- * Criterion Software Ltd. will not, under any
- * circumstances, be liable for any lost revenue or other damages arising
- * from the use of this file.
- *
- * Copyright (c) 1995 Criterion Software Ltd.
- * All Rights Reserved.
- *
- * RenderWare is a trademark of Canon Inc.
- *
- ************************************************************************/
-
- /*--- Include Files ---*/
-
- #include <windows.h>
-
- /***********************************************************************
- *
- * Global store.
- *
- ***********************************************************************/
-
- /*
- * Library handle.
- */
- static HINSTANCE hWaveMixLibrary = (HINSTANCE)0;
-
- /*
- * Indirect function handles for the entry points.
- */
- HINDIR hWaveMixInit = (HINDIR)0;
- HINDIR hWaveMixConfigureInit = (HINDIR)0;
- HINDIR hWaveMixActivate = (HINDIR)0;
- HINDIR hWaveMixOpenWave = (HINDIR)0;
- HINDIR hWaveMixOpenChannel = (HINDIR)0;
- HINDIR hWaveMixPlay = (HINDIR)0;
- HINDIR hWaveMixFlushChannel = (HINDIR)0;
- HINDIR hWaveMixCloseChannel = (HINDIR)0;
- HINDIR hWaveMixFreeWave = (HINDIR)0;
- HINDIR hWaveMixCloseSession = (HINDIR)0;
- HINDIR hWaveMixPump = (HINDIR)0;
- HINDIR hWaveMixGetInfo = (HINDIR)0;
-
- /***********************************************************************
- *
- * Functions.
- *
- ***********************************************************************/
-
- /***********************************************************************/
-
- BOOL
- WaveMixOpen(void)
- {
- FARPROC procAddr;
-
- /*
- * Load the WaveMix library.
- */
- hWaveMixLibrary = LoadLibrary("wavemix.dll");
- if (hWaveMixLibrary < 32)
- {
- hWaveMixLibrary = (HINSTANCE)0;
- return FALSE;
- }
-
- /*************************************************************
- * WaveMixInit
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixInit");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- hWaveMixInit = GetIndirectFunctionHandle(procAddr,
- INDIR_ENDLIST);
- if (hWaveMixInit == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- /*************************************************************
- * WaveMixConfigureInit
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixConfigureInit");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- hWaveMixConfigureInit = GetIndirectFunctionHandle(procAddr,
- INDIR_PTR,
- INDIR_ENDLIST);
- if (hWaveMixConfigureInit == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- /*************************************************************
- * WaveMixActivate
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixActivate");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- hWaveMixActivate = GetIndirectFunctionHandle(procAddr,
- INDIR_WORD,
- INDIR_WORD,
- INDIR_ENDLIST);
- if (hWaveMixActivate == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- /*************************************************************
- * WaveMixOpenWave
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixOpenWave");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- hWaveMixOpenWave = GetIndirectFunctionHandle(procAddr,
- INDIR_WORD,
- INDIR_PTR,
- INDIR_WORD,
- INDIR_DWORD,
- INDIR_ENDLIST);
- if (hWaveMixOpenWave == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- /*************************************************************
- * WaveMixOpenChannel
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixOpenChannel");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- hWaveMixOpenChannel = GetIndirectFunctionHandle(procAddr,
- INDIR_WORD,
- INDIR_WORD,
- INDIR_DWORD,
- INDIR_ENDLIST);
- if (hWaveMixOpenChannel == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- /*************************************************************
- * WaveMixPlay
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixPlay");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- hWaveMixPlay = GetIndirectFunctionHandle(procAddr,
- INDIR_PTR,
- INDIR_ENDLIST);
- if (hWaveMixPlay == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- /*************************************************************
- * WaveMixFlushChannel
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixFlushChannel");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- hWaveMixFlushChannel = GetIndirectFunctionHandle(procAddr,
- INDIR_WORD,
- INDIR_WORD,
- INDIR_DWORD,
- INDIR_ENDLIST);
- if (hWaveMixFlushChannel == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- /*************************************************************
- * WaveMixCloseChannel
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixCloseChannel");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- hWaveMixCloseChannel = GetIndirectFunctionHandle(procAddr,
- INDIR_WORD,
- INDIR_WORD,
- INDIR_DWORD,
- INDIR_ENDLIST);
- if (hWaveMixCloseChannel == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- /*************************************************************
- * WaveMixFreeWave
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixFreeWave");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- hWaveMixFreeWave = GetIndirectFunctionHandle(procAddr,
- INDIR_WORD,
- INDIR_DWORD,
- INDIR_ENDLIST);
- if (hWaveMixFreeWave == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- /*************************************************************
- * WaveMixCloseSession
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixCloseSession");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- hWaveMixCloseSession = GetIndirectFunctionHandle(procAddr,
- INDIR_WORD,
- INDIR_ENDLIST);
- if (hWaveMixCloseSession == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- /*************************************************************
- * WaveMixPump
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixPump");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
- hWaveMixPump = GetIndirectFunctionHandle(procAddr,
- INDIR_ENDLIST);
- if (hWaveMixPump == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- /*************************************************************
- * WaveMixGetInfo
- *************************************************************/
-
- procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixGetInfo");
- if (procAddr == (FARPROC)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- hWaveMixGetInfo = GetIndirectFunctionHandle(procAddr,
- INDIR_PTR,
- INDIR_ENDLIST);
- if (hWaveMixGetInfo == (HINDIR)0)
- {
- FreeLibrary(hWaveMixLibrary);
- return FALSE;
- }
-
- return TRUE;
- }
-
- /***********************************************************************/
-
- void
- WaveMixClose(void)
- {
- if (hWaveMixLibrary != (HINSTANCE)0)
- {
- FreeLibrary(hWaveMixLibrary);
- hWaveMixLibrary = (HINSTANCE)0;
- }
- }
-
- /***********************************************************************
- *
- * End of file.
- *
- ***********************************************************************/
-