How do use Stream in AudioRedirector

Please discuss general Delphi programming topics here.

How do use Stream in AudioRedirector

Postby john123 » November 7th, 2007, 2:44 pm

Hi,
Please show a sample for use Stream in AudioRedirector.
thanks
john123
Active Member
Active Member
 
Posts: 15
Joined: November 7th, 2007, 10:43 am

Postby Kambiz » November 7th, 2007, 5:39 pm

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;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Access violation in your(simple sample) code

Postby john123 » November 8th, 2007, 6:03 am

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
john123
Active Member
Active Member
 
Posts: 15
Joined: November 7th, 2007, 10:43 am

Postby Kambiz » November 9th, 2007, 12:06 pm

I fixed the bug and you can download the update.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 11 guests

cron