Advertisement
Guest User

Untitled

a guest
Jun 18th, 2010
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.92 KB | None | 0 0
  1. var
  2.   sr, Depth: Integer;
  3.   Err: TR8BError;
  4.   InputFormat: TR8BInputFormat;
  5.   BuffIn, BuffOut: Pointer;
  6.   OutLength: Integer;
  7.   FSIn, FSOut: TFileStream;
  8.   ActOut: integer;
  9. begin
  10.   Done := False;
  11.   FSIn := TFileStream.Create('32k_sample.wav', fmOpenRead  );
  12.   FSOut := TFileStream.Create('32k_sample_out.wav', fmCreate);
  13.   try
  14.     GetMem(BuffIn, FSIn.Size);
  15.     FSIn.Read(BuffIn^, FSIn.Size);
  16.  
  17.     InputFormat.Channels := 1;
  18.     InputFormat.Buffer := BuffIn;
  19.     InputFormat.Len := 32000 * 28;
  20.     InputFormat.Rate := 32000;
  21.  
  22.     OutLength := Trunc(InputFormat.Len * 44100 / InputFormat.Rate + 0.5);
  23.     GetMem(BuffOut, OutLEngth);
  24.     r8b_executeMem(
  25.       InputFormat,
  26.       BuffOut,
  27.       OutLength,
  28.       44100,
  29.       16,
  30.       0,
  31.       FCancelFlag,
  32.       nil,
  33.       nil,
  34.       Err,
  35.       ActOut
  36.       );
  37.      FSOut.Write(BuffOut^, ActOut)
  38.  
  39.  
  40.  
  41.   finally
  42.     FSIn.Free;
  43.     FSOut.Free;
  44.   end;
  45.  
  46. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement