| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Tel.: +0351-8012255 =}
- {= 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: 20.01.1998 - 18:00:00 $ =}
- {========================================================================}
- unit MMDSPObj;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- SysUtils,
- Messages,
- Classes,
- Controls,
- Forms,
- DsgnIntf,
- MMSystem,
- MMObj,
- MMWaveIO,
- MMRegs,
- MMUtils,
- MMString;
- const
- READ_SIZE : Longint = 2*32768; { used for queue-auto-read operations }
- WRITE_SIZE: Longint = 2*32768; { used for queue-auto-write operations }
- type
- TMMBufferEvent = procedure(Sender: TObject; lpWaveHdr: PWaveHdr) of object;
- TMMBufferLoadEvent = procedure(Sender: TObject; lpWaveHdr: PWaveHdr; var MoreBuffers: Boolean) of object;
- TMMPort = (poInput,poOutput);
- TPropString = string[20];
- {$IFDEF WIN32}
- {-- TMMDSPThread -----------------------------------------------------------}
- TMMDSPThread = class(TThread)
- public
- constructor CreateSuspended; virtual;
- destructor Destroy; override;
- end;
- {$ENDIF}
- {-- TMMDSPComponent --------------------------------------------------------}
- TMMDSPComponent = class(TMMComponent)
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
- procedure Opened; virtual;
- procedure Closed; virtual;
- procedure Started; virtual;
- procedure Paused; virtual;
- procedure Restarted; virtual;
- procedure Stopped; virtual;
- procedure BufferReady(lpwh: PWaveHdr); virtual;
- procedure BufferLoad(lpwh: PWaveHdr; var MoreBuffers: Boolean); virtual;
- procedure SetInputPort(aValue: TMMDSPComponent; PropName: TPropString); virtual;
- procedure SetOutputPort(aValue: TMMDSPComponent; PropName: TPropString); virtual;
- function CanConnectInput(aComponent: TComponent): Boolean; virtual;
- function CanConnectOutput(aComponent: TComponent): Boolean; virtual;
- property IsOpen: Boolean read FOpen;
- property Input : TMMDSPComponent read FInput write SetInput;
- property Output: TMMDSPComponent read FOutput write SetOutput;
- property PWaveFormat: PWaveFormatEx read GetPWaveFormat write SetPWaveFormat;
- property BufferSize: Longint read GetBufferSize write SetBufferSize default 2048;
- end;
- {-- TMMDSPInterface --------------------------------------------------------}
- TMMDSPInterface = class(TMMDSPComponent)
- public
- property OnOpen: TNotifyEvent read FOnOpen write FOnOpen;
- property OnStart: TNotifyEvent read FOnStart write FOnStart;
- property OnPause: TNotifyEvent read FOnPause write FOnPause;
- property OnRestart: TNotifyEvent read FOnRestart write FOnRestart;
- property OnStop: TNotifyEvent read FOnStop write FOnStop;
- property OnClose: TNotifyEvent read FOnClose write FOnClose;
- property OnBufferReady;
- property OnBufferLoad;
- property Input;
- property Output;
- end;
- {-- internal for loop handling ---------------------------------------------}
- PMMLoopRec = ^TMMLoopRec;
- TMMLoopRec = record
- dwLoop : LongBool; { is Loop enabled ? }
- dwLoopCnt : Longint; { number of loops required }
- dwLoopTmpCnt: Longint; { temp loop counter }
- dwLooping : LongBool; { End is reached Loop it or not }
- end;
- {-- internal WaveHdr -------------------------------------------------------}
- PMMWaveHdr = ^TMMWaveHdr;
- TMMWaveHdr = record
- wh : TWaveHdr;
- dwUser1 : Longint; { private user data }
- dwUser2 : Longint; { private user data }
- LoopRec : TMMLoopRec; { internal for loop handling }
- end;
- {-- TMMCustomSoundComponent ------------------------------------------------}
- TMMCustomSoundComponent = class(TMMDSPComponent)
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- end;
- {-- TMMDSPComponentInputEditor ---------------------------------------------}
- TMMDSPComponentInputEditor = class(TComponentProperty)
- public
- procedure GetValues(Proc: TGetStrProc); override;
- end;
- {-- TMMDSPComponentOutputEditor --------------------------------------------}
- TMMDSPComponentOutputEditor = class(TComponentProperty)
- public
- procedure GetValues(Proc: TGetStrProc); override;
- end;
- function DSPOutConnectCheck(C1, C2: TComponent): Boolean; far;
- function DSPInpConnectCheck(C1, C2: TComponent): Boolean; far;
- procedure GlobalDeconnectNotification(C: TComponent; Port: TMMPort; PortName: string);
- procedure GlobalSynchronize(VCLProc: TThreadMethod);
- const
- DSPList : TList = nil;
- ThreadList: TList = nil;
- implementation
|