bero1985

Untitled

Sep 19th, 2011
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.79 KB | None | 0 0
  1. procedure TVIC.GenerateSound;
  2. var x,y,sc:integer;
  3.     Src:pbyte;
  4.     c:int64;
  5.     LastPixel,NewPixel:byte;
  6.     s:single;
  7. begin
  8.  AudioRingBuffer.Position:=0;
  9.  AudioRingBuffer.OutputPosition:=0;
  10.  c:=0;
  11.  LastPixel:=0;
  12.  s:=0;
  13.  sc:=0;
  14.  for y:=0 to VICHeight-1 do begin
  15.   Src:=@BufferBitmap[y,0];
  16.   for x:=1 to VICWidth do begin
  17.    NewPixel:=Src^;
  18.    s:=s+PCMTable[LastPixel,NewPixel];
  19.    inc(sc);
  20.    LastPixel:=NewPixel;
  21.    inc(c,VICSoundPixelsPerSampleStep);
  22.    if longword(c shr 32)<>0 then begin
  23.     c:=c and $ffffffff;
  24.     AudioRingBuffer.Samples[AudioRingBuffer.Position]:=s/sc;
  25.     inc(AudioRingBuffer.Position);
  26.     if AudioRingBuffer.Position>=length(AudioRingBuffer.Samples) then begin
  27.      AudioRingBuffer.Position:=0;
  28.     end;
  29.     s:=0;
  30.     sc:=0;
  31.    end;
  32.   end;
  33.  end;
  34. end;
Advertisement
Add Comment
Please, Sign In to add comment