MMFADE.INT 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 MMFade;
  26. {$I COMPILER.INC}
  27. interface
  28. uses
  29. {$IFDEF WIN32}
  30. Windows,
  31. {$ELSE}
  32. WinProcs,
  33. WinTypes,
  34. {$ENDIF}
  35. SysUtils,
  36. Messages,
  37. Classes,
  38. Controls,
  39. MMObj,
  40. MMutils,
  41. MMMulDiv,
  42. MMRegs,
  43. MMPCMSup;
  44. const
  45. Overflow : Boolean = False;
  46. type
  47. PMMFadePoint = ^TMMFadePoint;
  48. TMMFadePoint = record
  49. Offset : Longint;
  50. Volume : Longint;
  51. VolumeL : Longint;
  52. VolumeR : Longint;
  53. Selected : LongBool;
  54. end;
  55. PMMFadeSeg = ^TMMFadeSeg;
  56. TMMFadeSeg = record
  57. ptStart : TMMFadePoint;
  58. ptEnd : TMMFadePoint;
  59. end;
  60. const
  61. { Maximum List size }
  62. MaxListSize = Maxint div (sizeOf(TMMFadePoint)*sizeOf(TMMFadePoint));
  63. type
  64. PMMFadeArray = ^TMMFadeArray;
  65. TMMFadeArray = array[0..MaxListSize-1] of TMMFadePoint;
  66. {-- TMMFadeList -----------------------------------------------------}
  67. TMMFadeList = class(TMMObject)
  68. public
  69. destructor Destroy; override;
  70. procedure Clear;
  71. procedure Sort;
  72. function Add(Point: TMMFadePoint): Integer;
  73. procedure Insert(Index: Integer; Point: TMMFadePoint);
  74. procedure Delete(Index: Integer);
  75. function Selected(Index: Integer): Boolean;
  76. function QueryFadePoint(Point: TMMFadePoint): Boolean;
  77. function AddFadePoint(Point: TMMFadePoint; Align: Boolean): Boolean;
  78. function LocateFadePoint(Offset: Longint): integer;
  79. function FindFadePoint(Offset: Longint): integer;
  80. function CalcFadeVolume(Offset: Longint): Longint;
  81. procedure Assign(Source: TPersistent); virtual;
  82. procedure AssignEnvelope(Source: TPersistent); virtual;
  83. procedure AssignToEnvelope(Dest: TPersistent); virtual;
  84. function First: PMMFadePoint;
  85. function Last: PMMFadePoint;
  86. function Expand: TMMFadeList;
  87. property Capacity: Integer read FCapacity write SetCapacity;
  88. property Count: Integer read FCount write SetCount;
  89. property Points[Index: Integer]: PMMFadePoint read Get write Put; default;
  90. property List: PMMFadeArray read FList;
  91. property CurIndex: Longint read FCurIndex write FCurIndex;
  92. property StartOffset: Longint read FStartOffset write FStartOffset;
  93. property StartVolumeL: Longint read FStartVolumeL write FStartVolumeL;
  94. property StartVolumeR: Longint read FStartVolumeR write FStartVolumeR;
  95. end;
  96. function pcmVolumeFade8(pwfx: PWaveFormatEx; lpData: PChar;
  97. dwSrcLen: TDataSize; FadeList: TMMFadeList): Boolean;
  98. function pcmVolumeFade16(pwfx: PWaveFormatEx; lpData: PChar;
  99. dwSrcLen: TDataSize; FadeList: TMMFadeList): Boolean;
  100. implementation