5

I'm trying to create a wav file using the XE5 Firemonkey for Android

from this link : http://i-liger.com/article/android-wav-audio-recording

I read that we must forget about using the MediaRecorder class .

First of all we have to forget about MediaRecorder class. Instead we have to use AudioRecord, this class providing more flexibility.

How can I use the AudioRecord in XE5 ?

Johan
  • 74,508
  • 24
  • 191
  • 319
randydom
  • 395
  • 2
  • 20

1 Answers1

1

If you included samples in your XE5 install than you have a working demo in samples folder (usually in the Public docuemnts). Look in the Samples\MobileCodeSnippets\Delphi\AudioRecPlay folder.

Here's what they use to record FMicrophone: TAudioCaptureDevice;

Some of the code in the sample:

FMicrophone := TCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
if HasMicrophone then
begin
  { and attempt to record to 'test.caf' file }
  FMicrophone.FileName := GetAudioFileName('test.caf');
  try
    FMicrophone.StartCapture;
  except
    ShowMessage('StartCapture: Operation not supported by this device');
  end;
end
else
  ShowMessage('No microphone is available.');
Sentient
  • 1,102
  • 12
  • 29