home *** CD-ROM | disk | FTP | other *** search
/ Learn 3D Graphics Programming on the PC / Learn_3D_Graphics_Programming_on_the_PC_Ferraro.iso / rwwin / wmwatcom.c_ / wmwatcom.bin
Text File  |  1995-11-14  |  11KB  |  339 lines

  1. /**********************************************************************
  2.  *
  3.  * File :     wmwatcom.c
  4.  *
  5.  * Abstract : Wavemix wrappers for Watcom C
  6.  *
  7.  **********************************************************************
  8.  *
  9.  * This file is a product of Criterion Software Ltd.
  10.  *
  11.  * This file is provided as is with no warranties of any kind and is
  12.  * provided without any obligation on Criterion Software Ltd. or
  13.  * Canon Inc. to assist in its use or modification.
  14.  *
  15.  * Criterion Software Ltd. will not, under any
  16.  * circumstances, be liable for any lost revenue or other damages arising
  17.  * from the use of this file.
  18.  *
  19.  * Copyright (c) 1995 Criterion Software Ltd.
  20.  * All Rights Reserved.
  21.  *
  22.  * RenderWare is a trademark of Canon Inc.
  23.  *
  24.  ************************************************************************/
  25.  
  26. /*--- Include Files ---*/
  27.  
  28. #include <windows.h>
  29.  
  30. /***********************************************************************
  31.  *
  32.  * Global store.
  33.  *
  34.  ***********************************************************************/
  35.  
  36. /*
  37.  * Library handle.
  38.  */
  39. static HINSTANCE hWaveMixLibrary            = (HINSTANCE)0;
  40.  
  41. /*
  42.  * Indirect function handles for the entry points.
  43.  */
  44. HINDIR hWaveMixInit          = (HINDIR)0;
  45. HINDIR hWaveMixConfigureInit = (HINDIR)0;
  46. HINDIR hWaveMixActivate      = (HINDIR)0;
  47. HINDIR hWaveMixOpenWave      = (HINDIR)0;
  48. HINDIR hWaveMixOpenChannel   = (HINDIR)0;
  49. HINDIR hWaveMixPlay          = (HINDIR)0;
  50. HINDIR hWaveMixFlushChannel  = (HINDIR)0;
  51. HINDIR hWaveMixCloseChannel  = (HINDIR)0;
  52. HINDIR hWaveMixFreeWave      = (HINDIR)0;
  53. HINDIR hWaveMixCloseSession  = (HINDIR)0;
  54. HINDIR hWaveMixPump          = (HINDIR)0;
  55. HINDIR hWaveMixGetInfo       = (HINDIR)0;
  56.  
  57. /***********************************************************************
  58.  *
  59.  * Functions.
  60.  *
  61.  ***********************************************************************/
  62.  
  63. /***********************************************************************/
  64.  
  65. BOOL
  66. WaveMixOpen(void)
  67. {
  68.     FARPROC procAddr;
  69.  
  70.     /*
  71.      * Load the WaveMix library.
  72.      */
  73.     hWaveMixLibrary = LoadLibrary("wavemix.dll");
  74.     if (hWaveMixLibrary < 32)
  75.     {
  76.         hWaveMixLibrary = (HINSTANCE)0;
  77.         return FALSE;
  78.     }
  79.  
  80.     /*************************************************************
  81.      * WaveMixInit
  82.      *************************************************************/
  83.  
  84.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixInit");
  85.     if (procAddr == (FARPROC)0)
  86.     {
  87.         FreeLibrary(hWaveMixLibrary);
  88.         return FALSE;
  89.     }
  90.  
  91.     hWaveMixInit = GetIndirectFunctionHandle(procAddr,
  92.                                              INDIR_ENDLIST);
  93.     if (hWaveMixInit == (HINDIR)0)
  94.     {
  95.         FreeLibrary(hWaveMixLibrary);
  96.         return FALSE;
  97.     }
  98.     /*************************************************************
  99.      * WaveMixConfigureInit
  100.      *************************************************************/
  101.  
  102.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixConfigureInit");
  103.     if (procAddr == (FARPROC)0)
  104.     {
  105.         FreeLibrary(hWaveMixLibrary);
  106.         return FALSE;
  107.     }
  108.  
  109.     hWaveMixConfigureInit = GetIndirectFunctionHandle(procAddr,
  110.                                                       INDIR_PTR,
  111.                                                       INDIR_ENDLIST);
  112.     if (hWaveMixConfigureInit == (HINDIR)0)
  113.     {
  114.         FreeLibrary(hWaveMixLibrary);
  115.         return FALSE;
  116.     }
  117.     /*************************************************************
  118.      * WaveMixActivate
  119.      *************************************************************/
  120.  
  121.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixActivate");
  122.     if (procAddr == (FARPROC)0)
  123.     {
  124.         FreeLibrary(hWaveMixLibrary);
  125.         return FALSE;
  126.     }
  127.  
  128.     hWaveMixActivate = GetIndirectFunctionHandle(procAddr,
  129.                                                  INDIR_WORD,
  130.                                                  INDIR_WORD,
  131.                                                  INDIR_ENDLIST);
  132.     if (hWaveMixActivate == (HINDIR)0)
  133.     {
  134.         FreeLibrary(hWaveMixLibrary);
  135.         return FALSE;
  136.     }
  137.  
  138.     /*************************************************************
  139.      * WaveMixOpenWave
  140.      *************************************************************/
  141.  
  142.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixOpenWave");
  143.     if (procAddr == (FARPROC)0)
  144.     {
  145.         FreeLibrary(hWaveMixLibrary);
  146.         return FALSE;
  147.     }
  148.  
  149.     hWaveMixOpenWave = GetIndirectFunctionHandle(procAddr,
  150.                                                  INDIR_WORD,
  151.                                                  INDIR_PTR,
  152.                                                  INDIR_WORD,
  153.                                                  INDIR_DWORD,
  154.                                                  INDIR_ENDLIST);
  155.     if (hWaveMixOpenWave == (HINDIR)0)
  156.     {
  157.         FreeLibrary(hWaveMixLibrary);
  158.         return FALSE;
  159.     }
  160.  
  161.     /*************************************************************
  162.      * WaveMixOpenChannel
  163.      *************************************************************/
  164.  
  165.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixOpenChannel");
  166.     if (procAddr == (FARPROC)0)
  167.     {
  168.         FreeLibrary(hWaveMixLibrary);
  169.         return FALSE;
  170.     }
  171.  
  172.     hWaveMixOpenChannel = GetIndirectFunctionHandle(procAddr,
  173.                                                     INDIR_WORD,
  174.                                                     INDIR_WORD,
  175.                                                     INDIR_DWORD,
  176.                                                     INDIR_ENDLIST);
  177.     if (hWaveMixOpenChannel == (HINDIR)0)
  178.     {
  179.         FreeLibrary(hWaveMixLibrary);
  180.         return FALSE;
  181.     }
  182.  
  183.     /*************************************************************
  184.      * WaveMixPlay
  185.      *************************************************************/
  186.  
  187.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixPlay");
  188.     if (procAddr == (FARPROC)0)
  189.     {
  190.         FreeLibrary(hWaveMixLibrary);
  191.         return FALSE;
  192.     }
  193.  
  194.     hWaveMixPlay = GetIndirectFunctionHandle(procAddr,
  195.                                              INDIR_PTR,
  196.                                              INDIR_ENDLIST);
  197.     if (hWaveMixPlay == (HINDIR)0)
  198.     {
  199.         FreeLibrary(hWaveMixLibrary);
  200.         return FALSE;
  201.     }
  202.     /*************************************************************
  203.      * WaveMixFlushChannel
  204.      *************************************************************/
  205.  
  206.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixFlushChannel");
  207.     if (procAddr == (FARPROC)0)
  208.     {
  209.         FreeLibrary(hWaveMixLibrary);
  210.         return FALSE;
  211.     }
  212.     hWaveMixFlushChannel = GetIndirectFunctionHandle(procAddr,
  213.                                                      INDIR_WORD,
  214.                                                      INDIR_WORD,
  215.                                                      INDIR_DWORD,
  216.                                                      INDIR_ENDLIST);
  217.     if (hWaveMixFlushChannel == (HINDIR)0)
  218.     {
  219.         FreeLibrary(hWaveMixLibrary);
  220.         return FALSE;
  221.     }
  222.  
  223.     /*************************************************************
  224.      * WaveMixCloseChannel
  225.      *************************************************************/
  226.  
  227.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixCloseChannel");
  228.     if (procAddr == (FARPROC)0)
  229.     {
  230.         FreeLibrary(hWaveMixLibrary);
  231.         return FALSE;
  232.     }
  233.     hWaveMixCloseChannel = GetIndirectFunctionHandle(procAddr,
  234.                                                      INDIR_WORD,
  235.                                                      INDIR_WORD,
  236.                                                      INDIR_DWORD,
  237.                                                      INDIR_ENDLIST);
  238.     if (hWaveMixCloseChannel == (HINDIR)0)
  239.     {
  240.         FreeLibrary(hWaveMixLibrary);
  241.         return FALSE;
  242.     }
  243.  
  244.     /*************************************************************
  245.      * WaveMixFreeWave
  246.      *************************************************************/
  247.  
  248.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixFreeWave");
  249.     if (procAddr == (FARPROC)0)
  250.     {
  251.         FreeLibrary(hWaveMixLibrary);
  252.         return FALSE;
  253.     }
  254.     hWaveMixFreeWave = GetIndirectFunctionHandle(procAddr,
  255.                                                  INDIR_WORD,
  256.                                                  INDIR_DWORD,
  257.                                                  INDIR_ENDLIST);
  258.     if (hWaveMixFreeWave == (HINDIR)0)
  259.     {
  260.         FreeLibrary(hWaveMixLibrary);
  261.         return FALSE;
  262.     }
  263.     /*************************************************************
  264.      * WaveMixCloseSession
  265.      *************************************************************/
  266.  
  267.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixCloseSession");
  268.     if (procAddr == (FARPROC)0)
  269.     {
  270.         FreeLibrary(hWaveMixLibrary);
  271.         return FALSE;
  272.     }
  273.     hWaveMixCloseSession = GetIndirectFunctionHandle(procAddr,
  274.                                                      INDIR_WORD,
  275.                                                      INDIR_ENDLIST);
  276.     if (hWaveMixCloseSession == (HINDIR)0)
  277.     {
  278.         FreeLibrary(hWaveMixLibrary);
  279.         return FALSE;
  280.     }
  281.     /*************************************************************
  282.      * WaveMixPump
  283.      *************************************************************/
  284.  
  285.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixPump");
  286.     if (procAddr == (FARPROC)0)
  287.     {
  288.         FreeLibrary(hWaveMixLibrary);
  289.         return FALSE;
  290.     }
  291.     hWaveMixPump = GetIndirectFunctionHandle(procAddr,
  292.                                              INDIR_ENDLIST);
  293.     if (hWaveMixPump == (HINDIR)0)
  294.     {
  295.         FreeLibrary(hWaveMixLibrary);
  296.         return FALSE;
  297.     }
  298.  
  299.     /*************************************************************
  300.      * WaveMixGetInfo
  301.      *************************************************************/
  302.  
  303.     procAddr = GetProcAddress(hWaveMixLibrary, "WaveMixGetInfo");
  304.     if (procAddr == (FARPROC)0)
  305.     {
  306.         FreeLibrary(hWaveMixLibrary);
  307.         return FALSE;
  308.     }
  309.  
  310.     hWaveMixGetInfo = GetIndirectFunctionHandle(procAddr,
  311.                                                 INDIR_PTR,
  312.                                                 INDIR_ENDLIST);
  313.     if (hWaveMixGetInfo == (HINDIR)0)
  314.     {
  315.         FreeLibrary(hWaveMixLibrary);
  316.         return FALSE;
  317.     }
  318.  
  319.     return TRUE;
  320. }
  321.  
  322. /***********************************************************************/
  323.  
  324. void
  325. WaveMixClose(void)
  326. {
  327.     if (hWaveMixLibrary != (HINSTANCE)0)
  328.     {
  329.         FreeLibrary(hWaveMixLibrary);
  330.         hWaveMixLibrary = (HINSTANCE)0;
  331.     }
  332. }
  333.  
  334. /***********************************************************************
  335.  *
  336.  * End of file.
  337.  *
  338.  ***********************************************************************/
  339.