How to create java object instance using JNI (Delphi)

I'm still pretty new to programming in Delphi and I don't know anything about Java. However, I need to write a program using RAD Studio that can read the amplitude of the audio input. I could not find a way to do this in Delphi (which I could afford), but I found a way to use the Android API. The solution is similar to a MediaRecorder object, so I tried using it with this code.

var
  Form1: TForm1;
  RecorderObj: Jobject;
  Recorder: JMediaRecorder;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Recorder:= MediaRecorder;  // <------- The problem is here.
  Recorder.setAudioSource(1);  // should set the recording device to the mic
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Label1.Text:= IntToStr(Recorder.getMaxAmplitude);
end;

, , . : = MediaRecorder() ( ), Recorder: = MediaRecorder.Create ( , Delphi ) - , Delphi/RAD Studio, , .

+4
1

Java Delphi, , JMediaRecorder, :

Recorder := TJMediaRecorder.JavaClass.init;
+2

Source: https://habr.com/ru/post/1683370/


All Articles