0
0

There Are Two Sound Sample:
Sound_Sample_Rec: For Record MIC
Sound_Sample_Play: For Play

I Use A Timer To Copy The Sound From “Rec” To “Play” Every 1/10 Second.
But The Sound_Sample_Play Not Same As Sound_Sample_Rec. It’s not continuous.
What’s Wrong With My Code?

[code:2q18zw6b]
procedure TForm1.Timer1Timer(Sender: TObject);
Var
ptr1, ptr2: Pointer;
len1, len2: Cardinal;

S: TMemoryStream;
Begin
Try
S:= TMemoryStream.Create;
Pos:= 0;
Len:= SampleLength ;

FSOUND_Sample_Lock(Sound_Sample_Rec, Pos, Len, ptr1, ptr2, len1, len2);
S.SetSize(Len1);
S.WriteBuffer(ptr1^, Len1);
If ptr2<>nil Then
MessageDlg(’not nil’, mtWarning, [mbOK], 0);
FSOUND_Sample_UnLock(Sound_Sample_Rec, ptr1, ptr2, len1, len2);

S.Seek(0, soFromBeginning);

FSOUND_Sample_Lock(Sound_Sample_Play, Pos, Len, ptr1, ptr2, len1, len2);
If ptr2<>nil Then
MessageDlg(’not nil’, mtWarning, [mbOK], 0);
S.ReadBuffer(ptr1^, Len1);
FSOUND_Sample_Upload(Sound_Sample_Play, ptr1, SampleMode);
FSOUND_Sample_Unlock(Sound_Sample_Play, ptr1, ptr2, len1, len2);
Except
on E: Exception do
Begin
Log1.Add(E.Message);
Timer2.Enabled:=False;
End;
End;
[/code:2q18zw6b]

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.