| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620 |
- {========================================================================}
- {= (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 MMMixCtl;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- Forms,
- Messages,
- Classes,
- SysUtils,
- StdCtrls,
- ExtCtrls,
- Controls,
- MMObj,
- MMUtils,
- MMMath,
- MMObsrv,
- MMMixer,
- MMSlider,
- MMLevel,
- MMMeter,
- MMTimer,
- MMSpin,
- MMPanel,
- MMWheel,
- MMDevice;
- type
- TMMIdChangedEvent = procedure of object;
- {-- TMMControlLink --------------------------------------------------}
- TMMControlLink = class(TMMObserver)
- private
- FControl : TMMCustomMixerControl;
- FOnChange : TNotifyEvent;
- FOnIdChange: TMMIdChangedEvent;
- procedure SetControl(Value: TMMCustomMixerControl);
- protected
- procedure Notify(Data: TObject); override;
- public
- property Control: TMMCustomMixerControl read FControl write SetControl;
- property OnChange: TNotifyEvent read FOnChange write FOnChange;
- property OnIdChange: TMMIdChangedEvent read FOnIdChange write FOnIdChange;
- end;
- {-- TMMCaptionLink --------------------------------------------------}
- TMMCaptionLink = class(TMMObserver)
- private
- FComponent : TMMComponent;
- FItem : TMMItemIndex;
- FShort : Boolean;
- FOnChange : TNotifyEvent;
- procedure SetComponent(Value: TMMComponent);
- procedure SetItem(Value: TMMItemIndex);
- procedure SetShort(Value: Boolean);
- function GetTitle: string;
- procedure RemoveObserver;
- procedure AddObserver;
- protected
- procedure Changed; virtual;
- procedure DoChange; dynamic;
- procedure Notify(Data: TObject); override;
- public
- constructor Create;
- property Component: TMMComponent read FComponent write SetComponent;
- property Item: TMMItemIndex read FItem write SetItem;
- property Short: Boolean read FShort write SetShort;
- property Title: string read GetTitle;
- property OnChange: TNotifyEvent read FOnChange write FOnChange;
- end;
- EMMCaptionLinkError = class(Exception)
- end;
- const
- MaxSteps = 32;
- MixerSliderControlClasses = [ccFader,ccNumber,ccSlider,ccTime];
- SwitchControlClasses = [ccList,ccSwitch];
- ConnectorControlClasses = [ccFader,ccMeter,ccNumber,ccSlider,ccTime];
- MixerWheelControlClasses = MixerSliderControlClasses;
- type
- {-- TMMCustomMixerSlider --------------------------------------------}
- TMMCustomMixerSlider = class(TMMCustomSlider)
- private
- FLink : TMMControlLink;
- FStep : Extended;
- FChannel : TMMChannel;
- FItem : TMMItemIndex;
- FEnabled : Boolean;
- function GetControl: TMMCustomMixerControl;
- procedure SetControl(Value: TMMCustomMixerControl);
- procedure ControlChange(Sender: TObject);
- procedure Change; override;
- procedure SetupSlider;
- procedure UpdateValue;
- procedure UpdateControl;
- procedure SetChannel(Value: TMMChannel);
- procedure SetItem(Value: TMMItemIndex);
- procedure SetEnabled(Value: Boolean);
- protected
- procedure Loaded; override;
- procedure Notification(AComponent: TComponent; Operation: TOperation); override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- protected
- property Control: TMMCustomMixerControl read GetControl write SetControl;
- property Channel: TMMChannel read FChannel write SetChannel default chBoth;
- property Item: TMMItemIndex read FItem write SetItem default NoItem;
- property Enabled read FEnabled write SetEnabled default True;
- end;
- {-- TMMMixerSlider --------------------------------------------------}
- TMMMixerSlider = class(TMMCustomMixerSlider)
- published
- property OnEnter;
- property OnExit;
- property OnKeyDown;
- property OnKeyPress;
- property OnKeyUp;
- property OnChange;
- property OnTrack;
- property OnTrackEnd;
- property OnDrawThumb;
- property OnDrawGroove;
- property Control;
- property Channel;
- property Item;
- property Logarithmic;
- property Sensitivity;
- property Enabled;
- property Visible;
- property Color;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property TabStop;
- property TabOrder;
- property Width;
- property Height;
- property Bevel;
- property Groove;
- property FocusAction;
- property FocusColor;
- property GrooveColor;
- property ThumbColor;
- property DisabledColor;
- property HandCursor;
- property Orientation;
- property GrooveSize;
- property GrooveStyle;
- property ThumbWidth;
- property ThumbHeight;
- property ThumbStyle;
- property Scale;
- property ScalePosition;
- property ScaleDistance;
- property PicLeft;
- property PicRight;
- end;
- {-- TMMCustomMixerWheel ---------------------------------------------}
- TMMCustomMixerWheel = class(TMMCustomWheel)
- private
- FLink : TMMControlLink;
- FStep : Extended;
- FChannel : TMMChannel;
- FItem : TMMItemIndex;
- FEnabled : Boolean;
- function GetControl: TMMCustomMixerControl;
- procedure SetControl(Value: TMMCustomMixerControl);
- procedure ControlChange(Sender: TObject);
- procedure Change; override;
- procedure SetupWheel;
- procedure UpdateValue;
- procedure UpdateControl;
- procedure SetChannel(Value: TMMChannel);
- procedure SetItem(Value: TMMItemIndex);
- procedure SetEnabled(Value: Boolean);
- protected
- procedure Loaded; override;
- procedure Notification(AComponent: TComponent; Operation: TOperation); override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- protected
- property Control: TMMCustomMixerControl read GetControl write SetControl;
- property Channel: TMMChannel read FChannel write SetChannel default chBoth;
- property Item: TMMItemIndex read FItem write SetItem default NoItem;
- property Enabled read FEnabled write SetEnabled default True;
- end;
- {-- TMMMixerWheel ---------------------------------------------------}
- TMMMixerWheel = class(TMMCustomMixerWheel)
- published
- property Control;
- property Channel;
- property Item;
- property Enabled;
- property OnEnter;
- property OnExit;
- property OnKeyDown;
- property OnKeyPress;
- property OnKeyUp;
- property OnChange;
- property OnDrawHandle;
- property Bevel;
- property Visible;
- property Color;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property TabStop default True;
- property TabOrder;
- property Width;
- property Height;
- property AutoSize;
- property BackBmp;
- property Value;
- property StartAngle;
- property EndAngle;
- property HandleColor;
- property FocusedColor;
- property UpDown;
- property ScrollSize;
- property LineStep;
- property PageStep;
- property FocusAction;
- property Scale;
- property Radius;
- property HandleStyle;
- property HandleSize;
- property HandleMargin;
- property FrameSpace;
- property ScaleMargin;
- end;
- {-- TMMCustomMixerCheckBox ------------------------------------------}
- TMMCustomMixerCheckBox = class(TCustomCheckBox)
- private
- FLink : TMMControlLink;
- FChannel : TMMChannel;
- FItem : TMMItemIndex;
- FAutoCap : Boolean;
- FShort : Boolean;
- FItemLine : TMMAudioLine;
- FItemObserver : TMMObserver;
- FEnabled : Boolean;
- function GetControl: TMMCustomMixerControl;
- procedure SetControl(Value: TMMCustomMixerControl);
- procedure ControlChange(Sender: TObject);
- procedure SetupCheck;
- procedure UpdateValue;
- procedure UpdateControl;
- procedure SetChannel(Value: TMMChannel);
- procedure SetItem(Value: TMMItemIndex);
- procedure SetAutoCap(Value: Boolean);
- procedure SetShort(Value: Boolean);
- procedure SetItemLine(Value: TMMAudioLine);
- procedure ItemNotify(Sender, Data: TObject);
- function StoreItem: Boolean;
- function StoreCaption: Boolean;
- procedure SetEnabled(Value: Boolean);
- protected
- procedure Click; override;
- procedure Loaded; override;
- procedure Notification(AComponent: TComponent; Operation: TOperation); override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- protected
- property Control: TMMCustomMixerControl read GetControl write SetControl;
- property Channel: TMMChannel read FChannel write SetChannel default chBoth;
- property Item: TMMItemIndex read FItem write SetItem stored StoreItem;
- property AutoCaption: Boolean read FAutoCap write SetAutoCap default True;
- property Short: Boolean read FShort write SetShort default True;
- property ItemLine: TMMAudioLine read FItemLine write SetItemLine;
- property Enabled read FEnabled write SetEnabled default True;
- property Caption stored StoreCaption;
- end;
- {-- TMMMixerCheckBox ------------------------------------------------}
- TMMMixerCheckBox = class(TMMCustomMixerCheckBox)
- published
- property OnDragDrop;
- property OnDragOver;
- property OnEndDrag;
- property OnEnter;
- property OnExit;
- property OnKeyDown;
- property OnKeyPress;
- property OnKeyUp;
- property OnMouseDown;
- property OnMouseMove;
- property OnMouseUp;
- property OnStartDrag;
- property Control;
- property Channel;
- property Item;
- property AutoCaption;
- property Short;
- property ItemLine;
- property Enabled;
- property Caption;
- property Alignment;
- property Color;
- property Ctl3D;
- property DragCursor;
- property DragMode;
- property Font;
- property ParentColor;
- property ParentCtl3D;
- property ParentFont;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property TabOrder;
- property TabStop;
- property Visible;
- end;
- const
- defInterval = 25;
- type
- TMMCurrentValue = array[TMMChannel] of LongInt;
- {-- TMMCustomMixerConnector -----------------------------------------}
- TMMCustomMixerConnector = class(TMMComponent)
- private
- FTimerID : Longint;
- FInterval : Integer;
- FAuto : Boolean;
- FLink : TMMControlLink;
- FLevel1 : TMMCustomLevel;
- FLevel2 : TMMCustomLevel;
- FMeter1 : TMMCustomMeter;
- FMeter2 : TMMCustomMeter;
- FStep : Extended;
- FItem : TMMItemIndex;
- FPrev : TMMCurrentValue;
- FPrevValid : Boolean;
- FEnabled : Boolean;
- FOnChange : TNotifyEvent;
- function GetControl: TMMCustomMixerControl;
- procedure SetControl(Value: TMMCustomMixerControl);
- procedure ControlChange(Sender: TObject);
- procedure SetupConnector;
- procedure UpdateValue;
- procedure UpdateControl;
- procedure SetLevel(Index: Integer; Value: TMMCustomLevel);
- procedure SetMeter(Index: Integer; Value: TMMCustomMeter);
- procedure SetAuto(Value: Boolean);
- procedure SetInterval(Value: Integer);
- procedure SetItem(Value: TMMItemIndex);
- procedure SetEnabled(Value: Boolean);
- protected
- procedure Changed; virtual;
- procedure DoChange; dynamic;
- procedure Loaded; override;
- procedure Notification(AComponent: TComponent; Operation: TOperation); override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure Trigger; virtual;
- protected
- property Control: TMMCustomMixerControl read GetControl write SetControl;
- property Level1: TMMCustomLevel index 1 read FLevel1 write SetLevel;
- property Level2: TMMCustomLevel index 2 read FLevel2 write SetLevel;
- property Meter1: TMMCustomMeter index 1 read FMeter1 write SetMeter;
- property Meter2: TMMCustomMeter index 2 read FMeter2 write SetMeter;
- property AutoTrigger: Boolean read FAuto write SetAuto default True;
- property Interval: Integer read FInterval write SetInterval default defInterval;
- property Item: TMMItemIndex read FItem write SetItem default NoItem;
- property Enabled: Boolean read FEnabled write SetEnabled default True;
- property OnChange: TNotifyEvent read FOnChange write FOnChange;
- end;
- {-- TMMMixerConnector -----------------------------------------------}
- TMMMixerConnector = class(TMMCustomMixerConnector)
- published
- property OnChange;
- property Control;
- property Level1;
- property Level2;
- property Meter1;
- property Meter2;
- property AutoTrigger;
- property Interval;
- property Item;
- property Enabled;
- end;
- {-- TMMMixerLabelConnector ------------------------------------------}
- TMMMixerLabelConnector = class(TMMComponent)
- private
- FCaptionLink: TMMCaptionLink;
- FDest : TControl;
- FAllCaps : Boolean;
- FOnChange : TNotifyEvent;
- procedure CaptionChanged(Sender: TObject);
- function GetSource: TMMComponent;
- procedure SetSource(Value: TMMComponent);
- function GetItem: TMMItemIndex;
- procedure SetItem(Value: TMMItemIndex);
- function GetShort: Boolean;
- procedure SetShort(Value: Boolean);
- procedure SetDest(Value: TControl);
- function GetTitle: string;
- procedure SetAllCaps(Value: Boolean);
- protected
- procedure Notification(AComponent: TComponent; Operation: TOperation); override;
- procedure UpdateLabel;
- procedure Loaded; override;
- procedure Changed; virtual;
- procedure DoChange; dynamic;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- property Title: string read GetTitle;
- published
- property Source: TMMComponent read GetSource write SetSource;
- property Item: TMMItemIndex read GetItem write SetItem default NoItem;
- property Short: Boolean read GetShort write SetShort default False;
- property Destination: TControl read FDest write SetDest;
- property AllCaps: Boolean read FAllCaps write SetAllCaps default False;
- property OnChange: TNotifyEvent read FOnChange write FOnChange;
- end;
- {-- TMMDeviceSpin ---------------------------------------------------}
- TMMDeviceSpin = class(TMMCustomSpinButton)
- private
- FDevice : TMMCustomAudioDevice;
- FEnabled : Boolean;
- FObserver : TMMObserver;
- FCanUpdate : Boolean;
- FIncludeMapper : Boolean;
- procedure SetDevice(Value: TMMCustomAudioDevice);
- procedure DeviceNotify(Sender, Data: TObject);
- procedure SetEnabled(Value: Boolean);
- procedure SetInclMapper(Value: Boolean);
- protected
- procedure Notification(AComponent: TComponent; Operation: TOperation); override;
- procedure UpdateSpin;
- procedure Change; override;
- procedure Loaded; override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- published
- property Enabled: Boolean read FEnabled write SetEnabled default True;
- property Device: TMMCustomAudioDevice read FDevice write SetDevice;
- property IncludeMapper: Boolean read FIncludeMapper write SetInclMapper default True;
- property OnChange;
- property OnDownClick;
- property OnUpClick;
- property Bevel;
- property DownGlyph;
- property DownNumGlyphs;
- property FocusColor;
- property FocusControl;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property TabStop;
- property TabOrder;
- property UpGlyph;
- property UpNumGlyphs;
- property Visible;
- property Width;
- property Height;
- property ButtonFace;
- property MiddleButton;
- property Value;
- end;
- {-- TMMCustomDeviceComboBox --------------------------------------------}
- TMMCustomDeviceComboBox = class(TCustomComboBox)
- private
- FDevice : TMMCustomAudioDevice;
- FEnabled : Boolean;
- FObserver : TMMObserver;
- FCanUpdate : Boolean;
- FIncludeMapper : Boolean;
- procedure SetDevice(Value: TMMCustomAudioDevice);
- procedure DeviceNotify(Sender, Data: TObject);
- procedure SetEnabled(Value: Boolean);
- procedure SetInclMapper(Value: Boolean);
- protected
- procedure Notification(AComponent: TComponent; Operation: TOperation); override;
- procedure UpdateCombo;
- procedure Loaded; override;
- procedure Change; override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- protected
- property Device: TMMCustomAudioDevice read FDevice write SetDevice;
- property Enabled: Boolean read FEnabled write SetEnabled default True;
- property IncludeMapper: Boolean read FIncludeMapper write SetInclMapper default True;
- end;
- {-- TMMDeviceComboBox --------------------------------------------------}
- TMMDeviceComboBox = class(TMMCustomDeviceComboBox)
- published
- property OnChange;
- property OnClick;
- property OnDblClick;
- property OnDragDrop;
- property OnDragOver;
- property OnDrawItem;
- property OnDropDown;
- property OnEndDrag;
- property OnEnter;
- property OnExit;
- property OnKeyDown;
- property OnKeyPress;
- property OnKeyUp;
- property OnMeasureItem;
- property OnStartDrag;
- property Device;
- property Enabled;
- property IncludeMapper;
- property Color;
- property Ctl3D;
- property DragMode;
- property DragCursor;
- property DropDownCount;
- property Font;
- property ItemHeight;
- property MaxLength;
- property ParentColor;
- property ParentCtl3D;
- property ParentFont;
- property ParentShowHint;
- property PopupMenu;
- property ShowHint;
- property Sorted;
- property TabOrder;
- property TabStop;
- property Visible;
- end;
- {-- EMMMixerControlsError ----------------------------------------------}
- EMMMixerControlsError = class(Exception)
- end;
- {=======================================================================}
- implementation
- {=======================================================================}
|