| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- unit MMCDRead;
- {$I COMPILER.INC}
- {$IFNDEF DONT_USE_DLL}
- {$DEFINE USECDDADLL}
- {$ENDIF}
- {.$DEFINE _MMDEBUG}
- {.$DEFINE _TESTDATA}
- interface
- uses
- Windows,
- SysUtils,
- Classes,
- Controls,
- Dialogs,
- Forms,
- MMSystem,
- MMObj,
- MMString,
- MMDSPObj,
- MMUtils,
- MMRegs,
- MMPCMSup,
- MMSCSI,
- MMCDATyp
- {$IFNDEF USECDDADLL}
- ,MMCDDA
- {$ENDIF}
- {$IFDEF _MMDEBUG}
- ,MMDebug
- {$ENDIF}
- ;
- const
- FORCE_GENERIC: Boolean = False;
- type
- EMMCDDAError = class(Exception);
- TMMCDReader = class;
- TMMCDStatus = (cdNotReady, cdStopped, cdPlaying, cdSeeking, cdPaused, cdOpen);
- TMMCDCopyMode = (cmNormal,cmBurst,cmSync);
- {----------------------------------------------------------------------------}
- PMMCDDeviceInfo = ^TMMCDDeviceInfo;
- TMMCDDeviceInfo = packed record
- DeviceName : string;
- DriveLetter: Char;
- DeviceType : TCDDeviceType;
- DeviceSpeed: integer;
- CopyMode : TMMCDCopyMode;
- end;
- {-- TMMDeviceList -----------------------------------------------------------}
- TMMCDDeviceList = class(TList)
- public
- destructor Destroy; override;
- procedure Assign(Value: TMMCDDeviceList);
- procedure Clear;
- property Items[Index: Integer]: PMMCDDeviceInfo read GetDeviceInfo; default;
- property Tag: integer read FTag write FTag;
- end;
- {-- TMMCDTrackList ----------------------------------------------------------}
- TMMCDTrackList = class
- public
- procedure Clear;
- property Count: integer read GetCount;
- property Items[Index: Integer]: TCDTrack read GetTrack; default;
- end;
- {-- TMMCDTextInfo -----------------------------------------------------------}
- TMMCDTextInfo = class
- public
- property Count: integer read GetBlockCount;
- property Items[Index: Integer]: TCDTextBlock read GetBlock; default;
- end;
- {-- TMMCDReader -------------------------------------------------------------}
- TMMCDReader = class(TMMDSPComponent)
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
- { true if we not work with ASPI drivers }
- property GenericInterface: Boolean read FGeneric;
- { cancels any read operation }
- procedure AbortReading;
- { functions to read audio data directly }
- procedure Open;
- procedure Start;
- procedure Reset;
- procedure Stop;
- procedure Close;
- function ReadAudioData(lpData: PChar; dwLength: Longint): Longint;
- { functions to Open/Close the device }
- procedure OpenDevice;
- procedure CloseDevice;
- { status and play functions (all time values MSF) }
- function DeviceReady: Boolean;
- function DeviceStatus: TMMCDStatus;
- function ReadTOC: Boolean;
- function ReadCDText: Boolean;
- function ReadISRC(Track: integer): string;
- function ReadUPC: string;
- procedure LockMedia(Lock: Boolean);
- procedure LoadMedia(Load: Boolean);
- function GetPosition: Longint;
- function GetCurrentTrack: integer;
- procedure PlayAudio(StartMSF, LengthMSF: Longint);
- procedure PlayTrack(aTrack: integer);
- procedure StopAudio;
- procedure PauseAudio;
- procedure ResumeAudio;
- { detect the supported speeds }
- procedure DetectSupportedSpeeds;
- { returns the detected speeds, property Speed.Objects is the speed in KB }
- property Speeds: TStringList read FSpeeds;
- { set the copy speed }
- function SetCopySpeed(Speed: Word): Boolean;
- { set the range which we should copy }
- procedure SetCopyParams(StartMSF, LengthMSF: integer);
- procedure SetCopyTrack(aTrack: integer);
- { returns a CDPlayer.ini CD-ID }
- property DiskID: Integer read GetDiskID;
- { some frame values for audio copy }
- property StartFrame: Longint read FStartFrame;
- property LastFrame: Longint read FLastFrame;
- property CurrentFrame: Longint read FCurrentFrame write SetCurrentFrame;
- { device and tracklist }
- property Devices: TMMCDDeviceList read FDevices;
- property Tracks: TMMCDTrackList read FTrackList;
- property CDText: TMMCDTextInfo read FCDTextInfo;
- property CanReadISRC: Boolean read GetISRCSupported;
- property CanReadCDDA: Boolean read GetCanReadCDDA;
- property CanReadExact: Boolean read GetCanReadAccurate;
- published
- property OnDataRead: TNotifyEvent read FOnDataRead write FOnDataRead;
- property OnDataReadEnd: TNotifyEvent read FOnDataReadEnd write FOnDataReadEnd;
- property Output;
- property Enabled: Boolean read FEnabled write FEnabled default True;
- property BlockCount: integer read FBlockCount write FBlockCount default 10;
- property CopyMode: TMMCDCopyMode read FCopyMode write SetCopyMode default cmNormal;
- property DeviceID: TMMDeviceID read FDeviceID write SetDeviceID;
- property DeviceName: string read GetDeviceName write SetDeviceName stored False;
- property DriveLetter: string read GetDriveLetter write SetDriveLetter stored False;
- property DeviceType: TCDDeviceType read GetDeviceType write SetDeviceType;
- property CopyVolume: integer read FVolume write SetVolume default VOLUMEBASE;
- property IgnoreSpeed: Boolean read FIgnoreSpeed write SetIgnoreSpeed default False;
- end;
- implementation
|