My Delphi 10-4-2 FMX project captures microphone audio to a file using this code:
private
fFileIncrement: Integer;
fMic: TAudioCaptureDevice;
procedure TForm1.RecordButtonClick(Sender: TObject);
begin
fMic := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
if fMic <> nil then
begin
RecordButton.Enabled := False;
StopButton.Enabled := True;
Inc(fFileIncrement);
fMic.FileName := 'TESTWAVE-' + fFileIncrement.ToString + '.wav';
fMic.StartCapture;
end;
end;
procedure TForm1.StopButtonClick(Sender: TObject);
begin
if (fMic <> nil) and (fMic.State = TCaptureDeviceState.Capturing) then
begin
fMic.StopCapture;
StopButton.Enabled := False;
RecordButton.Enabled := True;
end;
end;
Intermittently, approximately one out of three audio files are missing the last half second of the recording.
What would cause the end of the audio to be cut?
Edit: This has been reported here https://quality.embarcadero.com/browse/RSP-33752 along with a sample project.