5 uses System.Classes, System.SysUtils, Math, spWav;
7 function effect8BitWav(const sp: SpParam): integer;
8 function effect16BitWav(const sp: SpParam): integer;
10 function effectwav(const sp: SpParam): integer;
14 function effect8BitWav(const sp: SpParam): integer;
19 i, delayStart: integer;
21 pMem, pCpy: array of Byte;
26 s := TMemoryStream.Create;
27 s.ReadBuffer(sp.pWav^, sp.sizeOfData);
31 k := 8 * sp.sizeOfData / sp.bitsPerSample;
34 m := depth * sin(2 * pi * rate / sp.samplePerSec);
35 pMem[i + 0] := trunc(m * pMem[i + 0]) + 128;
36 pMem[i + 1] := trunc(m * pMem[i + 1]) + 128;
44 function effect16BitWav(const sp: SpParam): integer;
51 pMem, pCpy: array of SmallInt;
55 s := TMemoryStream.Create;
57 SetLength(pCpy, sp.sizeOfData);
58 s.Write(sp.pWav^, sp.sizeOfData);
60 s.Read(Pointer(pCpy)^, sp.sizeOfData);
63 k := 8 * sp.sizeOfData / sp.bitsPerSample;
66 m := depth * sin(2 * rate * pi * i / sp.samplePerSec);
67 pMem[i + 0] := trunc(m * pMem[i + 0]);
68 pMem[i + 1] := trunc(m * pMem[i + 1]);
80 Writeln('
\82Ì
\82±
\82¬
\82è
\94g');
81 Writeln('
\97á
\81Feffect.wav 100 2000');
84 function effectwav(const sp: SpParam): integer;
86 if sp.channels = 1 then
88 Writeln('
\83X
\83e
\83\8c\83I
\83t
\83@
\83C
\83\8b\82É
\82µ
\82Ä
\82
\82¾
\82³
\82¢');
91 if sp.bitsPerSample = 8 then
92 result := effect8BitWav(sp)
94 result := effect16BitWav(sp);