home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / wvplr1 / wavplayr.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-25  |  3.7 KB  |  113 lines

  1. //----------------------------------------------------------------------------
  2. // WavePlayer Class Include File
  3. //
  4. // Version 1.00
  5. // Copyright (C) 1994 by Lighthouse Engineering
  6. // All Rights Reserved
  7. //
  8. // Written by K. Scott Piel - CIS 74151,1035
  9. //----------------------------------------------------------------------------
  10.  
  11. #ifndef WAVPLAYR_HPP
  12. #define WAVPLAYR_HPP
  13.  
  14. #include "wavplayr.rh"
  15.  
  16. //----------------------------------------------------------------------------
  17. // Comment out this define if you do not want to use OWL libraries with this
  18. // build of WavePlayer
  19. //----------------------------------------------------------------------------
  20.  
  21. #define wpUSES_OWL
  22.  
  23. //----------------------------------------------------------------------------
  24. // comment out this define if you want to exclude the WavePlayer file list
  25. // of numbers from the compile. This will reduce memory usage.
  26. //----------------------------------------------------------------------------
  27.  
  28. //#define wpEXCLUDE_FILES
  29.  
  30. //----------------------------------------------------------------------------
  31. // Valid error codes set by Execute when called.
  32. //----------------------------------------------------------------------------
  33.  
  34. enum wpErrors
  35. {
  36.     wpNOERROR,        // the last call was completed w/o error
  37.     wpNOTFOUND,        // the resource or file was not found
  38.     wpLOADFAILED,    // the wave could not be loaded into memory
  39.     wpLOCKFAILED,    // the global memory image could not be locked
  40.     wpPLAYFAILED    // the wave would not play
  41. };
  42.  
  43. //----------------------------------------------------------------------------
  44. // Enumerated control of sign announcement for spoken numbers
  45. //----------------------------------------------------------------------------
  46.  
  47. enum wpSigns
  48. {
  49.     wpUNSIGNED,        // number is unsigned, use no prefixing
  50.     wpNEGATIVE,        // announce numbers as "negative", do not use "positive"
  51.     wpPOSITIVE,        // announce numbers as "positive" and "negative"
  52.     wpMINUS,        // announce numbers as "minus", do not use "plus"
  53.     wpPLUS            // announce numbers as "plus" and "minus"
  54. };
  55.  
  56. //----------------------------------------------------------------------------
  57. // Dummy TApplication class used to replace references if OWL is not used
  58. //----------------------------------------------------------------------------
  59.  
  60. #ifndef wpUSES_OWL
  61.  
  62. class TApplication
  63. {
  64.     public:
  65.  
  66.     TApplication() {};
  67.     ~TApplication() {};
  68. };
  69.  
  70. #else
  71.  
  72. #include <owl\applicat.h>
  73.  
  74. #endif // wpUSES_OWL
  75.  
  76. //----------------------------------------------------------------------------
  77. // Wave player class definition
  78. //----------------------------------------------------------------------------
  79.  
  80. class WavePlayer
  81. {
  82.     private:
  83.  
  84.     TApplication    *app;        // application that owns this instance
  85.     HINSTANCE        instance;    // current application instance number
  86.     wpErrors        err_code;    // last error code generated
  87.     BOOL            playsound;    // set FALSE is no sound device available
  88.  
  89.     public:
  90.  
  91.     WavePlayer( HINSTANCE hInst, TApplication *parent = NULL );
  92.     ~WavePlayer();
  93.  
  94.     BOOL        Execute( char *filename );             // a single wave file
  95.     BOOL        Execute( char **filelist );            // a list of wave files
  96.     BOOL        Execute( unsigned resource_id );    // a single wave resource
  97.     BOOL        Execute( unsigned *rsrclist );        // a list of resources
  98.  
  99.     wpErrors    LastError( void );                    // last error code
  100.  
  101.     // convert numbers to a list of WavePlayer resources to be spoken
  102.  
  103.     unsigned *CvtNumToSndStr( long val, wpSigns signed = wpUNSIGNED );
  104.     unsigned *CvtNumToSndStr( double val, int precision, wpSigns signed = wpUNSIGNED );
  105.  
  106.     // convert a list of wave resources to a list of wave files
  107.  
  108.     char **CvtSndStrToFileList( unsigned *sndstr );
  109. };
  110.  
  111. #endif // WAVPLAYR_HPP
  112.  
  113. //--- End Of File ------------------------------------------------------------