| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Fax.: +49 (0)351-8037944 =}
- {= Loewenstr.7a = info@swiftsoft.de =}
- {========================================================================}
- {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
- {========================================================================}
- {= This code is for reference purposes only and may not be copied or =}
- {= distributed in any format electronic or otherwise except one copy =}
- {= for backup purposes. =}
- {= =}
- {= No Delphi Component Kit or Component individually or in a collection=}
- {= subclassed or otherwise from the code in this unit, or associated =}
- {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
- {= without express permission from SwiftSoft. =}
- {= =}
- {= For more licence informations please refer to the associated =}
- {= HelpFile. =}
- {========================================================================}
- {= $Date: 08.03.98 - 21:15:14 $ =}
- {========================================================================}
- unit MMPCX;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- SysUtils,
- Messages,
- Classes,
- Graphics,
- Controls,
- Forms,
- Dialogs,
- DsgnIntf,
- MMObj,
- MMUtils,
- MMMath,
- MMPropEd,
- MMObsrv,
- MMPCXTol,
- MMPCXLib;
- const
- IOAuto = 0;
- type
- EMMPCXError = class(Exception);
- {-- TMMPCXVersion ---------------------------------------------------------}
- TMMPCXVersion = class(TMMObject)
- published
- property DriverMajor: Word read FDriverVersion write FWDummy stored False;
- property DriverMinor: Word read FDriverRelease write FWDummy stored False;
- property DriverState: Word read FDriverState write FWDummy stored False;
- property ToolMajor : Word read FToolVersion write FWDummy stored False;
- property ToolMinor : Word read FToolRelease write FWDummy stored False;
- property ToolState : Word read FToolState write FWDummy stored False;
- end;
- {-- TMMPCXFormat Types ----------------------------------------------------}
- TMMPCXFMTMode = TMMMode;
- TMMPCXFrequency = 8000..48000;
- TMMPCXFileFormat = (ftRAW,ftWAV,ftMUSI);
- TMMPCXCompression = (cMPEG,cPCM8,cPCM16,cPCM24);
- TMMPCXMPEGLayer = (mLayer1,mLayer2);
- TMMPCXPCMEndian = (enIntel,enMotorola);
- TMMPCXExtraStereo = (esNormal,esDualChannels,esJointStereo);
- {-- TMMPCXFormat ----------------------------------------------------------}
- TMMPCXFormat = class(TMMObject)
- public
- constructor Create;
- procedure Assign(Source: TPersistent); override;
- procedure InitFormat;
- published
- property Mode : TMMPCXFMTMode read FMode write FMode;
- property Frequency : TMMPCXFrequency read FFrequency write FFrequency;
- property FileFormat : TMMPCXFileFormat read FFileFormat write FFileFormat;
- property Compression: TMMPCXCompression read FCompression write FCompression;
- property MPEGBitrate: integer read FMPEGBitrate write FMPEGBitrate;
- property MPEGLayer : TMMPCXMPEGLayer read FMPEGLayer write FMPEGLayer;
- property PCMEndian : TMMPCXPCMEndian read FPCMEndian write FPCMEndian;
- property ExtraStereo: TMMPCXExtraStereo read FExtraStereo write FExtraStereo;
- end;
- {-- TMMPCXCard Types ------------------------------------------------------}
- TMMPCXPipeMode = (pmOutput,pmInput);
- TMMPCXIOChannel = type integer;
- TMMPCXClockMode = (cmBoard,cmDigitalData,cmDigitalSynchro);
- TMMPCXDataInMode = (imAnalog,imDigital,imDigitalSynchro);
- TMMPCXOutMode = (omProfesional,omConsumer);
- TMMPCXAnalogInput = (aiLine,aiMic);
- TMMPCXLevelType = (ltDigital,ltAnalog,ltMonitor);
- TMMPCXEQBands = (eqBass,eqMedium,eqTreble);
- TMMPCXEQ = set of TMMPCXEQBands;
- TMMPCXNotify = (nBeforeEndStream,nBeginFile,nCloseFile,nEndFile);
- TMMPCXStartCondition = (scASAP,scONSTART,scASAEOF,scSTREAMBEGINREF,
- scSTREAMENDREF,scPIPEREF,scAFTERCURRENT);
- TMMPCXPipeStatus = (psNotAllocated,psStopped,psStarted,psBusy,psUnderrun,psPaused);
- TMMPCXStreamStatus = (ssNotAvailable,ssFree,ssInitialized,ssBusy,ssUnderrun,ssPaused);
- TMMPCXPipe = class;
- TMMPCXStream = class;
- TMMPCXCardNotifyEvent = procedure(Sender: TObject; Pipe: TMMPCXPipe;
- Stream: TMMPCXStream; Reason: TMMPCXNotify) of object;
- TMMPCXPipeNotifyEvent = procedure(Sender: TObject; Stream: TMMPCXStream;
- Reason: TMMPCXNotify) of object;
- TMMPCXStreamNotifyEvent = procedure(Sender: TObject; Reason: TMMPCXNotify) of object;
- {-- TMMPCXCard ------------------------------------------------------------}
- TMMPCXCard = class(TMMComponent)
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
- function MaxInputLevel(Input: integer): Float;
- function MaxOutputLevel(Output: integer): Float;
- function ChannelAvailable(IOChannel: integer; PipeMode: TMMPCXPipeMode): Boolean;
- procedure SetDefaultPath(Path: string);
- published
- property OnNotify : TMMPCXCardNotifyEvent read FOnNotify write FOnNotify;
- property Version : TMMPCXVersion read GetVersion write SetVersion stored False;
- property NumInputs : integer read GetNumInputs write SetDummyInteger stored False;
- property NumOutputs: integer read GetNumOutputs write SetDummyInteger stored False;
- end;
- {-- TMMCustomPCXPipe ------------------------------------------------------}
- TMMCustomPCXPipe = class(TMMComponent);
- {-- TMMPCXPipe ------------------------------------------------------------}
- TMMPCXPipe = class(TMMCustomPCXPipe)
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
- procedure AddObserver(O: TMMObserver);
- procedure RemoveObserver(O: TMMObserver);
- property Handle: TPIPE_TYPE read FPipeHandle;
- property AnalogSupported: Boolean read FAnalogSupported;
- property DigitalSupported: Boolean read FDigitalSupported;
- { pipe allocation }
- procedure Allocate;
- procedure Release;
- { pipe control }
- procedure Start;
- procedure Stop;
- procedure Pause(PauseState: Boolean);
- procedure Mute(MuteState: Boolean);
- procedure MuteMonitor(MuteState: Boolean);
- { pipe speed control }
- property Speed: Float read GetPipeSpeed write SetPipeSpeed;
- property Stretch: Float read GetPipeStretch write SetPipeStretch;
- { pipe level control }
- procedure SetLevel(LevelType: TMMPCXLevelType; LeftValue,RightValue: Float);
- procedure GetLevel(LevelType: TMMPCXLevelType; var LeftValue,RightValue: Float);
- procedure GetVUMeter(var PeakLeft,PeakRight: Float);
- { time code }
- procedure SetTimeCodeUnit(FrameBySec: Word; DropFrame: BOOL);
- procedure GetTimeCode(var Hour,Min,Sec,Frame: Word; var SamplePackets: DWORD);
- { pipe status }
- function Status: TMMPCXPipeStatus;
- procedure Position(var LowPos, HighPos: DWORD);
- published
- property OnNotify : TMMPCXPipeNotifyEvent read FOnNotify write FOnNotify;
- property OnAllocate : TNotifyEvent read FOnAllocate write FOnAllocate;
- property OnRelease : TNotifyEvent read FOnRelease write FOnRelease;
- property PCXCard : TMMPCXCard read FPCXCard write SetPCXCard;
- property MasterPipe : TMMCustomPCXPipe read GetMasterPipe write SetMasterPipe;
- property AutoStart : Boolean read FAutoStart write FAutoStart default False;
- property Format : TMMPCXFormat read FFormat write FFormat;
- property Mode : TMMPCXPipeMode read FPipeMode write SetPipeMode default pmOutput;
- property IOChannel : TMMPCXIOChannel read GetIOChannel write SetIOChannel default 0;
- property ClockMode : TMMPCXClockMode read FClockMode write SetClockMode default cmBoard;
- property DataInMode : TMMPCXDataInMode read FDataInMode write SetDataInMode default imAnalog;
- property DigitalOutMode: TMMPCXOutMode read FOutMode write SetDigitalOutMode default omProfesional;
- property AnalogInput : TMMPCXAnalogInput read FAnalogInput write SetAnalogInput default aiLine;
- property BoardName : string read GetBoardName write SetBoardName stored False;
- property WorkAsMaster : Boolean read FWorkAsMaster write SetWorkAsMaster stored True;
- property Enabled : Boolean read GetEnabled write SetEnabled default False;
- end;
- {-- TMMCustomPCXStream ----------------------------------------------------}
- TMMCustomPCXStream = class(TMMComponent);
- {-- TMMPCXStream ----------------------------------------------------------}
- TMMPCXStream = class(TMMCustomPCXStream)
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
- procedure AddObserver(O: TMMObserver);
- procedure RemoveObserver(O: TMMObserver);
- property Handle: TSTREAM_TYPE read FStreamHandle;
- procedure LoadFromFile(const FName: string);
- { stream status }
- function Status: TMMPCXStreamStatus;
- procedure Position(var ElapseTime, RemainTime: DWORD);
- published
- property OnNotify : TMMPCXStreamNotifyEvent read FOnNotify write FOnNotify;
- property PCXPipe : TMMPCXPipe read FPCXPipe write SetPCXPipe;
- property MasterStream : TMMCustomPCXStream read GetMasterStream write SetMasterStream;
- property Format : TMMPCXFormat read FFormat write FFormat;
- property FileName : TFileName read FFileName write SetFileName;
- property WorkAsMaster : Boolean read FWorkAsMaster write SetWorkAsMaster stored True;
- end;
- {-- TMMPCXOutputStream ----------------------------------------------------}
- TMMPCXOutputStream = class(TMMPCXStream)
- public
- constructor Create(aOwner: TComponent); override;
- { prepare a stream with a file }
- procedure PrepareEx(StartPos,LoopPos,EndPos: Longint;
- RefStream: TMMPCXOutputStream;
- RefOffsetLow,RefOffsetHigh: Longint);
- procedure Prepare(StartPos,EndPos: Longint);
- { stream control }
- procedure Play;
- procedure Stop;
- procedure StopFade(FadeOutDuration: Longint);
- procedure Pause(PauseState: Boolean);
- { stream level control }
- procedure SetLevel(LevelValue: Float);
- procedure GetLevel(var LevelValue: Float);
- procedure SetPanLevel(LeftValue,RightValue: Float);
- procedure GetPanLevel(var LeftValue,RightValue: Float);
- procedure GoToLevel(Duration: Longint; EndLevel: Float);
- { equaliser settings }
- procedure SetEQ(Bands: TMMPCXEQ; Level: Float);
- procedure GetEQ(Band: TMMPCXEQBands; var Level: Float);
- published
- property Mute : Boolean read GetMute write SetMute default False;
- property Looping : Boolean read FLooping write FLooping default False;
- property LoopCount : Longint read FLoopCount write FLoopCount default 0;
- property StartCondition: TMMPCXStartCondition read FStartCondition write FStartCondition default scASAP;
- property FadeInTime : Longint read FFadeInTime write FFadeInTime default 0;
- property FadeOutTime : Longint read FFadeOutTime write FFadeOutTime default 0;
- end;
- {-- TMMPCXInputStream ----------------------------------------------------}
- TMMPCXInputStream = class(TMMPCXStream)
- public
- procedure Prepare(MaxDuration: Longint);
- { stream control }
- procedure Recording;
- procedure Stop;
- procedure Pause(PauseState: Boolean);
- end;
- implementation
- end.
|