MMLEVEL.INT 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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 MMLevel;
  26. {$C FIXED PRELOAD PERMANENT}
  27. {$I COMPILER.INC}
  28. Interface
  29. Uses
  30. {$IFDEF WIN32}
  31. Windows,
  32. {$ELSE}
  33. WinTypes,
  34. WinProcs,
  35. {$ENDIF}
  36. SysUtils,
  37. Messages,
  38. Classes,
  39. Graphics,
  40. Controls,
  41. Forms,
  42. Dialogs,
  43. Menus,
  44. MMSystem,
  45. MMUtils,
  46. MMString,
  47. MMObj,
  48. MMTimer,
  49. MMMulDiv,
  50. MMMath,
  51. MMRegs,
  52. MMPCMSup,
  53. MMWaveIO,
  54. MMDIBCv,
  55. MMScale;
  56. const
  57. MAXDECAYCOUNT = 32; { Maximum amount of temporal averaging allowed }
  58. VALUERANGE = 100; { Range for SetValue/GetValue, here 0..100% }
  59. type
  60. EMMLevelError = class(Exception);
  61. TMMLevelKind = (lkHorizontal, lkVertical);
  62. TMMLevelDirection = (dirNormal, dirReversed);
  63. TMMLevelDrawBar = procedure(Sender: TObject; DIB: TMMDIBCanvas;
  64. Rect: TRect; Value, Peak: integer) of object;
  65. { array for uniform decay mode values }
  66. TDataBuf = array[0..MAXDECAYCOUNT-1] of Long;
  67. {-- TMMCustomLevel ---------------------------------------------------------}
  68. TMMCustomLevel = class(TMMDIBGraphicControl)
  69. public
  70. constructor Create(AOwner: TComponent); override;
  71. destructor Destroy; override;
  72. procedure RefreshPCMData(PCMData: Pointer);
  73. procedure SetData(aValue: integer);
  74. procedure ResetData;
  75. property BytesPerLevel: Longint read FBytes;
  76. property PCMWaveFormat: TPCMWaveFormat read GetPCMWaveFormat write SetPCMWaveFormat;
  77. property NumSpots: integer read FNumSpots;
  78. property Point1Spot: integer read FPoint1Spot;
  79. property Point2Spot: integer read FPoint2Spot;
  80. property Peak: integer read FPeakValue;
  81. protected
  82. { Events }
  83. property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
  84. property OnDrawBar: TMMLevelDrawBar read FOnDrawBar write SetOnDrawBar;
  85. property OnGainOverflow: TNotifyEvent read FOnGainOverflow write FOnGainOverflow;
  86. property OnPcmOverflow: TNotifyEvent read FOnPcmOverflow write FOnPcmOverflow;
  87. property ParentColor default False;
  88. property Color default clBlack;
  89. property Enabled: Boolean read FEnabled write SetEnabled default True;
  90. property Kind: TMMLevelKind read FKind write SetKind default lkHorizontal;
  91. property Height default 17;
  92. property Width default 200;
  93. property SpotSpace: integer read FSpotSpace write SetSpotSpace default 1;
  94. property SpotWidth: integer read FSpotWidth write SetSpotWidth default 1;
  95. property Bar1Color: TColor index 0 read FBar1Color write SetColors default clAqua;
  96. property Bar2Color: TColor index 1 read FBar2Color write SetColors default clAqua;
  97. property Bar3Color: TColor index 2 read FBar3Color write SetColors default clRed;
  98. property Inactive1Color: TColor index 3 read FInact1Color write SetColors default clTeal;
  99. property Inactive2Color: TColor index 4 read FInact2Color write SetColors default clTeal;
  100. property Inactive3Color: TColor index 5 read FInact3Color write SetColors default clMaroon;
  101. property InactiveDoted: Boolean read FInactiveDoted write SetInactiveDoted default False;
  102. property ActiveDoted: Boolean read FActiveDoted write SetActiveDoted default False;
  103. property Point1: integer index 0 Read FPoint1 write SetPoints default 50;
  104. property Point2: integer index 1 Read FPoint2 write SetPoints default 85;
  105. property Direction: TMMLevelDirection read FDirection write SetDirection default dirNormal;
  106. property BitLength: TMMBits read FBits write setBits default b8bit;
  107. property Channel: TMMChannel read FChannel write setChannel default chBoth;
  108. property Mode: TMMMode read FMode write SetMode default mMono;
  109. property Gain: Integer read getGain write setGain default 0;
  110. property Samples: integer read FSamples write SetSamples default 50;
  111. property Sensitivy: integer read FSensitivy write SetSensitivy default -35;
  112. property LogAmp: Boolean read FLogAmp write SetLogAmp default True;
  113. property NumPeaks: integer read FNumPeaks write SetNumPeaks default 1;
  114. property PeakDelay: integer read FPeakDelay write SetPeakDelay default 20;
  115. property PeakSpeed: integer read FPeakSpeed write SetPeakSpeed default 0;
  116. property DecayMode: TMMDecayMode read FDecayMode write SetDecayMode default dmNone;
  117. property Decay: integer read FDecay write SetDecay default 1;
  118. property Value: integer read GetValue write SetValue stored False default 0;
  119. end;
  120. {-- TMMLevel --------------------------------------------------------}
  121. TMMLevel = class(TMMCustomLevel)
  122. published
  123. property OnClick;
  124. property OnDblClick;
  125. property OnMouseDown;
  126. property OnMouseMove;
  127. property OnMouseUp;
  128. property OnDrawBar;
  129. property OnGainOverflow;
  130. property OnPcmOverflow;
  131. property OnPaint;
  132. property Align;
  133. property Bevel;
  134. property PopupMenu;
  135. property ParentShowHint;
  136. property ParentColor;
  137. property ShowHint;
  138. property Visible;
  139. property Color;
  140. property Enabled;
  141. property Kind;
  142. property Height;
  143. property Width;
  144. property SpotSpace;
  145. property SpotWidth;
  146. property Bar1Color;
  147. property Bar2Color;
  148. property Bar3Color;
  149. property Inactive1Color;
  150. property Inactive2Color;
  151. property Inactive3Color;
  152. property InactiveDoted;
  153. property ActiveDoted;
  154. property Point1;
  155. property Point2;
  156. property Direction;
  157. property BitLength;
  158. property Channel;
  159. property Mode;
  160. property Gain;
  161. property Samples;
  162. property Sensitivy;
  163. property LogAmp;
  164. property NumPeaks;
  165. property PeakDelay;
  166. property PeakSpeed;
  167. property DecayMode;
  168. property Decay;
  169. property Value;
  170. end;
  171. {-- TMMLevScale -----------------------------------------------------}
  172. TMMLevScale = class(TMMCustomScale)
  173. published
  174. property Visible default False;
  175. property TickCount;
  176. property EnlargeEvery;
  177. property Size;
  178. property Origin;
  179. property Connect;
  180. end;
  181. TMMScalePos = (spAboveOrLeft, spBelowOrRight, spBoth);
  182. {-- TMMLevelScale ---------------------------------------------------}
  183. TMMLevelScale = class(TMMGraphicControl)
  184. public
  185. constructor Create(AOwner: TComponent); override;
  186. destructor Destroy; override;
  187. procedure Paint; override;
  188. published
  189. { Events }
  190. property OnClick;
  191. property OnDblClick;
  192. property OnMouseDown;
  193. property OnMouseMove;
  194. property OnMouseUp;
  195. property Align;
  196. property Width default 200;
  197. property Height default 7;
  198. property Visible;
  199. property Enabled;
  200. property PopupMenu;
  201. property ParentShowHint;
  202. property ParentFont default False;
  203. property Font;
  204. property Color default clBlack;
  205. property ScaleTicks: integer read FScaleTicks write SetScaleTicks default 8;
  206. property Point1: integer index 0 Read FPoint1 write SetPoints default 50;
  207. property Point2: integer index 1 Read FPoint2 write SetPoints default 85;
  208. property Scale1Color: TColor index 0 read FScale1Color write SetColors default clWhite;
  209. property Scale2Color: TColor index 1 read FScale2Color write SetColors default clWhite;
  210. property Scale3Color: TColor index 2 read FScale3Color write SetColors default clRed;
  211. property Sensitivy: integer read FSensitivy write SetSensitivy default -35;
  212. property LogAmp: Boolean read FLogAmp write SetLogAmp default True;
  213. property Kind: TMMLevelKind read FKind write SetKind default lkHorizontal;
  214. property Direction: TMMLevelDirection read FDirection write SetDirection default dirNormal;
  215. property Scale: TMMLevScale read FScale write SetScale;
  216. property ScalePos: TMMScalePos read FScalePos write SetScalePos default spBoth;
  217. end;
  218. implementation