Page 1 of 1

record/play to/from TStream with StockAudioRecorder/Player

PostPosted: June 16th, 2006, 2:38 pm
by Farderlorn
Hello,

i try to record audio to TMemoryStream with StockAudioRecorder,
and play the stream after 1 second with StockAudioPlayer.
(The stream is still recording).

Has anyone a sample for me?

MikrofonStream := TMemoryStream .Create;
StockAudioRecorder1.RecordToStream(MikrofonStream);
MikrofonStream.Position := 0;

//Pause
...

//This causes an error
StockAudioPlayer1.PlayStream(MikrofonStream);

Error:
EWaveAudioSysError
'Ungültiger Parameter wurde an eine Systemfunktion übergeben.'.

Thanks, Farderlorn

PostPosted: June 19th, 2006, 8:33 pm
by Kambiz
TStream has only one stream position pointer, and you need two for your purpose. One for reading and the other for writing.

You can implement an adaptor class for TStream to keep read and write positions.