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

📄 mmdscon.pas

📁 一套及时通讯的原码
💻 PAS
字号:
{========================================================================}
{=                (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: 13.08.98 - 21:08:39 $                                        =}
{========================================================================}
unit MMDSCon;

{$I COMPILER.INC}

interface

uses
{$IFDEF WIN32}
    Windows,
{$ELSE}
    WinTypes,
    WinProcs,
{$ENDIF}
    SysUtils,
    Messages,
    Classes,
    Graphics,
    StdCtrls,
    ExtCtrls,
    Controls,
    Forms,
    MMObj,
    MMDSPObj,
    MMUtils,
    MMWaveIO,
    MMCCon,
    MMDSMix,
    MMDSCptr
    {$IFNDEF DELPHI2}
    {$IFNDEF BCB}
    ,MMDSMidi
    {$ENDIF}
    {$ENDIF}
    ;

type
    {-- TMMDSChannelConnector -------------------------------------------------}
    TMMDSChannelConnector = class(TMMCustomLevelConnector)
    private
       FChannel: TMMNonVisualComponent;

       procedure SetChannel(aValue: TMMNonVisualComponent);

    protected
       procedure GetLevelValues(var LeftValue, RightValue, BothValue: integer); override;
       procedure Notification(AComponent: TComponent; Operation: TOperation); override;

    public
       constructor Create(AOwner: TComponent); override;
       destructor  Destroy; override;

       function CanConnectChannel(C: TComponent): Boolean;

    published
       property Channel: TMMNonVisualComponent read FChannel write SetChannel;

       property OnTrigger;
       property Level1;
       property Level2;
       {$IFNDEF LEVEL_ONLY}
       property Meter1;
       property Meter2;
       {$ENDIF}
       property AutoTrigger;
       property Interval;
       property Enabled;
    end;

function DSChannelConnectCheck(C1, C2: TComponent): Boolean;

implementation

{------------------------------------------------------------------------------}
function DSChannelConnectCheck(C1, C2: TComponent): Boolean;
begin
   Result := ((C2 <> nil) and (C2 is TMMDSChannelConnector)) and
             ((C1 = nil) or
              (C1 is TMMDSMixChannel) or
              (C1 is TMMDSCaptureChannel) {$IFNDEF DELPHI2} {$IFNDEF BCB}or
              (C1 is TMMDSMidiChannel) {$ENDIF}{$ENDIF});
end;

{== TMMDSChannelConnector =====================================================}
constructor TMMDSChannelConnector.Create(aOwner: TComponent);
begin
   inherited Create(aOwner);

   FChannel := nil;

   ErrorCode := ComponentRegistered(InitCode, Self, ClassName);
   if (ErrorCode <> 0) then RegisterFailed(InitCode, Self , ClassName);
end;

{-- TMMDSChannelConnector -----------------------------------------------------}
destructor TMMDSChannelConnector.Destroy;
begin
   Channel := nil;

   inherited Destroy;
end;

{-- TMMDSChannelConnector -----------------------------------------------------}
function TMMDSChannelConnector.CanConnectChannel(C: TComponent): Boolean;
begin
   Result := DSChannelConnectCheck(C,Self);
end;

{-- TMMDSChannelConnector -----------------------------------------------------}
procedure TMMDSChannelConnector.SetChannel(aValue: TMMNonVisualComponent);
begin
   if (Longint(aValue) <> Longint(Self)) and (aValue <> FChannel) and
       CanConnectChannel(aValue) then
   begin
      FChannel := aValue;
   end;
end;

{-- TMMDSChannelConnector -----------------------------------------------------}
procedure TMMDSChannelConnector.Notification(AComponent: TComponent; Operation: TOperation);
begin
   inherited Notification(AComponent, Operation);

   if (Operation = opRemove) then
   begin
      if (aComponent = FChannel) then
      begin
         Channel := nil;
      end;
   end;
end;

{-- TMMDSChannelConnector -----------------------------------------------------}
procedure TMMDSChannelConnector.GetLevelValues(var LeftValue, RightValue, BothValue: integer);
begin
   if (FChannel <> nil) then
   begin
      if (FChannel is TMMDSMixChannel) then
          TMMDSMixChannel(FChannel).GetVUMeter(LeftValue,RightValue,BothValue,Interval)
      else if (FChannel is TMMDSCaptureChannel) then
          TMMDSCaptureChannel(FChannel).GetVUMeter(LeftValue,RightValue,BothValue,Interval)
      {$IFNDEF DELPHI2}
      {$IFNDEF BCB}
      else
          TMMDSMidiChannel(FChannel).GetVUMeter(LeftValue,RightValue,BothValue,Interval)
      {$ENDIF}
      {$ENDIF};
   end
   else inherited GetLevelValues(LeftValue,RightValue,BothValue);
end;


end.

⌨️ 快捷键说明

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