PLAYCD.H (9198B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /*************************************************************************** 17 ** 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 ** 18 *************************************************************************** 19 * * 20 * Project Name : WWLIB * 21 * * 22 * File Name : PLAYCD.H * 23 * * 24 * Programmer : STEVE WETHERILL * 25 * * 26 * Start Date : 5/13/94 * 27 * * 28 * Last Update : June 4, 1994 [SW] * 29 * * 30 *-------------------------------------------------------------------------*/ 31 32 #ifndef PLAYCD_H 33 #define PLAYCD_H 34 35 36 #ifdef NOT_FOR_WIN95 37 /* ==================================================================== */ 38 /* Defines */ 39 /* ==================================================================== */ 40 41 #define CHLEFT 0 42 #define CHRIGHT 1 43 #define CHBOTH 2 44 45 #define AUDIO_START_MIN 1 46 #define AUDIO_START_SEC 44 47 48 typedef struct { 49 unsigned short seg ; 50 unsigned short sel ; 51 } SEGSEL ; 52 53 54 55 56 extern "C" int DPMI_real_alloc ( UINT , SEGSEL * , USHORT * ) ; 57 extern "C" int DPMI_real_free ( SEGSEL ) ; 58 extern "C" void DPMI_real_intr ( int , union REGS * , struct SREGS * ); 59 extern "C" void DPMI_real_call ( void * funct , union REGS * , struct SREGS * ); 60 61 62 63 64 /* ==================================================================== */ 65 /* Data structures */ 66 /* ==================================================================== */ 67 68 // Audio Track Info request block 69 70 struct TinfoType { 71 UBYTE Length; 72 UBYTE SubCd; 73 UBYTE Command; 74 UWORD Status; 75 UBYTE Rsvd[8]; 76 UBYTE MDescr; 77 78 UWORD TrnsAdOff; 79 UWORD TrnsAdSeg; 80 81 UWORD CntTrns; 82 UWORD StSect; 83 84 UWORD VolIDOff; 85 UWORD VolIDSeg; 86 87 UBYTE TrInfo; 88 UBYTE Track; 89 ULONG Start; 90 UBYTE TrCtrl; 91 }; 92 93 // Audio Track Status Control Block 94 95 struct StatType { 96 UBYTE Length; 97 UBYTE SubCd; 98 UBYTE Command; 99 UWORD Status; 100 UBYTE Rsvd[8]; 101 UBYTE MDescr; 102 103 UWORD TrnsAdOff; 104 UWORD TrnsAdSeg; 105 106 UWORD CntTrns; 107 UWORD StSect; 108 109 UWORD VolIDOff; 110 UWORD VolIDSeg; 111 112 UBYTE StatInfo; 113 UWORD Stat; 114 ULONG Start; 115 ULONG End; 116 }; 117 118 // Audio Track Volume control block 119 120 struct VolmType { 121 UBYTE Length; 122 UBYTE SubCd; 123 UBYTE Command; 124 UWORD Status; 125 UBYTE Rsvd[8]; 126 UBYTE MDescr; 127 128 UWORD TrnsAdOff; 129 UWORD TrnsAdSeg; 130 131 UWORD CntTrns; 132 UWORD StSect; 133 134 UWORD VolIDOff; 135 UWORD VolIDSeg; 136 137 UBYTE TrInfo; 138 UBYTE In0; 139 UBYTE Vol0; 140 UBYTE In1; 141 UBYTE Vol1; 142 UBYTE In2; 143 UBYTE Vol2; 144 UBYTE In3; 145 UBYTE Vol3; 146 }; 147 148 // Audio Track Play request block 149 150 struct PlayType { 151 UBYTE Length; 152 UBYTE SubCd; 153 UBYTE Command; 154 UWORD Status; 155 UBYTE Rsvd[8]; 156 UBYTE AddrMd; 157 ULONG Start; 158 ULONG CntSect; 159 }; 160 161 162 // Audio Track Stop request block 163 164 struct StopType { 165 UBYTE Length; 166 UBYTE SubCd; 167 UBYTE Command; 168 UWORD Status; 169 UBYTE Rsvd[8]; 170 }; 171 172 #endif //NOT_FOR_WIN95 173 174 /*************************************************************************** 175 * GetCDClass -- object which will return logical CD drive * 176 * * 177 * HISTORY: * 178 * 06/04/1994 SW : Created. * 179 *=========================================================================*/ 180 181 #define MAX_CD_DRIVES 26 182 #define NO_CD_DRIVE -1 183 184 class GetCDClass { 185 186 protected: 187 188 int CDDrives[MAX_CD_DRIVES]; //Array containing CD drive letters 189 int CDCount; //Number of available CD drives 190 int CDIndex; 191 192 public: 193 194 195 GetCDClass(VOID); // This is the default constructor 196 ~GetCDClass(VOID); // This is the destructor 197 198 inline int Get_First_CD_Drive(void); 199 inline int Get_Next_CD_Drive(void); 200 inline int Get_Number_Of_Drives(void) {return (CDCount);}; 201 202 }; 203 204 205 206 /*********************************************************************************************** 207 * GCDC::Get_Next_CD_Drive -- return the logical drive number of the next CD drive * 208 * * 209 * * 210 * * 211 * INPUT: Nothing * 212 * * 213 * OUTPUT: Logical drive number of a cd drive or -1 if none * 214 * * 215 * WARNINGS: None * 216 * * 217 * HISTORY: * 218 * 5/21/96 3:50PM ST : Created * 219 *=============================================================================================*/ 220 inline int GetCDClass::Get_Next_CD_Drive(void) 221 { 222 if (CDCount){ 223 if (CDIndex == CDCount) CDIndex = 0; 224 return (CDDrives[CDIndex++]); 225 }else{ 226 return (-1); 227 } 228 } 229 230 231 232 /*************************************************************************** 233 * GCDC::Get_First_CD_Drive -- return the number of the first CD drive * 234 * * 235 * * 236 * * 237 * INPUT: * 238 * none * 239 * OUTPUT: * 240 * logical drive number * 241 * WARNINGS: * 242 * * 243 * HISTORY: * 244 * 05/26/1994 SW : Created. * 245 * 12/4/95 ST : fixed for Win95 * 246 *=========================================================================*/ 247 inline int GetCDClass::Get_First_CD_Drive(void) 248 { 249 CDIndex = 0; 250 return (Get_Next_CD_Drive()); 251 } 252 253 254 255 256 257 258 /*************************************************************************** 259 * RedBookClass -- adds red book functionality * 260 * * 261 * this class inherits from GetCDClass and adds red book play functionality* 262 * * 263 * * 264 * HISTORY: * 265 * 06/04/1994 SW : Created. * 266 *=========================================================================*/ 267 268 #ifdef NOT_FOR_WIN95 269 class RedBookClass : public GetCDClass { 270 271 private: 272 273 SEGSEL Tinfo_addrp; 274 SEGSEL Stat_addrp; 275 SEGSEL Stop_addrp; 276 SEGSEL Volm_addrp; 277 SEGSEL Play_addrp; 278 279 StopType Stop; 280 PlayType Play; 281 VolmType Volm; 282 StatType Stat; 283 TinfoType Tinfo; 284 285 public: 286 287 RedBookClass(VOID); // This is the default constructor 288 ~RedBookClass(VOID); // This is the destructor 289 290 ULONG RedToHS(ULONG i); 291 ULONG MSFtoRed(UBYTE m, UBYTE s, UBYTE f); 292 VOID FullCDVolume(UBYTE chan); 293 VOID PlayTrack(UWORD track); 294 VOID Play_CD_MSL(UWORD min_sec, UWORD len); 295 VOID PlayMSF(UBYTE startM, UBYTE startS, UBYTE startF, 296 UBYTE endM, UBYTE endS, UBYTE endF, UBYTE chan); 297 UWORD CheckCDMusic(VOID); 298 VOID StopCDMusic(VOID); 299 300 }; 301 302 #endif //NOT_FOR_WIN95 303 /***************************** End of Playcd.h ****************************/ 304 305 #endif // PLAYCD_H 306