Procedure FillSine(audioBuffer: Pointer; sampleToWrite: longint; channels : integer; samleDepth : integer);
var
nextBufer : PSmallInt;
sample16 : SmallInt;
sample32 : integer;
i, ch : longint;
begin
case samleDepth of
16 :
begin
for i:=0 to sampleToWrite-1 do
begin
sample16:=Round(24576.0 * sin((i*2.0*PI) / 48.0));
for ch := 0 to channels-1 do
begin
PSmallInt(audioBuffer)^:=sample16;
inc(PSmallInt(audioBuffer),1);
end;
end;
end;
32 :
begin
for i:=0 to sampleToWrite-1 do
begin
sample32:=Round(1610612736.0 * sin((i*2.0*PI) / 48.0));
for ch := 0 to channels-1 do
begin
PInteger(audioBuffer)^:=sample32;
inc(PInteger(audioBuffer),1);
end;
end;
end;
end;
end;
четвер, 14 лютого 2013 р.
1000Hz Tone Generator
Підписатися на:
Дописати коментарі (Atom)

Немає коментарів:
Дописати коментар