MMOSCOPE.INT 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Tel.: +0351-8012255 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 20.01.1998 - 18:00:00 $ =}
  24. {========================================================================}
  25. Unit MMOscope;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. {$IFDEF WIN32}
  30. Windows,
  31. {$ELSE}
  32. WinTypes,
  33. WinProcs,
  34. {$ENDIF}
  35. SysUtils,
  36. Messages,
  37. Classes,
  38. Graphics,
  39. Controls,
  40. Forms,
  41. Dialogs,
  42. ExtCtrls,
  43. MMUtils,
  44. MMString,
  45. MMObj,
  46. MMRegs,
  47. MMPCMSup,
  48. MMWaveIO,
  49. MMDIBCv;
  50. const
  51. SCALEHEIGHT = 40;
  52. SCALEWIDTH = 32;
  53. SCALEFONT = 'ARIAL';
  54. SCALEFONTSIZE : integer = 10;
  55. INFOCOLOR : TCOLOR = clWhite;
  56. EFFECTLIMIT : integer = 3;
  57. MAX_FFTLEN = 4096; { Define the maximum FFT buffer length. }
  58. type
  59. EMMOscopeError = class(Exception);
  60. TMMOscopeKind = (okDots,okConLines,okVertLines,okMirLines,okSpikes);
  61. TMMOscopeEffect = (efNone,efPeak,efSplit);
  62. TMMOscopeDrawLine= procedure(Sender: TObject; DIB: TMMDIBCanvas; Rect: TRect; Data: PSmallArray)of object;
  63. {-- TMMOscope --------------------------------------------------------}
  64. TMMOscope = class(TMMDIBGraphicControl)
  65. public
  66. constructor Create(AOwner: TComponent); override;
  67. destructor Destroy; override;
  68. procedure RefreshPCMData(PCMData: Pointer);
  69. procedure ResetData;
  70. function GetAmplitude(Pos: TPoint): Float;
  71. function GetTime(Pos: TPoint): Float;
  72. property BytesPerScope: Longint read FBytes;
  73. procedure Marked(mkBegin, mkEnd: integer; Redraw: Boolean);
  74. property PCMWaveFormat: TPCMWaveFormat read GetPCMWaveFormat write SetPCMWaveFormat;
  75. published
  76. { Events }
  77. property OnClick;
  78. property OnDblClick;
  79. property OnMouseDown;
  80. property OnMouseMove;
  81. property OnMouseUp;
  82. property OnGainOverflow: TNotifyEvent read FOnGainOverflow write FOnGainOverflow;
  83. property OnPcmOverflow: TNotifyEvent read FOnPcmOverflow write FOnPcmOverflow;
  84. property OnDrawLine: TMMOscopeDrawLine read FOnDrawLine write FOnDrawLine;
  85. property OnPostPaint: TNotifyEvent read FOnPostPaint write FOnPostPaint;
  86. property Align;
  87. property Bevel;
  88. property BackGroundDIB;
  89. property UseBackGroundDIB;
  90. property PaletteRealize;
  91. property PaletteMapped;
  92. property Color default clBlack;
  93. property Cursor default crCross;
  94. property ParentShowHint;
  95. property ParentColor default False;
  96. property Visible;
  97. property ShowHint;
  98. property ShowInfo: Boolean read FShowInfo write FShowInfo default True;
  99. property Enabled: Boolean read FEnabled write SetEnabled default True;
  100. property Height default 90;
  101. property Width default 194;
  102. property Accelerate: Boolean read FAccelerate write SetAccelerate default True;
  103. property Scroll: Boolean read FScroll write SetScroll default False;
  104. property DrawMidLine: Boolean read FDrawMidLine write SetDrawMidLine default False;
  105. property Kind: TMMOscopeKind read FKind write SetKind default okDots;
  106. property ForegroundColor: TColor index 0 read FForeColor write SetColors default clAqua;
  107. property InactiveColor: TColor index 1 read FInactColor write SetColors default clTeal;
  108. property EffectColor: TColor index 2 read FEffectColor write SetColors default clRed;
  109. property DisabledColor: TColor index 3 read FOffColor write SetColors default clGray;
  110. Property ScaleTextColor: TColor index 4 read FScaleTextColor write SetColors default clBlack;
  111. Property ScaleLineColor: TColor index 5 read FScaleLineColor write SetColors default clBlack;
  112. Property GridColor: TColor index 6 read FGridColor write SetColors default clGray;
  113. property BarColor: TColor index 7 read FBarColor write SetColors default clGray;
  114. property BarTickColor: TColor index 8 read FBarTickColor write SetColors default clWhite;
  115. property BarWidth: integer read FBarWidth write SetBarWidth default 5;
  116. property BitLength: TMMBits read FBits write SetBits default b8bit;
  117. property Channel: TMMChannel read FChannel write SetChannel default chBoth;
  118. property SampleRate: Longint read FSampleRate write SetSampleRate default 11025;
  119. property Mode: TMMMode read FMode write SetMode default mMono;
  120. property Steps: Integer read FSteps write SetSteps default 1;
  121. property Zoom: Integer read FZoom write SetZoom default 1;
  122. property Gain: Integer read GetGain write SetGain default 0;
  123. property Effect: TMMOscopeEffect read FEffect write SetEffect default efNone;
  124. property DrawAmpScale: Boolean read FDrawAmpScale write SetDrawAmpScale default False;
  125. property DrawTimeScale: Boolean read FDrawTimeScale write SetDrawTimeScale default False;
  126. property DrawGrid: Boolean read FDrawGrid write SetDrawGrid default False;
  127. property FFTLength: integer read FFTLen write SetFFTLen default 128;
  128. end;
  129. implementation