home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 Secrets / Secrets2.iso / Audio / WAV / Maplay4 / _SETUP.1 / args.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-18  |  3.2 KB  |  172 lines

  1. /* args.h
  2.  
  3.     An abstract class to pass values to maplay and other worker
  4.    threads.
  5.  
  6.     From the Win32 API, we can only pass one 32-bit value to a thread. This will
  7.    be a pointer to a object of this class. The Args class contains the seeking
  8.    control variables needed for both MPEG and MCI files.
  9.  
  10.    Added stop and done variables and functions for terminating the
  11.    threads from outside.
  12.  
  13.    This class should be used to pass arguments to maplay(),
  14.    and to initialize the Obuffer's. */
  15.  
  16. #ifndef ARGS_H
  17. #define ARGS_H
  18.  
  19. #ifdef __WIN32__
  20. #define STRICT
  21. #include <wtypes.h>
  22. #include <windows.h>
  23. enum e_output { O_WAVEMAPPER, O_DIRECTSOUND, O_WAVEFILE };
  24. #endif // __WIN32__
  25.  
  26. #include "all.h"
  27. #include "ibitstr.h"
  28. #include "header.h"
  29.  
  30. #ifdef SEEK_STOP
  31. #include "mutx_imp.h"
  32. #endif
  33.  
  34. class Args
  35. {
  36.     public:
  37.  
  38.     Args()
  39.    {
  40.  
  41. #ifdef SEEK_STOP
  42.         mutex               = NULL;
  43.        stop             = FALSE;
  44.       done             = FALSE;
  45.       desired_position = 0;
  46.       position_change  = FALSE;
  47. #endif // SEEK_STOP
  48.  
  49. #ifdef WIN32GUI
  50.        hWnd             = NULL;
  51. #endif // WIN32GUI
  52.    }
  53.  
  54.     virtual ~Args() {}
  55.  
  56. #ifdef SEEK_STOP
  57.     _Mutex mutex;
  58.    volatile bool  stop;
  59.    volatile bool  done;
  60.       volatile int32 desired_position;
  61.     volatile bool  position_change;
  62. #endif // SEEK_STOP
  63.  
  64. #ifdef WIN32GUI
  65.     HWND hWnd;
  66. #endif // WIN32GUI
  67.  
  68. };
  69.  
  70. // A class to contain arguments for maplay.
  71. class MPEG_Args : public Args
  72. {
  73. public:
  74.  
  75.     MPEG_Args()
  76.     {
  77.         stream = NULL;
  78.         MPEGheader = NULL;
  79.         which_c = both;
  80.        use_own_scalefactor = FALSE;
  81.        scalefactor = 32768.0;
  82.  
  83. #ifdef __WIN32__
  84.           phwo = NULL;
  85.       output_mode = O_WAVEMAPPER;
  86. #endif // __WIN32__
  87.  
  88.       stdout_mode   = FALSE;
  89.       verbose_mode  = FALSE;
  90.  
  91. #if defined(SPARC) || defined(HPUX)
  92.        use_speaker   = FALSE;
  93.       use_headphone = FALSE;
  94.       use_line_out  = FALSE;
  95. #endif // SPARC || HPUX
  96.  
  97. #if defined(SPARC) && defined(ULAW)
  98.         force_amd     = FALSE;
  99. #endif // SPARC && ULAW
  100.  
  101. #if defined(SPARC) || defined(HPUX) || defined(AIX)
  102.       volume = -1.0f;
  103. #endif // SPARC || HPUX || AIX
  104.  
  105. #ifdef HPUX
  106.         wait_if_busy = FALSE;
  107. #endif
  108.       }
  109.  
  110.     Ibitstream *stream;
  111.     Header *MPEGheader;
  112.     enum e_channels which_c;
  113.  
  114.    bool use_own_scalefactor;
  115.    real scalefactor;
  116.  
  117. #ifdef __WIN32__
  118.     HWAVEOUT *phwo;
  119.    enum e_output output_mode;
  120.     char output_filename[256];
  121. #endif // __WIN32__
  122.  
  123.    bool stdout_mode;
  124.    bool verbose_mode;
  125.  
  126. #if defined(SPARC) || defined(HPUX)
  127.    bool use_speaker;
  128.    bool use_headphone;
  129.    bool use_line_out;
  130. #endif // SPARC || HPUX
  131.  
  132. #if defined(SPARC) && defined(ULAW)
  133.     bool force_amd;
  134. #endif // SPARC && ULAW
  135.  
  136. #if defined(SPARC) || defined(HPUX) || defined(AIX)
  137.    float volume;
  138. #endif // SPARC || HPUX || AIX
  139.  
  140. #ifdef HPUX
  141.     bool wait_if_busy;
  142. #endif // HPUX
  143.  
  144.     ~MPEG_Args() { }
  145. };
  146.  
  147. #ifdef __WIN32__
  148. // A class to hold the arguments for MCI playing.
  149. class MCI_Args : public Args {
  150.  
  151. public:
  152.     MCI_Args()
  153.     {
  154.         playing = FALSE;
  155.       CDMode  = FALSE;
  156.       final_track = FALSE; 
  157.     }
  158.  
  159.    ~MCI_Args() { }
  160.  
  161.    bool CDMode;
  162.    bool final_track;
  163.    char this_track_str[8];
  164.    char next_track_str[8];
  165.  
  166.  
  167.     volatile bool playing;
  168. };
  169. #endif // __WIN32__
  170.  
  171. #endif // ARGS_H
  172.