MMReverb.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:25k
- {========================================================================}
- {= (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: 1/29/98 - 5:37:12 PM $ =}
- {========================================================================}
- unit MMReverb;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- SysUtils,
- Classes,
- Controls,
- MMSystem,
- MMRegs,
- MMObj,
- MMDSPObj,
- MMObjLst,
- MMUtils,
- MMWaveIO,
- MMPCMSup,
- MMFX;
- type
- TMMEchoIndex = 0..MaxEchos-1;
- EMMReverbError = class(Exception);
- TMMReverb = class;
- {-- TMMEcho ----------------------------------------------------------}
- TMMEcho = class(TObject)
- private
- FDelay : Longint; { delay (ms) for this echo line }
- FGain : Longint; { mix volume (%) for this echo }
- FOnChange: TNotifyEvent;
- procedure SetDelay(aValue: Longint);
- procedure SetGain(aValue: Longint);
- procedure Store(S: TStream); virtual;
- procedure Load(S: TStream); virtual;
- protected
- procedure Changed; virtual;
- public
- constructor Create;
- procedure Assign(Source: TObject);
- procedure SetParams(aDelay, aGain: Longint);
- property OnChange: TNotifyEvent read FOnChange write FOnChange;
- property Delay: Longint read FDelay write SetDelay default 0;
- property Gain: Longint read FGain write SetGain default 0;
- end;
- {-- TMMEchoList ------------------------------------------------------}
- TMMEchoList = class(TObjectList)
- private
- FReverb: TMMReverb;
- procedure SetEcho(Index: TMMEchoIndex; Echo: TMMEcho);
- function GetEcho(Index: TMMEchoIndex): TMMEcho;
- protected
- procedure ReadData(S: TStream); override;
- procedure WriteData(S: TStream); override;
- public
- function AddObject(Item: TObject): TOLSize; override;
- procedure Assign(Source: TPersistent); override;
- property Items[Index: TMMEchoIndex]: TMMEcho read GetEcho write SetEcho; default;
- end;
- {-- TMMReverb --------------------------------------------------------}
- TMMReverb = class(TMMDSPComponent)
- private
- FEnabled : Boolean;
- FOpen : Boolean;
- FPReverb : PReverb;
- FDescription : String;
- FMaxDelay : integer;
- FInputGain : TMMEffectVolume;
- FInputPan : TMMEffectVolume;
- FOutputGain : TMMEffectVolume;
- FFeedBack : TMMFeedBack;
- FFilter : Boolean;
- FEchos : TMMEchoList;
- FUpdating : Boolean;
- FCleanup : Longint;
- FOnChange : TNotifyEvent;
- FOnPcmOverflow : TNotifyEvent;
- procedure SetEnabled(aValue: Boolean);
- procedure SetDescription(aValue: String);
- procedure SetMaxDelay(aValue: integer);
- procedure SetGains(index: integer; aValue: TMMEffectVolume);
- procedure SetFeedBack(aValue: TMMFeedBack);
- procedure SetFilter(aValue: Boolean);
- procedure SetEchos(aValue: TMMEchoList);
- procedure EchosChanged(Sender: TObject);
- protected
- procedure SetPWaveFormat(aValue: PWaveFormatEx); override;
- procedure Assign(Source: TPersistent); override;
- procedure Change; dynamic;
- procedure Update; virtual;
- procedure Opened; override;
- procedure Closed; override;
- procedure Started; override;
- procedure PcmOverflow; dynamic;
- procedure BufferReady(lpwh: PWaveHdr); override;
- procedure BufferLoad(lpwh: PWaveHdr; var MoreBuffers: Boolean); override;
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
- procedure Open;
- procedure Close;
- procedure Process(Buffer: PChar; Length: integer);
- function CleanUp(Buffer: PChar; Length: integer): Longint;
- procedure SaveToIniFile(IniFile: TFileName; Section: string);
- procedure ReadFromIniFile(IniFile: TFileName; Section: string);
- procedure ReadIniSections(IniFile: TFileName; Strings: TStrings);
- procedure DeleteSection(IniFile: TFileName; Section: string);
- published
- property OnChange: TNotifyEvent read FOnChange write FOnChange;
- property OnPcmOverflow: TNotifyEvent read FOnPcmOverflow write FOnPcmOverflow;
- property Input;
- property Output;
- property Enabled: Boolean read FEnabled write SetEnabled default True;
- property Description: String read FDescription write SetDescription stored False;
- property MaxDelay: integer read FMaxDelay write SetMaxDelay stored False;
- property InputGain: TMMEffectVolume index 0 read FInputGain write SetGains stored False;
- property InputPan: TMMEffectVolume index 1 read FInputPan write SetGains stored False;
- property OutputGain: TMMEffectVolume index 2 read FOutputGain write SetGains stored False;
- property FeedBack: TMMFeedBack read FFeedback write SetFeedBack stored False;
- property Filter: Boolean read FFilter write SetFilter stored False;
- property Echos: TMMEchoList read FEchos write SetEchos;
- end;
- implementation
- uses IniFiles;
- const
- STREAMKENNUNG : Longint = $00425652; { 'RVB ' }
- {== TMMEcho =============================================================}
- constructor TMMEcho.Create;
- begin
- inherited Create;
- FDelay := 0;
- FGain := 0;
- FOnChange := nil;
- end;
- {-- TMMEcho -------------------------------------------------------------}
- procedure TMMEcho.Changed;
- begin
- if assigned(FOnChange) then FOnChange(Self);
- end;
- {-- TMMEcho -------------------------------------------------------------}
- procedure TMMEcho.SetParams(aDelay, aGain: Longint);
- begin
- if (aDelay <> FDelay) or (aGain <> FGain) then
- begin
- FDelay := aDelay;
- FGain := aGain;
- Changed;
- end;
- end;
- {-- TMMEcho -------------------------------------------------------------}
- procedure TMMEcho.SetDelay(aValue: Longint);
- begin
- SetParams(aValue, FGain);
- end;
- {-- TMMEcho -------------------------------------------------------------}
- procedure TMMEcho.SetGain(aValue: Longint);
- begin
- SetParams(FDelay, aValue);
- end;
- {-- TMMEcho -------------------------------------------------------------}
- procedure TMMEcho.Store(S: TStream);
- begin
- S.WriteBuffer(FDelay,SizeOf(FDelay));
- S.WriteBuffer(FGain,SizeOf(FGain));
- end;
- {-- TMMEcho -------------------------------------------------------------}
- procedure TMMEcho.Load(S: TStream);
- var
- aDelay,aGain: Longint;
- begin
- S.ReadBuffer(aDelay,SizeOf(aDelay));
- S.ReadBuffer(aGain,SizeOf(aGain));
- SetParams(aDelay,aGain);
- end;
- {-- TMMEcho -------------------------------------------------------------}
- procedure TMMEcho.Assign(Source: TObject);
- begin
- if Source is TMMEcho then
- begin
- SetParams(TMMEcho(Source).Delay,TMMEcho(Source).Gain);
- end;
- end;
- {== TMMEchoList =========================================================}
- procedure TMMEchoList.SetEcho(Index: TMMEchoIndex; Echo: TMMEcho);
- begin
- Put(Index, Echo);
- end;
- {-- TMMEchoList ---------------------------------------------------------}
- function TMMEchoList.GetEcho(Index: TMMEchoIndex): TMMEcho;
- begin
- Result := TMMEcho(Get(Index));
- end;
- {-- TMMEchoList ---------------------------------------------------------}
- function TMMEchoList.AddObject(Item: TObject): TOLSize;
- begin
- Result := inherited AddObject(Item);
- (Item as TMMEcho).OnChange := OnChange;
- end;
- {-- TMMEchoList ---------------------------------------------------------}
- procedure TMMEchoList.Assign(Source: TPersistent);
- var
- i: integer;
- Echo: TMMEcho;
- begin
- if (Source is TMMEchoList) or (Source = nil) then
- begin
- BeginUpdate;
- try
- FReverb.FUpdating := True;
- FreeAll;
- if (Source <> nil) then
- for i := 0 to TMMEchoList(Source).Count-1 do
- begin
- Echo := TMMEcho.Create;
- Echo.Assign(TMMEchoList(Source)[i]);
- AddObject(Echo);
- end;
- finally
- FReverb.FUpdating := False;
- EndUpdate;
- end;
- exit;
- end;
- inherited assign(Source);
- end;
- {-- TMMEchoList ---------------------------------------------------------}
- procedure TMMEchoList.ReadData(S: TStream);
- Var
- pBuf: PChar;
- Kennung: Longint;
- ObjCount,
- Index: TOLSize;
- Destroy: Boolean;
- Value: Longint;
- begin
- BeginUpdate;
- try
- FReverb.FUpdating := True;
- S.ReadBuffer(Kennung,sizeOf(STREAMKENNUNG));
- if (Kennung <> STREAMKENNUNG) then
- raise EStreamError.Create('Invalid Object stream');
- FreeAll;
- { load stream items }
- S.ReadBuffer(Destroy,SizeOf(Destroy));
- DestroyObjects := Destroy;
- { read string length }
- S.ReadBuffer(Value,SizeOf(Value));
- if Value > 0 then
- begin
- pBuf := StrAlloc(Value+1);
- try
- FillChar(pBuf^, Value+1, 0);
- S.ReadBuffer(pBuf^, Value);
- FReverb.Description := StrPas(pBuf);
- finally
- StrDispose(pBuf);
- end;
- end;
- S.ReadBuffer(Value,SizeOf(Value));
- FReverb.FMaxDelay := Value;
- S.ReadBuffer(Value,SizeOf(Value));
- FReverb.FInputGain := Value;
- S.ReadBuffer(Value,SizeOf(Value));
- FReverb.FInputPan := Value;
- S.ReadBuffer(Value,SizeOf(Value));
- FReverb.FOutputGain := Value;
- S.ReadBuffer(Value,SizeOf(Value));
- FReverb.FFeedBack := Value;
- S.ReadBuffer(ObjCount,SizeOf(Objcount)); { Read in Object count }
- ObjCount := Min(ObjCount,MAXECHOS);
- if Capacity-Count < ObjCount then Capacity := Count+ObjCount;
- { Read in Object Count }
- for Index := 0 to ObjCount-1 do
- AddObject(ReadObjectFromStream(S));
- finally
- FReverb.FUpdating := False;
- EndUpdate;
- end;
- end;
- {-- TMMEchoList ---------------------------------------------------------}
- procedure TMMEchoList.WriteData(S: TStream);
- var
- Index,ObjCount: TOlSize;
- Destroy: Boolean;
- Value: Longint;
- begin
- { Write list to Stream }
- S.WriteBuffer(STREAMKENNUNG,SizeOf(STREAMKENNUNG));
- Destroy := DestroyObjects;
- S.WriteBuffer(Destroy,SizeOf(Destroy));
- { write string length }
- Value := Length(FReverb.FDescription);
- S.WriteBuffer(Value, SizeOf(Value));
- {$IFDEF WIN32}
- S.WriteBuffer(PChar(FReverb.FDescription)^, Length(FReverb.FDescription));
- {$ELSE}
- S.WriteBuffer(FReverb.FDescription[1], Length(FReverb.FDescription));
- {$ENDIF}
- Value := FReverb.FMaxDelay;
- S.WriteBuffer(Value, SizeOf(Value));
- Value := FReverb.FInputGain;
- S.WriteBuffer(Value, SizeOf(Value));
- Value := FReverb.FInputPan;
- S.WriteBuffer(Value, SizeOf(Value));
- Value := FReverb.FOutputGain;
- S.WriteBuffer(Value, SizeOf(Value));
- Value := FReverb.FFeedBack;
- S.WriteBuffer(Value, SizeOf(Value));
- ObjCount := Count;
- S.WriteBuffer(ObjCount,SizeOf(ObjCount));
- for Index := 0 to Count-1 do
- WriteObjectToStream(Items[Index],S);
- end;
- {== TMMReverb ===========================================================}
- constructor TMMReverb.Create(aOwner: TComponent);
- var
- i: integer;
- begin
- inherited Create(aOwner);
- FEchos := TMMEchoList.Create;
- FEchos.OnChange := EchosChanged;
- FEchos.FReverb := Self;
- for i := 0 to MAXECHOS-1 do FEchos.AddObject(TMMEcho.Create);
- FPReverb := nil;
- FDescription:= 'Untitled';
- FEnabled := True;
- FOpen := False;
- FUpdating := False;
- FMaxDelay := 250;
- FInputGain := 80;
- FInputPan := 0;
- FOutputGain := 100;
- FFeedBack := 0;
- FFilter := False;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- destructor TMMReverb.Destroy;
- begin
- Close;
- FEchos.Free;
- inherited Destroy;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.PcmOverflow;
- begin
- if assigned(FOnPcmOverflow) then FOnPcmOverflow(Self);
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Change;
- begin
- if assigned(FOnChange) then FOnChange(Self);
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetEchos(aValue: TMMEchoList);
- begin
- if (aValue <> FEchos) then FEchos.Assign(aValue);
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.EchosChanged(Sender: TObject);
- begin
- if not FUpdating then
- begin
- Update;
- Change;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetPWaveFormat(aValue: PWaveFormatEx);
- begin
- if (aValue <> nil) then
- begin
- if not (csDesigning in ComponentState) then
- if not pcmIsValidFormat(aValue) then
- raise EMMReverbError.Create(LoadResStr(IDS_INVALIDFORMAT));
- end;
- inherited SetPWaveFormat(aValue);
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SaveToIniFile(IniFile: TFileName; Section: string);
- var
- i,j: integer;
- begin
- if (IniFile <> '') then
- begin
- with TIniFile.Create(IniFile) do
- try
- if Pos('Reverb.',Section) = 0 then Section := 'Reverb.'+Section;
- WriteInteger(Section, 'MaxDelay', MaxDelay);
- WriteInteger(Section, 'InputGain', InputGain);
- WriteInteger(Section, 'InputPan', InputPan);
- WriteInteger(Section, 'OutputGain', OutputGain);
- WriteInteger(Section, 'FeedBack', FeedBack);
- WriteBool(Section, 'Filter', Filter);
- j := 0;
- for i := 0 to Echos.Count-1 do
- with Echos[i] do
- begin
- if (Gain <> 0) then
- begin
- WriteInteger(Section, 'Delay'+IntToStr(j), Delay);
- WriteInteger(Section, 'Gain'+IntToStr(j), Gain);
- inc(j);
- end;
- end;
- finally
- Free;
- end;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.ReadFromIniFile(IniFile: TFileName; Section: string);
- var
- i,P: integer;
- begin
- if (IniFile <> '') then
- begin
- with TIniFile.Create(IniFile) do
- try
- if Pos('Reverb.',Section) = 0 then Section := 'Reverb.'+Section;
- i := ReadInteger(Section, 'MaxDelay', -1);
- if (i > 0) then
- try
- FUpdating := True;
- MaxDelay := ReadInteger(Section, 'MaxDelay', 1000);
- InputGain := ReadInteger(Section, 'InputGain', 50);
- InputPan := ReadInteger(Section, 'InputPan', 50);
- OutputGain := ReadInteger(Section, 'OutputGain', 50);
- FeedBack := ReadInteger(Section, 'FeedBack', 0);
- Filter := ReadBool(Section, 'Filter', True);
- for i := 0 to MAXECHOS-1 do
- with Echos[i] do
- begin
- Delay := ReadInteger(Section, 'Delay'+IntToStr(i), 0);
- Gain := ReadInteger(Section, 'Gain'+IntToStr(i), 0);
- end;
- P := Pos('.',Section);
- if (P <> 0) then Section := Copy(Section,P+1,MaxInt);
- Description := Section;
- finally
- FUpdating := False;
- Update;
- Change;
- end;
- finally
- Free;
- end;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.ReadIniSections(IniFile: TFileName; Strings: TStrings);
- var
- i, P: integer;
- Sections: TStringList;
- begin
- if (IniFile <> '') and (Strings <> nil) then
- begin
- with TIniFile.Create(IniFile) do
- try
- Sections := TStringList.Create;
- try
- ReadSections(Sections);
- Strings.BeginUpdate;
- try
- Strings.Clear;
- for i := 0 to Sections.Count-1 do
- begin
- P := Pos('.',Sections[i]);
- if (P <> 0) then Strings.Add(Copy(Sections[i],P+1,MaxInt));
- end;
- finally
- Strings.EndUpdate;
- end;
- finally
- Sections.Free;
- end;
- finally
- Free;
- end;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.DeleteSection(IniFile: TFileName; Section: string);
- begin
- if (IniFile <> '') then
- begin
- with TIniFile.Create(IniFile) do
- try
- if Pos('Reverb.',Section) = 0 then Section := 'Reverb.'+Section;
- EraseSection(Section);
- finally
- Free;
- end;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Assign(Source: TPersistent);
- begin
- if (Source is TMMReverb) then
- begin
- if (Source <> nil) then
- begin
- Enabled := TMMReverb(Source).Enabled;
- Description:= TMMReverb(Source).Description;
- MaxDelay := TMMReverb(Source).MaxDelay;
- InputGain := TMMReverb(Source).InputGain;
- InputPan := TMMReverb(Source).InputPan;
- OutputGain := TMMReverb(Source).OutputGain;
- FeedBack := TMMReverb(Source).FeedBack;
- Filter := TMMReverb(Source).Filter;
- Echos := TMMReverb(Source).Echos;
- end;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetDescription(aValue: String);
- begin
- if (aValue <> FDescription) then
- begin
- FDescription := aValue;
- Change;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetMaxDelay(aValue: integer);
- begin
- if (aValue <> FMaxDelay) then
- begin
- FMaxDelay := aValue;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetEnabled(aValue: Boolean);
- begin
- if (aValue <> FEnabled) then
- begin
- FEnabled := aValue;
- if FEnabled then Update;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetGains(index: integer; aValue: TMMEffectVolume);
- begin
- case index of
- 0: if (aValue = FInputGain) then exit
- else
- begin
- FInputGain := aValue;
- if FOpen then FPReverb^.InputGain := MulDiv(aValue,256,100);
- end;
- 1: if (aValue = FInputPan) then exit
- else
- begin
- FInputPan := aValue;
- if FOpen then FPReverb^.InputPan := MulDiv(aValue,256,100);
- end;
- 2: if (aValue = FOutputGain) then exit
- else
- begin
- FOutputGain := aValue;
- if FOpen then FPReverb^.OutputGain := MulDiv(aValue,256,100);
- end;
- end;
- Change;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetFeedBack(aValue: TMMFeedBack);
- begin
- if (aValue <> FFeedBack) then
- begin
- FFeedBack := aValue;
- if FOpen then FPReverb^.FeedBack := MulDiv(aValue,256,100);
- Change;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.SetFilter(aValue: Boolean);
- begin
- if (aValue <> FFilter) then
- begin
- FFilter := aValue;
- if FOpen then FPReverb^.OutputFilter := FFilter;
- Change;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Open;
- begin
- if not FOpen then
- begin
- if pcmIsValidFormat(PWaveFormat) then
- begin
- FPReverb := InitReverb(PWaveFormat, FMaxDelay);
- if (FPReverb = nil) then OutOfMemoryError
- else
- begin
- FOpen := True;
- Update;
- end;
- end;
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Close;
- begin
- if FOpen then
- begin
- FOpen := False;
- DoneReverb(FPReverb);
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Process(Buffer: PChar; Length: integer);
- begin
- { process the buffer trough the reverb engine }
- if (FPReverb <> nil) then
- if DoReverb(FPReverb, Buffer, Length) then
- GlobalSynchronize(PcmOverflow);
- end;
- {-- TMMReverb -----------------------------------------------------------}
- function TMMReverb.CleanUp(Buffer: PChar; Length: integer): Longint;
- begin
- { process the remaining delayed bytes in the delay lines }
- if (FPReverb <> nil) and (FCleanup > 0) then
- begin
- FCleanup := Max(FCleanup - Length,0);
- FillChar(Buffer^, Length, 0);
- if DoReverb(FPReverb, Buffer, Length) then
- GlobalSynchronize(PcmOverflow);
- end;
- { return the remaining bytes to process }
- Result := FCleanup;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Update;
- var
- i: integer;
- _Echos: TEchoArray;
- NumEchos: integer;
- begin
- { setup the reverb engine with the params }
- if FOpen then
- begin
- NumEchos := 0;
- FCleanup := 0;
- for i := 0 to Echos.Count-1 do
- begin
- if (Echos[i].Gain <> 0) then
- begin
- { copy in temp record }
- _Echos[NumEchos].Delay := Echos[i].Delay;
- _Echos[NumEchos].Gain := Echos[i].Gain;
- inc(NumEchos);
- if Echos[i].Delay > FCleanup then FCleanup := Echos[i].Delay;
- end;
- end;
- if (FCleanup > 0) then
- begin
- { convert cleanup time to bytes }
- FCleanup := wioTimeToSamples(PWaveFormat,FCleanup*abs(FFeedBack));
- end;
- { now update the reverb params }
- SetReverb(FPReverb, FFilter, FInputGain, FInputPan,
- FOutputGain, FFeedBack, NumEchos, @_Echos);
- end;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Opened;
- begin
- Open;
- inherited Opened;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Closed;
- begin
- Close;
- inherited Closed;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.Started;
- begin
- Update;
- inherited Started;
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.BufferReady(lpwh: PWaveHdr);
- begin
- if Enabled and FOpen then
- begin
- Process(lpwh^.lpData, lpwh^.dwBytesRecorded);
- end;
- inherited BufferReady(lpwh);
- end;
- {-- TMMReverb -----------------------------------------------------------}
- procedure TMMReverb.BufferLoad(lpwh: PWaveHdr; var MoreBuffers: Boolean);
- var
- aLength: Longint;
- begin
- inherited BufferLoad(lpwh, MoreBuffers);
- if Enabled and FOpen then
- begin
- if not MoreBuffers then
- begin
- aLength := lpwh^.dwBufferLength;
- if Cleanup(lpwh^.lpData, aLength) > 0 then MoreBuffers := True;
- lpwh^.dwBytesRecorded := aLength;
- end
- else Process(lpwh^.lpData, lpwh^.dwBytesRecorded);
- end;
- end;
- Initialization
- { register echo class for streaming ! }
- DoRegisterClass(@TMMEcho.Load,
- @TMMEcho.Store,
- TMMEcho);
- end.