Page 1 of 1

How do use Stream in AudioRedirector

PostPosted: November 7th, 2007, 2:44 pm
by john123
Hi,
Please show a sample for use Stream in AudioRedirector.
thanks

PostPosted: November 7th, 2007, 5:39 pm
by Kambiz
Here is a simple sample. In this example, I have used a file stream, but the stream can be any TStream descendant.

Code: Select all
procedure TForm1.btnStartClick(Sender: TObject);
begin
  AudioRedirector1.Stream := TFileStream.Create('C:\test.wav', fmCreate);
  AudioRedirector1.Active := True;
end;

procedure TForm1.btnStopClick(Sender: TObject);
var
  Stream: TStream;
begin
  AudioRedirector1.Active := False;
  Stream := AudioRedirector1.Stream;
  AudioRedirector1.Stream := nil;
  Stream.Free;
end;

Access violation in your(simple sample) code

PostPosted: November 8th, 2007, 6:03 am
by john123
hi,

your code is wrong or (is bug in your component)
your code riase exception class Eaccessviolation & break in follow code(in WaveUtils) please Check.

// Initializes a new wave RIFF format in an open mmIO handle. The previous
// content of mmIO will be lost.
function CreateWaveAudio(mmIO: HMMIO; const pWaveFormat: PWaveFormatEx;
out ckRIFF, ckData: TMMCKInfo): Boolean;
var
ckFormat: TMMCKInfo;
FormatSize: Integer;
begin
Result := False;

FormatSize := SizeOf(TWaveFormatEx) + pWaveFormat^.cbSize;

pWaveFormat is Nil

thanks for answer

PostPosted: November 9th, 2007, 12:06 pm
by Kambiz
I fixed the bug and you can download the update.