home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / ORiffPlay.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  4KB  |  140 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1996
  3. // All Rights Reserved
  4. // ORiffPlay.hpp
  5.  
  6.  
  7. /*
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  14.  *    endorse or promote products derived from this software
  15.  *    without specific prior written permission.
  16.  * 3. See OCL.INF for a detailed copyright notice.
  17.  *
  18.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  19.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28.  * SUCH DAMAGE.
  29.  */
  30.  
  31.  
  32. // $Header: W:/Projects/OCL/Include/rcs/ORiffPlay.hpp 1.50 1996/08/11 23:47:29 B.STEIN Release $
  33.  
  34. #ifndef ORIFFPLAY_INCLUDED
  35.   #define ORIFFPLAY_INCLUDED
  36.  
  37.  
  38. #ifndef OPMEXCEPTION_INCLUDED
  39.   #include <OPMException.hpp>
  40. #endif
  41.  
  42. #ifndef ODYNAMICLIB_INCLUDED
  43.   #include <ODynamicLib.hpp>
  44. #endif
  45.  
  46.  
  47. // classes
  48.  
  49.  
  50.  
  51. extern "C"
  52. {
  53. typedef ULONG  (EXPENTRY *mci_play_file)
  54.                (HWND, PSZ, ULONG, PSZ, HWND);
  55. typedef ULONG  (EXPENTRY *mci_play_resource)
  56.                (HWND, HMODULE, ULONG, ULONG, ULONG, PSZ, HWND);
  57. typedef ULONG  (APIENTRY *mci_get_error)
  58.                (ULONG, PSZ, USHORT);
  59. }
  60.  
  61.  
  62. typedef class ORiffPlay *pORiffPlay;
  63.  
  64. class __CPP_EXPORT__ ORiffPlay
  65. {
  66.  public:
  67.  
  68.     enum  RiffType
  69.       {
  70.        midi            = 100,    // RT_RMID
  71.        riff            = 101,    // RT_RIFF
  72.        wave            = 102,    // RT_WAVE
  73.        avi             = 103,    // RT_AVI
  74.        avs             = 104     // RT_AVS
  75.       }; 
  76.  
  77.     enum  PlayType
  78.       {
  79.        wait            = 0,      // wait for completition 
  80.        ownerIsParent   = 0x0001, // digital and overlay                 
  81.        stopActive      = 0x0002, // stop playing whatever is playing    
  82.        asyncRendezvous = 0x0004, // play and return immediately         
  83.        rendezvous      = 0x0008, // wait til prev is finished then play 
  84.        async           = 0x0010, // no syncup will be done              
  85.        repeat          = 0x0020, // repeat 
  86.        stopOnSuspend   = 0x0040  // stop when suspended 
  87.  
  88.       };
  89.  
  90.  
  91.     ORiffPlay              ();
  92.                       
  93.     ORiffPlay              (PSZ soundLibrary);
  94.  
  95.     ORiffPlay              (ODynamicLib& soundLibrary);
  96.  
  97.     virtual
  98.       ~ORiffPlay           ();  
  99.  
  100.    virtual PSZ
  101.       isOfType             () const;   
  102.  
  103.    void
  104.       play                 (PSZ   waveFileName,         // load from RIFF file
  105.                             ORiffPlay::PlayType playType),
  106.  
  107.       play                 (ULONG soundID,              // load from exe or lib
  108.                             ORiffPlay::RiffType resType,
  109.                             ORiffPlay::PlayType playType),
  110.  
  111.       stop                 ();
  112.  
  113. // strictly for internal use
  114.  
  115.   private:
  116.  
  117.     OString                  waveFile;
  118.     ULONG                    waveID;
  119.     ULONG                    waveType;
  120.     ODynamicLib              waveLibrary;
  121.  
  122.     static mci_play_file     mci_pf;
  123.     static mci_play_resource mci_pr;
  124.     static mci_get_error     mci_err;
  125.     static pODynamicLib      mciapi;
  126.     static pODynamicLib      mdmapi;
  127.  
  128.     void
  129.       resolve                (),
  130.       playWave               (ORiffPlay::PlayType playType);
  131.  
  132. };
  133.  
  134.  
  135.  
  136. #endif // ORIFFPLAY_INCLUDED
  137.  
  138.  
  139. // end of source
  140.