⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmdspobj.pas

📁 一套及时通讯的原码
💻 PAS
📖 第 1 页 / 共 3 页
字号:
begin
   inherited Paused;

   if assigned(FOnPause) then FOnPause(Self);
end;

{-- TMMDSPInterface -----------------------------------------------------------}
procedure TMMDSPInterface.Restarted;
begin
   inherited Restarted;

   if assigned(FOnRestart) then FOnRestart(Self);
end;

{-- TMMDSPInterface -----------------------------------------------------------}
procedure TMMDSPInterface.Stopped;
begin
   if FStarted then
   begin
      inherited Stopped;

      if assigned(FOnStop) then FOnStop(Self);
   end;
end;

{== TMMCustomSoundComponent ===================================================}
constructor TMMCustomSoundComponent.Create(AOwner: TComponent);
begin
   inherited Create(AOwner);

   FFullDuplex := False;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
destructor TMMCustomSoundComponent.Destroy;
begin
   inherited Destroy;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Opened;
var
   Current: TMMDSPComponent;

begin
   FFullDuplex := False;
   { search the first valid component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;

      { if we have a preloader it is the first component for us }
      if Current.FPreloaded then break;

      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         FFullDuplex := True;
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.BufferSize := BufferSize;
         Current.Opened;
      end
      else if (Current <> Self) then
      begin       { there is another sound component on the right side }
         Current.BufferSize := BufferSize;
         Current.Opened;
         break;
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Opened;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Closed;
var
   Current: TMMDSPComponent;

begin
   { search the last component }
   Current := Self;
   while (Current.Output <> nil) do
   begin
      Current := Current.Output;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the right side }
         Current.Closed;
         break;
      end;
   end;

   { search the first component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.Closed;
      end
      else if (Current <> Self) then
      begin
         { there is another sound component on the right side }
         break;
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Closed;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Started;
var
   Current: TMMDSPComponent;

begin
   { search the first component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;

      { if we have a preloader it is the first component for us }
      if Current.FPreloaded then break;

      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.Started;
      end
      else if (Current <> Self) then
      begin
         Current.Started;
         break;   { there is another sound component on the right side }
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Started;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Paused;
var
   Current: TMMDSPComponent;

begin
   { search the first component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.Paused;
      end
      else if (Current <> Self) then
      begin
         Current.Paused;
         break;   { there is another sound component on the right side }
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Paused;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Restarted;
var
   Current: TMMDSPComponent;

begin
   { search the first component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.Restarted;
      end
      else if (Current <> Self) then
      begin
         Current.Restarted;
         break;   { there is another sound component on the right side }
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Restarted;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Stopped;
var
   Current: TMMDSPComponent;

begin
   { search the last component }
   Current := Self;
   while (Current.Output <> nil) do
   begin
      Current := Current.Output;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the right side }
         Current.Stopped;
         break;
      end;
   end;

   { search the first component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.Stopped;
      end
      else if (Current <> Self) then
      begin
         { there is another sound component on the right side }
         break;
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Stopped;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Reseting;
var
   Current: TMMDSPComponent;

begin
   { search the first component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.Reseting;
      end
      else if (Current <> Self) then
      begin
         Current.Reseting;
         break;   { there is another sound component on the right side }
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Reseting;
end;

{-- TMMCustomSoundComponent ---------------------------------------------------}
procedure TMMCustomSoundComponent.Looped;
var
   Current: TMMDSPComponent;

begin
   { search the first component }
   Current := Self;
   while (Current.Input <> nil) do
   begin
      Current := Current.Input;
      if (Current is TMMCustomSoundComponent) and (Current <> Self) then
      begin
         { there is another sound component on the left side }
         Current := Self;
         break;
      end;
   end;

   { no go trough all components and notify }
   repeat
      if not (Current is TMMCustomSoundComponent) then
      begin
         Current.Looped;
      end
      else if (Current <> Self) then
      begin
         Current.Looped;
         break;   { there is another sound component on the right side }
      end;
      Current := Current.Output;
   until (Current = nil);

   inherited Looped;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -