PLAYCD.H 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***************************************************************************
  19. ** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : WWLIB *
  23. * *
  24. * File Name : PLAYCD.H *
  25. * *
  26. * Programmer : STEVE WETHERILL *
  27. * *
  28. * Start Date : 5/13/94 *
  29. * *
  30. * Last Update : June 4, 1994 [SW] *
  31. * *
  32. *-------------------------------------------------------------------------*/
  33. #ifndef PLAYCD_H
  34. #define PLAYCD_H
  35. #ifdef NOT_FOR_WIN95
  36. /* ==================================================================== */
  37. /* Defines */
  38. /* ==================================================================== */
  39. #define CHLEFT 0
  40. #define CHRIGHT 1
  41. #define CHBOTH 2
  42. #define AUDIO_START_MIN 1
  43. #define AUDIO_START_SEC 44
  44. typedef struct {
  45. unsigned short seg ;
  46. unsigned short sel ;
  47. } SEGSEL ;
  48. extern "C" int DPMI_real_alloc ( UINT , SEGSEL * , USHORT * ) ;
  49. extern "C" int DPMI_real_free ( SEGSEL ) ;
  50. extern "C" void DPMI_real_intr ( int , union REGS * , struct SREGS * );
  51. extern "C" void DPMI_real_call ( void * funct , union REGS * , struct SREGS * );
  52. /* ==================================================================== */
  53. /* Data structures */
  54. /* ==================================================================== */
  55. // Audio Track Info request block
  56. struct TinfoType {
  57. UBYTE Length;
  58. UBYTE SubCd;
  59. UBYTE Command;
  60. UWORD Status;
  61. UBYTE Rsvd[8];
  62. UBYTE MDescr;
  63. UWORD TrnsAdOff;
  64. UWORD TrnsAdSeg;
  65. UWORD CntTrns;
  66. UWORD StSect;
  67. UWORD VolIDOff;
  68. UWORD VolIDSeg;
  69. UBYTE TrInfo;
  70. UBYTE Track;
  71. ULONG Start;
  72. UBYTE TrCtrl;
  73. };
  74. // Audio Track Status Control Block
  75. struct StatType {
  76. UBYTE Length;
  77. UBYTE SubCd;
  78. UBYTE Command;
  79. UWORD Status;
  80. UBYTE Rsvd[8];
  81. UBYTE MDescr;
  82. UWORD TrnsAdOff;
  83. UWORD TrnsAdSeg;
  84. UWORD CntTrns;
  85. UWORD StSect;
  86. UWORD VolIDOff;
  87. UWORD VolIDSeg;
  88. UBYTE StatInfo;
  89. UWORD Stat;
  90. ULONG Start;
  91. ULONG End;
  92. };
  93. // Audio Track Volume control block
  94. struct VolmType {
  95. UBYTE Length;
  96. UBYTE SubCd;
  97. UBYTE Command;
  98. UWORD Status;
  99. UBYTE Rsvd[8];
  100. UBYTE MDescr;
  101. UWORD TrnsAdOff;
  102. UWORD TrnsAdSeg;
  103. UWORD CntTrns;
  104. UWORD StSect;
  105. UWORD VolIDOff;
  106. UWORD VolIDSeg;
  107. UBYTE TrInfo;
  108. UBYTE In0;
  109. UBYTE Vol0;
  110. UBYTE In1;
  111. UBYTE Vol1;
  112. UBYTE In2;
  113. UBYTE Vol2;
  114. UBYTE In3;
  115. UBYTE Vol3;
  116. };
  117. // Audio Track Play request block
  118. struct PlayType {
  119. UBYTE Length;
  120. UBYTE SubCd;
  121. UBYTE Command;
  122. UWORD Status;
  123. UBYTE Rsvd[8];
  124. UBYTE AddrMd;
  125. ULONG Start;
  126. ULONG CntSect;
  127. };
  128. // Audio Track Stop request block
  129. struct StopType {
  130. UBYTE Length;
  131. UBYTE SubCd;
  132. UBYTE Command;
  133. UWORD Status;
  134. UBYTE Rsvd[8];
  135. };
  136. #endif //NOT_FOR_WIN95
  137. /***************************************************************************
  138. * GetCDClass -- object which will return logical CD drive *
  139. * *
  140. * HISTORY: *
  141. * 06/04/1994 SW : Created. *
  142. *=========================================================================*/
  143. #define MAX_CD_DRIVES 26
  144. #define NO_CD_DRIVE -1
  145. class GetCDClass {
  146. protected:
  147. int CDDrives[MAX_CD_DRIVES]; //Array containing CD drive letters
  148. int CDCount; //Number of available CD drives
  149. int CDIndex;
  150. public:
  151. GetCDClass(VOID); // This is the default constructor
  152. ~GetCDClass(VOID); // This is the destructor
  153. inline int Get_First_CD_Drive(void);
  154. inline int Get_Next_CD_Drive(void);
  155. inline int Get_Number_Of_Drives(void) {return (CDCount);};
  156. };
  157. /***********************************************************************************************
  158. * GCDC::Get_Next_CD_Drive -- return the logical drive number of the next CD drive *
  159. * *
  160. * *
  161. * *
  162. * INPUT: Nothing *
  163. * *
  164. * OUTPUT: Logical drive number of a cd drive or -1 if none *
  165. * *
  166. * WARNINGS: None *
  167. * *
  168. * HISTORY: *
  169. * 5/21/96 3:50PM ST : Created *
  170. *=============================================================================================*/
  171. inline int GetCDClass::Get_Next_CD_Drive(void)
  172. {
  173. if (CDCount){
  174. if (CDIndex == CDCount) CDIndex = 0;
  175. return (CDDrives[CDIndex++]);
  176. }else{
  177. return (-1);
  178. }
  179. }
  180. /***************************************************************************
  181. * GCDC::Get_First_CD_Drive -- return the number of the first CD drive *
  182. * *
  183. * *
  184. * *
  185. * INPUT: *
  186. * none *
  187. * OUTPUT: *
  188. * logical drive number *
  189. * WARNINGS: *
  190. * *
  191. * HISTORY: *
  192. * 05/26/1994 SW : Created. *
  193. * 12/4/95 ST : fixed for Win95 *
  194. *=========================================================================*/
  195. inline int GetCDClass::Get_First_CD_Drive(void)
  196. {
  197. CDIndex = 0;
  198. return (Get_Next_CD_Drive());
  199. }
  200. /***************************************************************************
  201. * RedBookClass -- adds red book functionality *
  202. * *
  203. * this class inherits from GetCDClass and adds red book play functionality*
  204. * *
  205. * *
  206. * HISTORY: *
  207. * 06/04/1994 SW : Created. *
  208. *=========================================================================*/
  209. #ifdef NOT_FOR_WIN95
  210. class RedBookClass : public GetCDClass {
  211. private:
  212. SEGSEL Tinfo_addrp;
  213. SEGSEL Stat_addrp;
  214. SEGSEL Stop_addrp;
  215. SEGSEL Volm_addrp;
  216. SEGSEL Play_addrp;
  217. StopType Stop;
  218. PlayType Play;
  219. VolmType Volm;
  220. StatType Stat;
  221. TinfoType Tinfo;
  222. public:
  223. RedBookClass(VOID); // This is the default constructor
  224. ~RedBookClass(VOID); // This is the destructor
  225. ULONG RedToHS(ULONG i);
  226. ULONG MSFtoRed(UBYTE m, UBYTE s, UBYTE f);
  227. VOID FullCDVolume(UBYTE chan);
  228. VOID PlayTrack(UWORD track);
  229. VOID Play_CD_MSL(UWORD min_sec, UWORD len);
  230. VOID PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF,
  231. UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan);
  232. UWORD CheckCDMusic(VOID);
  233. VOID StopCDMusic(VOID);
  234. };
  235. #endif //NOT_FOR_WIN95
  236. /***************************** End of Playcd.h ****************************/
  237. #endif // PLAYCD_H
  238.