| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- {========================================================================}
- {= (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 MMLevel;
- {$C FIXED PRELOAD PERMANENT}
- {$I COMPILER.INC}
- Interface
- Uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinTypes,
- WinProcs,
- {$ENDIF}
- SysUtils,
- Messages,
- Classes,
- Graphics,
- Controls,
- Forms,
- Dialogs,
- Menus,
- MMSystem,
- MMUtils,
- MMString,
- MMObj,
- MMTimer,
- MMMulDiv,
- MMMath,
- MMRegs,
- MMPCMSup,
- MMWaveIO,
- MMDIBCv,
- MMScale;
- const
- MAXDECAYCOUNT = 32; { Maximum amount of temporal averaging allowed }
- VALUERANGE = 100; { Range for SetValue/GetValue, here 0..100% }
- type
- EMMLevelError = class(Exception);
- TMMLevelKind = (lkHorizontal, lkVertical);
- TMMLevelDirection = (dirNormal, dirReversed);
- TMMLevelDrawBar = procedure(Sender: TObject; DIB: TMMDIBCanvas;
- Rect: TRect; Value, Peak: integer) of object;
- { array for uniform decay mode values }
- TDataBuf = array[0..MAXDECAYCOUNT-1] of Long;
- {-- TMMCustomLevel ---------------------------------------------------------}
- TMMCustomLevel = class(TMMDIBGraphicControl)
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure RefreshPCMData(PCMData: Pointer);
- procedure SetData(aValue: integer);
- procedure ResetData;
- property BytesPerLevel: Longint read FBytes;
- property PCMWaveFormat: TPCMWaveFormat read GetPCMWaveFormat write SetPCMWaveFormat;
- property NumSpots: integer read FNumSpots;
- property Point1Spot: integer read FPoint1Spot;
- property Point2Spot: integer read FPoint2Spot;
- property Peak: integer read FPeakValue;
- protected
- { Events }
- property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
- property OnDrawBar: TMMLevelDrawBar read FOnDrawBar write SetOnDrawBar;
- property OnGainOverflow: TNotifyEvent read FOnGainOverflow write FOnGainOverflow;
- property OnPcmOverflow: TNotifyEvent read FOnPcmOverflow write FOnPcmOverflow;
- property ParentColor default False;
- property Color default clBlack;
- property Enabled: Boolean read FEnabled write SetEnabled default True;
- property Kind: TMMLevelKind read FKind write SetKind default lkHorizontal;
- property Height default 17;
- property Width default 200;
- property SpotSpace: integer read FSpotSpace write SetSpotSpace default 1;
- property SpotWidth: integer read FSpotWidth write SetSpotWidth default 1;
- property Bar1Color: TColor index 0 read FBar1Color write SetColors default clAqua;
- property Bar2Color: TColor index 1 read FBar2Color write SetColors default clAqua;
- property Bar3Color: TColor index 2 read FBar3Color write SetColors default clRed;
- property Inactive1Color: TColor index 3 read FInact1Color write SetColors default clTeal;
- property Inactive2Color: TColor index 4 read FInact2Color write SetColors default clTeal;
- property Inactive3Color: TColor index 5 read FInact3Color write SetColors default clMaroon;
- property InactiveDoted: Boolean read FInactiveDoted write SetInactiveDoted default False;
- property ActiveDoted: Boolean read FActiveDoted write SetActiveDoted default False;
- property Point1: integer index 0 Read FPoint1 write SetPoints default 50;
- property Point2: integer index 1 Read FPoint2 write SetPoints default 85;
- property Direction: TMMLevelDirection read FDirection write SetDirection default dirNormal;
- property BitLength: TMMBits read FBits write setBits default b8bit;
- property Channel: TMMChannel read FChannel write setChannel default chBoth;
- property Mode: TMMMode read FMode write SetMode default mMono;
- property Gain: Integer read getGain write setGain default 0;
- property Samples: integer read FSamples write SetSamples default 50;
- property Sensitivy: integer read FSensitivy write SetSensitivy default -35;
- property LogAmp: Boolean read FLogAmp write SetLogAmp default True;
- property NumPeaks: integer read FNumPeaks write SetNumPeaks default 1;
- property PeakDelay: integer read FPeakDelay write SetPeakDelay default 20;
- property PeakSpeed: integer read FPeakSpeed write SetPeakSpeed default 0;
- property DecayMode: TMMDecayMode read FDecayMode write SetDecayMode default dmNone;
- property Decay: integer read FDecay write SetDecay default 1;
- property Value: integer read GetValue write SetValue stored False default 0;
- end;
- {-- TMMLevel --------------------------------------------------------}
- TMMLevel = class(TMMCustomLevel)
- published
- property OnClick;
- property OnDblClick;
- property OnMouseDown;
- property OnMouseMove;
- property OnMouseUp;
- property OnDrawBar;
- property OnGainOverflow;
- property OnPcmOverflow;
- property OnPaint;
- property Align;
- property Bevel;
- property PopupMenu;
- property ParentShowHint;
- property ParentColor;
- property ShowHint;
- property Visible;
- property Color;
- property Enabled;
- property Kind;
- property Height;
- property Width;
- property SpotSpace;
- property SpotWidth;
- property Bar1Color;
- property Bar2Color;
- property Bar3Color;
- property Inactive1Color;
- property Inactive2Color;
- property Inactive3Color;
- property InactiveDoted;
- property ActiveDoted;
- property Point1;
- property Point2;
- property Direction;
- property BitLength;
- property Channel;
- property Mode;
- property Gain;
- property Samples;
- property Sensitivy;
- property LogAmp;
- property NumPeaks;
- property PeakDelay;
- property PeakSpeed;
- property DecayMode;
- property Decay;
- property Value;
- end;
- {-- TMMLevScale -----------------------------------------------------}
- TMMLevScale = class(TMMCustomScale)
- published
- property Visible default False;
- property TickCount;
- property EnlargeEvery;
- property Size;
- property Origin;
- property Connect;
- end;
- TMMScalePos = (spAboveOrLeft, spBelowOrRight, spBoth);
- {-- TMMLevelScale ---------------------------------------------------}
- TMMLevelScale = class(TMMGraphicControl)
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure Paint; override;
- published
- { Events }
- property OnClick;
- property OnDblClick;
- property OnMouseDown;
- property OnMouseMove;
- property OnMouseUp;
- property Align;
- property Width default 200;
- property Height default 7;
- property Visible;
- property Enabled;
- property PopupMenu;
- property ParentShowHint;
- property ParentFont default False;
- property Font;
- property Color default clBlack;
- property ScaleTicks: integer read FScaleTicks write SetScaleTicks default 8;
- property Point1: integer index 0 Read FPoint1 write SetPoints default 50;
- property Point2: integer index 1 Read FPoint2 write SetPoints default 85;
- property Scale1Color: TColor index 0 read FScale1Color write SetColors default clWhite;
- property Scale2Color: TColor index 1 read FScale2Color write SetColors default clWhite;
- property Scale3Color: TColor index 2 read FScale3Color write SetColors default clRed;
- property Sensitivy: integer read FSensitivy write SetSensitivy default -35;
- property LogAmp: Boolean read FLogAmp write SetLogAmp default True;
- property Kind: TMMLevelKind read FKind write SetKind default lkHorizontal;
- property Direction: TMMLevelDirection read FDirection write SetDirection default dirNormal;
- property Scale: TMMLevScale read FScale write SetScale;
- property ScalePos: TMMScalePos read FScalePos write SetScalePos default spBoth;
- end;
- implementation
|