home *** CD-ROM | disk | FTP | other *** search
/ Black Art of 3D Game Programming / Black_Art_of_3D_Game_Programming.iso / source / borland / chap_16 / black6.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-20  |  3.0 KB  |  108 lines

  1.  
  2. // Header File for Library Module BLACK6.C
  3.  
  4. // D E F I N E S ////////////////////////////////////////////////////////////
  5.  
  6. // return values for digital sound status function
  7.  
  8. #define SOUND_STOPPED     0       // no sound is playing
  9. #define SOUND_PLAYING     1       // a sound is playing
  10.  
  11. // return values for the midi sequence status function
  12.  
  13. #define SEQUENCE_STOPPED     0    // the current sequence is stopped
  14. #define SEQUENCE_PLAYING     1    // the current sequence is playing
  15. #define SEQUENCE_COMPLETE    2    // the current sequence has completed
  16. #define SEQUENCE_UNAVAILABLE 0    // this sequence is unavailable
  17.  
  18. // these return values are used to determine what happened when a midi file
  19. // has been registered
  20.  
  21. #define XMIDI_UNREGISTERED  0 // the midi file couldn't be registered at all
  22. #define XMIDI_BUFFERED      1 // the midi file was registered and buffered
  23. #define XMIDI_UNBUFFERED    2 // the midi file was registered, but was too
  24.                                         // big to be buffered, hence, the caller
  25.                                         // needs to keep the midi data resident in
  26.                                         // memory
  27.  
  28. // T Y P E D E F S //////////////////////////////////////////////////////////
  29.  
  30.  
  31.  
  32. // the DIGIPAK sound structure
  33.  
  34. typedef struct SNDSTRUC_typ
  35.           {
  36.  
  37.           unsigned char far *sound;  // a pointer to the raw sound data
  38.           unsigned short sndlen;      // the length of the sound data in bytes
  39.           short far *IsPlaying;       // a pointer to a variable that will be
  40.                                                 // used to hold the status of a playing
  41.                                                 // sound
  42.           short frequency;            // the frequency in hertz that the
  43.                                                 // sound should be played at
  44.  
  45.           } SNDSTRUC, *SNDSTRUC_PTR;
  46.  
  47.  
  48. // our high level sound structure
  49.  
  50. typedef struct sound_typ
  51.           {
  52.           unsigned char far *buffer;   // pointer to the start of VOC file
  53.  
  54.           short status;                // the current status of the sound
  55.  
  56.           SNDSTRUC SS;                 // the DIGIPAK sound structure
  57.  
  58.           } _sound, *_sound_ptr;
  59.  
  60.  
  61. // this holds a midi file
  62.  
  63. typedef struct music_typ
  64.           {
  65.  
  66.           unsigned char far *buffer;   // pointer to midi data
  67.           long size;                   // size of midi file in bytes
  68.           int status;                  // status of song
  69.           int register_info;           // return value of RegisterXmidiFile
  70.  
  71.           } music, *music_ptr;
  72.  
  73. // E X T E R N A L S ////////////////////////////////////////////////////////
  74.  
  75.  
  76. // P R O T O T Y P E S  /////////////////////////////////////////////////////
  77.  
  78. int Sound_Load(char *filename, _sound_ptr sound,int translate);
  79.  
  80. void Sound_Unload(_sound_ptr the_sound);
  81.  
  82. void Sound_Translate(_sound_ptr the_sound);
  83.  
  84. void Sound_Play(_sound_ptr the_sound);
  85.  
  86. int Sound_Status(void);
  87.  
  88. void Sound_Stop(void);
  89.  
  90.  
  91.  
  92. int Music_Load(char *filename, music_ptr the_music);
  93.  
  94. void Music_Unload(music_ptr the_music);
  95.  
  96. int Music_Register(music_ptr the_music);
  97.  
  98. void Music_Stop(void);
  99.  
  100. int Music_Play(music_ptr the_music,int sequence);
  101.  
  102. void Music_Resume(void);
  103.  
  104. int Music_Status(void);
  105.  
  106.  
  107.  
  108.