_GUSWAVE.H 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /*
  2. Copyright (C) 1994-1995 Apogee Software, Ltd.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. /**********************************************************************
  16. file: _GUSWAVE.H
  17. author: James R. Dose
  18. date: March 23, 1994
  19. Private header for GUSWAVE.C
  20. (c) Copyright 1994 James R. Dose. All Rights Reserved.
  21. **********************************************************************/
  22. #ifndef ___GUSWAVE_H
  23. #define ___GUSWAVE_H
  24. #define TRUE ( 1 == 1 )
  25. #define FALSE ( !TRUE )
  26. #define LOADDS _loadds
  27. #define VOC_8BIT 0x0
  28. #define VOC_CT4_ADPCM 0x1
  29. #define VOC_CT3_ADPCM 0x2
  30. #define VOC_CT2_ADPCM 0x3
  31. #define VOC_16BIT 0x4
  32. #define VOC_ALAW 0x6
  33. #define VOC_MULAW 0x7
  34. #define VOC_CREATIVE_ADPCM 0x200
  35. #define MAX_BLOCK_LENGTH 0x8000
  36. #define GF1BSIZE 896L /* size of buffer per wav on GUS */
  37. //#define GF1BSIZE 512L /* size of buffer per wav on GUS */
  38. //#define VOICES 8 /* maximum amount of concurrent wav files */
  39. #define VOICES 2 /* maximum amount of concurrent wav files */
  40. #define MAX_VOICES 32 /* This should always be 32 */
  41. #define MAX_VOLUME 4095
  42. #define BUFFER 2048U /* size of DMA buffer for patch loading */
  43. typedef enum
  44. {
  45. Raw,
  46. VOC,
  47. DemandFeed,
  48. WAV
  49. } wavedata;
  50. typedef enum
  51. {
  52. NoMoreData,
  53. KeepPlaying,
  54. SoundDone
  55. } playbackstatus;
  56. typedef volatile struct VoiceNode
  57. {
  58. struct VoiceNode *next;
  59. struct VoiceNode *prev;
  60. wavedata wavetype;
  61. int bits;
  62. playbackstatus ( *GetSound )( struct VoiceNode *voice );
  63. int num;
  64. unsigned long mem; /* location in ultrasound memory */
  65. int Active; /* this instance in use */
  66. int GF1voice; /* handle to active voice */
  67. char *NextBlock;
  68. char *LoopStart;
  69. char *LoopEnd;
  70. unsigned LoopCount;
  71. unsigned long LoopSize;
  72. unsigned long BlockLength;
  73. unsigned long PitchScale;
  74. unsigned char *sound;
  75. unsigned long length;
  76. unsigned long SamplingRate;
  77. unsigned long RateScale;
  78. int Playing;
  79. int handle;
  80. int priority;
  81. void ( *DemandFeed )( char **ptr, unsigned long *length );
  82. unsigned long callbackval;
  83. int Volume;
  84. int Pan;
  85. }
  86. VoiceNode;
  87. typedef struct
  88. {
  89. VoiceNode *start;
  90. VoiceNode *end;
  91. }
  92. voicelist;
  93. typedef volatile struct voicestatus
  94. {
  95. VoiceNode *Voice;
  96. int playing;
  97. }
  98. voicestatus;
  99. typedef struct
  100. {
  101. char RIFF[ 4 ];
  102. unsigned long file_size;
  103. char WAVE[ 4 ];
  104. char fmt[ 4 ];
  105. unsigned long format_size;
  106. } riff_header;
  107. typedef struct
  108. {
  109. unsigned short wFormatTag;
  110. unsigned short nChannels;
  111. unsigned long nSamplesPerSec;
  112. unsigned long nAvgBytesPerSec;
  113. unsigned short nBlockAlign;
  114. unsigned short nBitsPerSample;
  115. } format_header;
  116. typedef struct
  117. {
  118. unsigned char DATA[ 4 ];
  119. unsigned long size;
  120. } data_header;
  121. playbackstatus GUSWAVE_GetNextVOCBlock( VoiceNode *voice );
  122. VoiceNode *GUSWAVE_GetVoice( int handle );
  123. int GUSWAVE_Play( VoiceNode *voice, int angle, int volume, int channels );
  124. VoiceNode *GUSWAVE_AllocVoice( int priority );
  125. static int GUSWAVE_InitVoices( void );
  126. #endif