mmcdread.int 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. unit MMCDRead;
  2. {$I COMPILER.INC}
  3. {$IFNDEF DONT_USE_DLL}
  4. {$DEFINE USECDDADLL}
  5. {$ENDIF}
  6. {.$DEFINE _MMDEBUG}
  7. {.$DEFINE _TESTDATA}
  8. interface
  9. uses
  10. Windows,
  11. SysUtils,
  12. Classes,
  13. Controls,
  14. Dialogs,
  15. Forms,
  16. MMSystem,
  17. MMObj,
  18. MMString,
  19. MMDSPObj,
  20. MMUtils,
  21. MMRegs,
  22. MMPCMSup,
  23. MMSCSI,
  24. MMCDATyp
  25. {$IFNDEF USECDDADLL}
  26. ,MMCDDA
  27. {$ENDIF}
  28. {$IFDEF _MMDEBUG}
  29. ,MMDebug
  30. {$ENDIF}
  31. ;
  32. const
  33. FORCE_GENERIC: Boolean = False;
  34. type
  35. EMMCDDAError = class(Exception);
  36. TMMCDReader = class;
  37. TMMCDStatus = (cdNotReady, cdStopped, cdPlaying, cdSeeking, cdPaused, cdOpen);
  38. TMMCDCopyMode = (cmNormal,cmBurst,cmSync);
  39. {----------------------------------------------------------------------------}
  40. PMMCDDeviceInfo = ^TMMCDDeviceInfo;
  41. TMMCDDeviceInfo = packed record
  42. DeviceName : string;
  43. DriveLetter: Char;
  44. DeviceType : TCDDeviceType;
  45. DeviceSpeed: integer;
  46. CopyMode : TMMCDCopyMode;
  47. end;
  48. {-- TMMDeviceList -----------------------------------------------------------}
  49. TMMCDDeviceList = class(TList)
  50. public
  51. destructor Destroy; override;
  52. procedure Assign(Value: TMMCDDeviceList);
  53. procedure Clear;
  54. property Items[Index: Integer]: PMMCDDeviceInfo read GetDeviceInfo; default;
  55. property Tag: integer read FTag write FTag;
  56. end;
  57. {-- TMMCDTrackList ----------------------------------------------------------}
  58. TMMCDTrackList = class
  59. public
  60. procedure Clear;
  61. property Count: integer read GetCount;
  62. property Items[Index: Integer]: TCDTrack read GetTrack; default;
  63. end;
  64. {-- TMMCDTextInfo -----------------------------------------------------------}
  65. TMMCDTextInfo = class
  66. public
  67. property Count: integer read GetBlockCount;
  68. property Items[Index: Integer]: TCDTextBlock read GetBlock; default;
  69. end;
  70. {-- TMMCDReader -------------------------------------------------------------}
  71. TMMCDReader = class(TMMDSPComponent)
  72. public
  73. constructor Create(aOwner: TComponent); override;
  74. destructor Destroy; override;
  75. { true if we not work with ASPI drivers }
  76. property GenericInterface: Boolean read FGeneric;
  77. { cancels any read operation }
  78. procedure AbortReading;
  79. { functions to read audio data directly }
  80. procedure Open;
  81. procedure Start;
  82. procedure Reset;
  83. procedure Stop;
  84. procedure Close;
  85. function ReadAudioData(lpData: PChar; dwLength: Longint): Longint;
  86. { functions to Open/Close the device }
  87. procedure OpenDevice;
  88. procedure CloseDevice;
  89. { status and play functions (all time values MSF) }
  90. function DeviceReady: Boolean;
  91. function DeviceStatus: TMMCDStatus;
  92. function ReadTOC: Boolean;
  93. function ReadCDText: Boolean;
  94. function ReadISRC(Track: integer): string;
  95. function ReadUPC: string;
  96. procedure LockMedia(Lock: Boolean);
  97. procedure LoadMedia(Load: Boolean);
  98. function GetPosition: Longint;
  99. function GetCurrentTrack: integer;
  100. procedure PlayAudio(StartMSF, LengthMSF: Longint);
  101. procedure PlayTrack(aTrack: integer);
  102. procedure StopAudio;
  103. procedure PauseAudio;
  104. procedure ResumeAudio;
  105. { detect the supported speeds }
  106. procedure DetectSupportedSpeeds;
  107. { returns the detected speeds, property Speed.Objects is the speed in KB }
  108. property Speeds: TStringList read FSpeeds;
  109. { set the copy speed }
  110. function SetCopySpeed(Speed: Word): Boolean;
  111. { set the range which we should copy }
  112. procedure SetCopyParams(StartMSF, LengthMSF: integer);
  113. procedure SetCopyTrack(aTrack: integer);
  114. { returns a CDPlayer.ini CD-ID }
  115. property DiskID: Integer read GetDiskID;
  116. { some frame values for audio copy }
  117. property StartFrame: Longint read FStartFrame;
  118. property LastFrame: Longint read FLastFrame;
  119. property CurrentFrame: Longint read FCurrentFrame write SetCurrentFrame;
  120. { device and tracklist }
  121. property Devices: TMMCDDeviceList read FDevices;
  122. property Tracks: TMMCDTrackList read FTrackList;
  123. property CDText: TMMCDTextInfo read FCDTextInfo;
  124. property CanReadISRC: Boolean read GetISRCSupported;
  125. property CanReadCDDA: Boolean read GetCanReadCDDA;
  126. property CanReadExact: Boolean read GetCanReadAccurate;
  127. published
  128. property OnDataRead: TNotifyEvent read FOnDataRead write FOnDataRead;
  129. property OnDataReadEnd: TNotifyEvent read FOnDataReadEnd write FOnDataReadEnd;
  130. property Output;
  131. property Enabled: Boolean read FEnabled write FEnabled default True;
  132. property BlockCount: integer read FBlockCount write FBlockCount default 10;
  133. property CopyMode: TMMCDCopyMode read FCopyMode write SetCopyMode default cmNormal;
  134. property DeviceID: TMMDeviceID read FDeviceID write SetDeviceID;
  135. property DeviceName: string read GetDeviceName write SetDeviceName stored False;
  136. property DriveLetter: string read GetDriveLetter write SetDriveLetter stored False;
  137. property DeviceType: TCDDeviceType read GetDeviceType write SetDeviceType;
  138. property CopyVolume: integer read FVolume write SetVolume default VOLUMEBASE;
  139. property IgnoreSpeed: Boolean read FIgnoreSpeed write SetIgnoreSpeed default False;
  140. end;
  141. implementation