1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
|
// ----------------------------------------------
// - DAC32.DLL Header Datei -
// - Written 1996-1998 by Christoph Schmelnik -
// ----------------------------------------------
// Changes
// ===========
// Version 1.2 :
// -CMapDrive supports now up to 34 Host Adapters, because now it could access the drives under
// NT with the DeviceControl Interface
// The required information for this is coded as:
// Drives accessed over the new Interface have a HostAdapterNumber above or equal to the
// NumberOfHostAdapters (global Information).
// The ID consists of the good old drive number, like in DOS.
// The LUN is not used for the configuration, but it is used to hold the open handle to the device
// The Burstmodus couldn't be used with the new access mode, so the default setting for those
// drives is the Normal-mode. (For those drives is no difference between Burst- and Normal-mode)
// -LoadASPI checks now the Windows Version and hold this result global in the DLL
// -The Constructor of CSCSCD opens the handles to the new devices
// -The destructor closes those handles
// Interface changes are not required but some values must be handled differnt to avoid
// misconfiguring, e.g. it is not allowed to configure the new drives ID, LUN, and HostAdapterNumber
// -A bug in CWaveSave regarding conversion to mixed mono has been fixed.
//
// Version 1.33 : 18.01.1998
// Changes:
// Added speed selection support for all current Plextor drives
//
// Version 1.40 : 24.02.1998
// Changes:
// Set correct direction flags, to work with NT device IO interface and ATAPI drives
// Changed main CD detection to TestUnitReady
// Removed CD detection from Audio Status Info
// Added hopefully correct read command for Matsushita/Panasonic drives
// Added Parameters to CDAC class to allow the disabling of the audio test and to spin up the drive for a specified time
// in seconds to avoid spin up problems on some drives. Both parameters have default values so it behaves like the old version
// without the additional parameters
// Added Parameter to the constructor of CWaveSave to disable writing any Headers. Also this parameter has a default to work like
// before.
// Added virtual function in CDAC to report buffer underruns in Burst Copy Mode
// For the last feature an immediate parameter in WaitCDDA is added
// GetLastSense function added to return the sense information for the last read audio command
// Configuration in CMapDrive extended by new features
// Fixed GetRedBook operator in CCDAdress
// Added function to CD Class to read Media Cataloge Number
//
// Version 1.41 : 28.04.1998
// Changes:
// New GetInfoEx() function in CMapDrive, to allow a better result checking.
//
// Version 1.42 : 02.08.1998
// Changes:
// Added GetLastReadableAddress function to get the last readable Sektor of a session.
// Added a flag in the drive properties for the function.
// Added this function to the CDAC object.
//
// Version 1.43 : 23.12.1998
// Changes:
// Added Wave and DAC classes are now available in a MT version, the old versions will not longer be updated.
//
// Version 1.44 : 10.03.1999
// Changes:
// Added Support for current Plextor CDROM drives and CD-Writers.
// Added Support for Jukeboxes
// Changed Handling of the Ringbuffer
//
// Version 1.45 : 15.08.1999
// Changes:
// Added Enhanced error detection for Plextor drives.
// Several Bugfixes (initialising under NT and Ringbuffer specific)
//
// Version 1.45-Build 11 : 11.11.1999
// Changes:
// Added a check for the MaxSektor parameter in CBaseWaveMT to avoid Program failures even if the applications provides an invalid value.
// Changed source to comile with Borland compiler
// Added MMC-2 Type which will be default for Sony CD-Writers 140 and 928
// Skip Virtual CD devices in Bus scan
// Fixed Array out of bound bug in drive detection.
#ifndef _DAC32_H
#define _DAC32_H
#ifndef STRICT
#define STRICT // Use strct typechecking
#define WIN32_LEAN_AND_MEAN // compile only important Headerfiles
#endif
#include <windows.h>
#include <stdio.h>
#include "aspifunc.h"
/*#ifdef DLL
#define DACDLL __declspec(dllexport)
#else
#define DACDLL __declspec(dllimport)
#endif*/
#define DACDLL
#ifdef _DEBUG
#define DBGOUT(sz) OutputDebugString(sz)
#else
#define DBGOUT(sz)
#endif
//The Errormessages for the CD and DAC Classes
#define CDOK 0x000
#define CDUnknownDrive 0x001
#define CDDriveNotReady 0x002
#define CDUnknownCommand 0x003
#define CDSeekError 0x006
#define CDSectorNotFound 0x008
#define CDReadError 0x00B
#define CDGeneralError 0x00C
#define CDNoCD 0x00E
#define CDIllegalCDChange 0x00F
#define CDDriveNotFound 0x100
#define CDNoMemory 0x101
#define CDDACUnable 0x102
#define CDASPIError 0x103
#define CDUserBreak 0x104
#define CDTimeOut 0x105
//The Errormessage for the wave classes
#define WAVEFileOpenError 0x200
#define WAVEFileWriteError 0x201
#define WAVEChannelError 0x202
#define WAVEBitsError 0x203
#define WAVEFreqError 0x204
#define WAVENameError 0x205
#define WAVEMemoryError 0x206
//The supported base drive types
#define CDTYPE_TOSHIBA 0
#define CDTYPE_SONY 1
#define CDTYPE_NEC 2
#define CDTYPE_PHILIPS 3
#define CDTYPE_ATAPI 4
#define CDTYPE_TOSHNEW 5
#define CDTYPE_RICOH 6
#define CDTYPE_MATSHITA 7
#define CDTYPE_PLEXTOR 8
#define CDTYPE_CYBERDRV 9
#define JUKETYPE_SONY 0
#define JUKETYPE_PIONEER 1
//Amount of predefined drive mappings (relationship between real drives and base drive types)
#define MaxMappings 22 // pgo
//Amount of predefined jukebox mappings (relationship between real jukeboxes and base jukebox types)
#define MaxMappingsJuke 2
//The possible Copy modes
#define ModeNormal 0
#define ModeSynch 1
#define ModeBurst 2
//The possible Values for the DA Test
#define DATEST_ALLWAYS 0
#define DATEST_FIRSTTRACK 1
#define DATEST_NEVER 2
//The possible SpinUp modes
#define SPINUP_ALLWAYS 0
#define SPINUP_FIRSTTRACK 1
#define SPINUP_NEVER 2
// Amount of DWORD for the synchronisation
#define SynLen 512
// The Class for the Addressformats
class DACDLL CCDAdress
{
public:
void SetRedbook(long Value);
void SetHSG(long Value)
{
Adresse=Value;
};
long GetHSG()
{
return Adresse;
};
long GetRedbook()
{
long t;
t=(Adresse % 75)<<24;
t+=((Adresse / 75) % 60)<<16;
t+=((Adresse / 75) / 60)<<8;
return t;
};
CCDAdress &operator = (const CCDAdress &other)
{
Adresse=other.Adresse;
return (*this);
};
CCDAdress &operator + (const long Value)
{
Adresse+=Value;
return (*this);
};
CCDAdress &operator - (const long Value)
{
Adresse-=Value;
return (*this);
};
CCDAdress &operator += (const long Value)
{
Adresse+=Value;
return (*this);
};
CCDAdress &operator -= (const long Value)
{
Adresse-=Value;
return (*this);
};
private:
long Adresse;
};
// Typendeclarations
struct TDriveStatus
{
int DoorOpen; //Door open/closed
int DoorLocked; //Door locked/unlocked
int Cooked_RAW; //supports Cooked and RAW or Cooked
int Read_Write; //supports read and write
int Data_Audio_Video; //supports Data/Audio/Video or only Data
int Interleave; //supports Interleave regarding ISO
int CommandPrefetch; //supports Command Prefetching
int AudioChannelManipulation; //supports Audio-Channel Manipulation
int HSG_Redbook; //supports HSG and Redbook Addressing or only HSG
int CDPresent; //CD inserted or not
int RWSupport; //supports R-W-Sub Channels
};
struct TAudioStatus
{
BOOL Pause; //Play is paused
BOOL IsPlaying; //CD is playing
BOOL IsDone; //Play is stopped
BOOL PlayError; //Play completed with error
int TrackNummer; //Number of actual track
CCDAdress AbsSektor,RelSektor; //Startsector and Endsector of last/next Play
};
struct TTrackFlag
{
BYTE AudioChannels; //Amount of Audio Channels (2/4)
BOOL PreEmphasis; //Audio Channel with or without...
BOOL DataTrack; //Data track or Audio track
BOOL CopyProhibeted; //Digital copy prohibited
};
struct TTrackList
{
BYTE TrackNummer; //Number of Track
CCDAdress StartSektor; //First sector in HSG Format
long Laenge; //Amount of Sectors
TTrackFlag Flags;
};
struct TTrackListeMem
{
TTrackList Info;
TTrackListeMem *Prev,*Next;
};
struct TDriveInfo
{
int ID;
int LUN;
int HostAdapterNumber;
int Type;
int MaxSektors;
int SynchSektors;
int Mode;
char VendorID[9];
char ProductID[17];
int Speed;
int PerformDATest;
int SpinUpMode;
DWORD dwSpinUpTime;
BOOL bUseLastReadableAddress;
BOOL bUseC2ErrorInfo;
BOOL bSpinDown;
};
struct TJukeInfo
{
int ID;
int LUN;
int HostAdapterNumber;
int Type;
int MaxDrives;
int *pConnectedDrives;
int MaxDiscs;
char VendorID[9];
char ProductID[17];
};
// The class with the infos for the type mapping
class DACDLL CMapInfo
{
public:
CMapInfo();
char *GetTypName(int Index);
int GetTypMapping(int Index);
int GetTypMappingRev(int CDType);
private:
char TypNamen[MaxMappings][9];
int TypMapping[MaxMappings];
};
// The class with the infos for the type mapping
class DACDLL CMapInfoJuke
{
public:
CMapInfoJuke();
char *GetTypName(int Index);
int GetTypMapping(int Index);
int GetTypMappingRev(int JukeType);
private:
char TypNamen[MaxMappingsJuke][9];
int TypMapping[MaxMappingsJuke];
};
// The base class (pure virtual) for the CD access
class DACDLL CBaseCD
{
public:
int Lasterror();
virtual void PrepareCDDA()=0;
virtual void ReadCDDA(CCDAdress StartSektor,long Sektoranzahl,void *Buffer,BOOL bUseC2ErrorInfo=FALSE)=0;
virtual BOOL WaitCDDA(BOOL bImmediate=FALSE)=0;
virtual void FinishCDDA()=0;
virtual void SortWaveData(DWORD *Data,int Samples)=0;
virtual CCDAdress GetErrorAdress()=0;
virtual void Play_Audio(CCDAdress StartSektor,long Sektoranzahl)=0;
virtual void Stop_Audio()=0;
virtual void Pause_Audio()=0;
virtual void Resume_Audio()=0;
virtual TDriveStatus Get_DriveStatus()=0;
virtual BOOL MediaChanged()=0;
virtual void Get_MediaCatalogNumber(char szUPC[16])=0;
virtual void EjectDisk()=0;
virtual void LockDoor(int Lock)=0;
virtual void CloseTray()=0;
virtual void ReRead()=0;
virtual CCDAdress GetLastReadableAddress(CCDAdress StartSektor)=0;
virtual int GetMaxSektors()=0;
virtual int GetSynchSektors()=0;
virtual int GetMode()=0;
virtual int GetSpeed()=0;
virtual void InitSpeedTable()=0;
virtual BYTE GetSupportedSpeeds()=0;
virtual int GetCurrentSpeed()=0;
virtual void SetCurrentSpeed(int Speed)=0;
virtual int GetSpeed(BYTE Index)=0;
int ReadFirstTrackInfo(TTrackList &Infos);
int ReadNextTrackInfo(TTrackList &Infos);
int ReadPrevTrackInfo(TTrackList &Infos);
int ReadTrackInfo(TTrackList &Infos);
int ReadMaxTracks();
protected:
int Error,BusyFlag,DoneFlag;
TTrackListeMem *FirstTrack,*AktTrack;
void DeleteTrackList();
private:
CBaseCD& operator = (const CBaseCD &other);
};
// The class for the access to SCSI drives
class DACDLL CSCSICD:public CBaseCD
{
public:
CSCSICD (char drive, TDriveInfo &xInfo);
~CSCSICD();
virtual void PrepareCDDA();
virtual void ReadCDDA(CCDAdress StartSektor,long Sektoranzahl,void *Buffer,BOOL bUseC2ErrorInfo=FALSE);
virtual BOOL WaitCDDA(BOOL bImmediate=FALSE);
virtual void FinishCDDA();
virtual void SortWaveData(DWORD *Data,int Samples);
virtual CCDAdress GetErrorAdress();
virtual void Play_Audio(CCDAdress StartSektor,long Sektoranzahl);
virtual void Stop_Audio();
virtual void Pause_Audio();
virtual void Resume_Audio();
virtual TDriveStatus Get_DriveStatus();
virtual BOOL MediaChanged();
virtual TAudioStatus Get_AudioStatus_Info();
virtual void Get_MediaCatalogNumber(char szUPC[16]);
virtual void EjectDisk();
virtual void LockDoor(int Lock);
virtual void CloseTray();
virtual void ReRead();
virtual CCDAdress GetLastReadableAddress(CCDAdress StartSektor);
virtual int GetMaxSektors();
virtual int GetSynchSektors();
virtual int GetMode();
virtual int GetSpeed();
virtual void InitSpeedTable();
virtual BYTE GetSupportedSpeeds();
virtual int GetCurrentSpeed();
virtual void SetCurrentSpeed(int Speed);
virtual int GetSpeed(BYTE Index);
TDriveInfo &GetInfo()
{
return Config;
};
TSenseInfo GetSense();
TSenseInfo GetLastSenseInfo();
private:
CSCSICD& operator = (const CSCSICD &other);
TDriveInfo &Config; // Drive Configuration
BOOL CDPresentLast,Changed; // Helpvariables for the MediaChanged function
SRB_ExecSCSICmd ReadSRB; // SCSI Commando Block
TDriveMode ModeData;
BYTE NECRotationSpeed;
CMapInfo MapInfo;
DWORD StartReadTime;
int SpeedTable[256];
BYTE SupportedSpeeds;
HANDLE m_hDriveEvent;
TSenseInfo m_SenseInfo;
BOOL m_bSpeedTableInitialized;
};
// The base class for saving/converting the audio data
class DACDLL CBaseWave
{
public:
int Lasterror();
virtual void WritePuffer(long Samples,DWORD *Buffer)=0;
protected:
int Error; //last occured error
private:
CBaseWave& operator = (const CBaseWave &other);
};
typedef struct
{
BOOL bIsUsed; //Is Buffer used?
BOOL bReady; //Is Nuffer ready to write?
int nSamples; //Number of Samples in Buffer.
int nZeroSamples; //Number of Silence Samples to insert before the buffer
DWORD *dwBuffer; //Buffer for Audio Data
} WAVEBUFFER, *PWAVEBUFFER;
typedef struct _WAVEBUFFERLIST
{
PWAVEBUFFER pWaveBuffer;
_WAVEBUFFERLIST *pNext;
} WAVEBUFFERLIST, *PWAVEBUFFERLIST;
typedef struct
{
HANDLE hEvent;
LPVOID pData;
} TWAVEMTSTRUCT;
// The base class for saving/converting the audio data as its own thread
class DACDLL CBaseWaveMT
{
public:
CBaseWaveMT(DWORD dwBufferSize,BOOL bUseHighPriority=FALSE,int MaxSektors=27,DWORD dwExtraBytes=0);
~CBaseWaveMT();
void SetFadeInOut(int dwTotalSamples,int dwFadeSamples);
PWAVEBUFFER GetBuffer(); //returns NULL if no Buffer is available
void SignalBuffer(); //signal if a buffer is filled;
int Lasterror();
double GetBufferFullRatio();
DWORD GetBytesInBuffer();
virtual void WritePuffer(long Samples,DWORD *Buffer)=0;
friend unsigned _stdcall WaveThreadProc(LPVOID pUserData);
protected:
int Error; //last occured error
void StartThread(); //call this from your own initialisation function
BOOL WriteData();
void StopThread(BOOL bImmediate=FALSE); //call this from your own cleanup function
private:
CBaseWaveMT& operator = (const CBaseWaveMT &other);
DWORD m_Nullen[256];
PWAVEBUFFERLIST m_pFirstBuffer, m_pReadBuffer, m_pWriteBuffer;
TWAVEMTSTRUCT m_WaveInfo;
BOOL m_bStopThread,m_bAbortThread,m_bIsWorking;
HANDLE m_hWaveThread;
BOOL m_bUseHighPriority;
int m_dwTotalSamples,m_dwFadeSamples,m_dwCurrentSample;
int m_nBufferNum,m_nReadBufferNum,m_nWriteBufferNum;
int m_nMaxSektors;
};
// The class for saving audio data in a wave file
class DACDLL CWaveSave:public CBaseWave
{
public:
CWaveSave(const char *DateiName,BYTE Freq,BYTE Channels,BYTE Bits,BOOL bWriteHeaders=TRUE);
~CWaveSave();
virtual void WritePuffer(long Samples,DWORD *Buffer);
private:
void WMono8(long Samples,DWORD *Buffer);
void WStereo8(long Samples,DWORD *Buffer);
void WMono16(long Samples,DWORD *Buffer);
void WStereo16(long Samples,DWORD *Buffer);
void WLR8(long Samples,int Mode,DWORD *Buffer);
void WLR16(long Samples,int Mode,DWORD *Buffer);
CWaveSave& operator = (const CWaveSave &other);
BYTE ConvertType; //CodeNumber of the conversion type
FILE *Datei; //file variable to access the wave file
WORD *DPM16; //Pointer to the file data buffer
BYTE *DPM8; //Pointer to the file data buffer
DWORD *DPS16; //Pointer to the file data buffer
BYTE *DPS8; //Pointer to the file data buffer
int DatenCount; //Counter of data in buffer
long WaveBytes; //Counts all written bytes
BYTE SAdd; //Value to increment the source counter
BOOL m_bWriteHeaders; //Write Headers of Wave file
};
// The class for saving audio data in a wave file in its own thread
class DACDLL CWaveSaveMT:public CBaseWaveMT
{
public:
CWaveSaveMT(DWORD dwBufferSize,BOOL bUseHighPriority=FALSE,int MaxSektors=27,DWORD dwExtraBytes=0):CBaseWaveMT(dwBufferSize,bUseHighPriority,MaxSektors,dwExtraBytes)
{
};
void Init(const char *DateiName,BYTE Freq,BYTE Channels,BYTE Bits,BOOL bWriteHeaders=TRUE);
void Done(BOOL bImmediate=FALSE);
virtual void WritePuffer(long Samples,DWORD *Buffer);
private:
void WMono8(long Samples,DWORD *Buffer);
void WStereo8(long Samples,DWORD *Buffer);
void WMono16(long Samples,DWORD *Buffer);
void WStereo16(long Samples,DWORD *Buffer);
void WLR8(long Samples,int Mode,DWORD *Buffer);
void WLR16(long Samples,int Mode,DWORD *Buffer);
CWaveSave& operator = (const CWaveSave &other);
BYTE ConvertType; //CodeNumber of the conversion type
FILE *Datei; //file variable to access the wave file
WORD *DPM16; //Pointer to the file data buffer
BYTE *DPM8; //Pointer to the file data buffer
DWORD *DPS16; //Pointer to the file data buffer
BYTE *DPS8; //Pointer to the file data buffer
int DatenCount; //Counter of data in buffer
long WaveBytes; //Counts all written bytes
BYTE SAdd; //Value to increment the source counter
BOOL m_bWriteHeaders; //Write Headers of Wave file
};
// The class for copying the audio data from CD.
class DACDLL CDAC
{
public:
CDAC(CBaseCD *pDrive,CBaseWave *pWave,
CCDAdress Start,long Laenge,BOOL xKillZeros,BOOL bPerformDATest=TRUE,DWORD dwSpinUpTime=0,BOOL bUseLastReadableAddress=FALSE);
~CDAC();
int Lasterror();
void Copy();
int Errors();
void StopCopy();
// The following member functions are declared as virtual. They could be used to display
// information to the user. They do nothing by default.
virtual void WriteInit();
virtual void WritePercent(float Percent);
virtual void WriteReading();
virtual void WriteReadingEnd();
virtual void WriteSynch();
virtual void WriteSynchEnd();
virtual void WriteFlushing();
virtual void WriteFlushingEnd();
virtual void WriteSynchError();
virtual void WriteBufferUnderrun(CCDAdress Start);
virtual void WriteReRead(CCDAdress Start,long Laenge);
virtual void WriteSektorsSkipped(CCDAdress Start,long Laenge);
virtual void WriteDone();
virtual void OnIdle();
protected:
CCDAdress StartSektor,StartOld;
int SynchErrors,Error;
long Anzahl,AnzahlOld,Remain;
private:
CBaseCD *m_pCD;
BOOL RunCopy,KillFirst,KillLast,KillZero,Found;
DWORD m_dwSpinUpTime;
CBaseWave *m_pWaveSave;
long SektorAnzahl,Retries,SynchDiff,ZeroCount;
DWORD *MemBlocks[2];
int BlockCount,S_Offset;
int SpeedSave;
DWORD m_Nullen[256];
void ReadCDDA(CCDAdress Start,long Sektoranzahl,void *Buffer);
void FlushWave();
void FlushSynch(int Samples,DWORD *Data);
void MakeTable(DWORD *Werte,DWORD *Table);
int SynchSearch(DWORD *String1,DWORD *String2,DWORD *Table);
void SynchWave();
CDAC& operator = (const CDAC &other);
};
// The class for copying the audio data from CD.
class DACDLL CDACMT
{
public:
CDACMT(CBaseCD *pDrive,CBaseWaveMT *pWave,
CCDAdress Start,long Laenge,BOOL xKillZeros,BOOL bPerformDATest=TRUE,DWORD dwSpinUpTime=0,BOOL bUseHighPriority=FALSE,BOOL bUseC2ErrorInfo=FALSE,BOOL bSpinDown=FALSE,BOOL bUseLastReadableAddress=FALSE);
~CDACMT();
int Lasterror();
void Copy();
int Errors();
void StopCopy();
// The following member functions are declared as virtual. They could be used to display
// information to the user. They do nothing by default.
virtual void WriteInit();
virtual void WritePercent(float Percent);
virtual void WriteReading();
virtual void WriteReadingEnd();
virtual void WriteSynch();
virtual void WriteSynchEnd();
virtual void WriteFlushing();
virtual void WriteFlushingEnd();
virtual void WriteSynchError();
virtual void WriteBufferUnderrun(CCDAdress Start);
virtual void WriteReRead(CCDAdress Start,long Laenge);
virtual void WriteSektorsSkipped(CCDAdress Start,long Laenge);
virtual void WriteDone();
virtual void OnIdle(BOOL bReturnFast=TRUE);
friend unsigned _stdcall DACThreadProc(LPVOID pUserData);
protected:
CCDAdress StartSektor,StartOld;
int SynchErrors,Error;
long Anzahl,AnzahlOld,Remain;
void CopyMT();
private:
CBaseCD *m_pCD;
BOOL RunCopy,KillFirst,KillLast,KillZero,Found;
DWORD m_dwSpinUpTime;
CBaseWaveMT *m_pWaveSave;
BOOL m_bUseC2ErrorInfo;
BOOL m_bSpinDown;
long SektorAnzahl,Retries,SynchDiff,ZeroCount;
PWAVEBUFFER MemBlocks[2];
int BlockCount,S_Offset;
int SpeedSave;
int m_MaxSektors;
int m_SynchSektors;
void ReadCDDA(CCDAdress Start,long Sektoranzahl,void *Buffer);
void FlushWave(int nMax=2);
void FlushSynch(int Samples,PWAVEBUFFER Data);
void MakeTable(DWORD *Werte,DWORD *Table);
int SynchSearch(DWORD *String1,DWORD *String2,DWORD *Table);
void SynchWave();
CDACMT& operator = (const CDACMT &other);
HANDLE m_hDACThread;
BOOL m_bUseHighPriority;
};
// The class for configuring the SCSI CDROM drives
class DACDLL CMapDrive
{
public:
CMapDrive(BOOL bDoReset=TRUE);
~CMapDrive();
void Reset();
int GetMaxDrives();
TDriveInfo &GetInfo(int index);
BOOL GetInfoEx(int index, TDriveInfo *&pInfo);
void DeleteInfo(int index);
int GetMaxHostAdapters();
int GetSupportedHostAdapterMemory(int index);
void SetSupportedHostAdapterMemory(int index,int Memory);
int GetMaxSektors(int HostAdapterNumber);
protected:
void DeleteAll();
private:
struct TDriveInfoMem
{
TDriveInfo Info;
TDriveInfoMem *Next;
};
TDriveInfoMem *First;
int HostAdapterMemory[34];
HANDLE m_hDriveEvent;
};
// The class for configuring the SCSI Jukeboxes
class DACDLL CMapJuke
{
public:
CMapJuke(BOOL bDoReset=TRUE);
~CMapJuke();
void Reset();
int GetMaxJukes();
TJukeInfo &GetInfo(int index);
BOOL IsWorking(int index);
void SetWorking(int index,BOOL bIsWorking);
void DeleteInfo(int index);
protected:
void DeleteAll();
private:
struct TJukeInfoMem
{
TJukeInfo Info;
BOOL bIsWorking;
TJukeInfoMem *Next;
};
TJukeInfoMem *First;
HANDLE m_hJukeEvent;
};
//The class to access Jukeboxes
class DACDLL CJukeBox
{
public:
CJukeBox (TJukeInfo &xInfo);
~CJukeBox();
//use following defines to address an item in the jukebox:
//drive0..x : 0x4000...0x400x
//storage1..xxx : 0x0001...0x0xxx
BOOL MoveMedium(int Source,int Destination);
TJukeInfo &GetInfo()
{
return Config;
};
private:
TJukeInfo &Config; // Drive Configuration
CMapInfoJuke MapInfo;
HANDLE m_hJukeEvent;
};
// ----------------------
// function declarations
// ----------------------
// initialize and deinatialize the WNASPI32.DLL and some internal flags
int DACDLL LoadASPI();
int DACDLL FreeASPI();
int DACDLL CheckASPI();
#endif //_DAC32_H
|