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;
16 i, delayStart: integer;
18 pMem, pCpy: array of Byte;
20 L, R, DuetL, DuetR: SmallInt;
24 s := TMemoryStream.Create;
25 s.ReadBuffer(sp.pWav^, sp.sizeOfData);
28 delayStart := sp.samplePerSec * sp.cycleuSec;
29 i := delayStart + sp.posOfData;
30 k := 8 * sp.sizeOfData / sp.bitsPerSample;
35 DuetL := pCpy[i + 0 - delayStart];
36 DuetR := pCpy[i + 1 - delayStart];
49 function effect16BitWav(const sp: SpParam): integer;
51 i, delayStart: integer;
53 pMem, pCpy: array of SmallInt;
55 L, R, DuetL, DuetR: SmallInt;
58 s := TMemoryStream.Create;
60 SetLength(pCpy, sp.sizeOfData);
61 s.Write(sp.pWav^, sp.sizeOfData);
63 s.Read(Pointer(pCpy)^, sp.sizeOfData);
65 delayStart := sp.posOfData + sp.samplePerSec * sp.cyclicSec;
66 i := delayStart + sp.posOfData;
67 k := 8 * sp.sizeOfData / sp.bitsPerSample;
72 DuetL := pCpy[i + 0 - delayStart];
73 DuetR := pCpy[i + 1 - delayStart];
76 L := max(-32768, min(32767, L));
77 R := max(-32768, min(32767, R));
91 Writeln('
\82Ì
\82±
\82¬
\82è
\94g');
92 Writeln('
\97á
\81Feffect.wav 100 2000');
95 function effectwav(const sp: SpParam): integer;
97 if sp.channels = 1 then
99 Writeln('
\83X
\83e
\83\8c\83I
\83t
\83@
\83C
\83\8b\82É
\82µ
\82Ä
\82
\82¾
\82³
\82¢');
102 if sp.bitsPerSample = 8 then
103 result := effect8BitWav(sp)
105 result := effect16BitWav(sp);