AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

XE5 Firemonkey

Ein Thema von sdean · begonnen am 10. Feb 2014 · letzter Beitrag vom 20. Feb 2014
Antwort Antwort
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#1

XE5 Firemonkey

  Alt 10. Feb 2014, 22:38
Hello please how can we convert this piece of code from java to FMX

Code:
public class SoundRecordingExample2 extends Activity {
        private static final int RECORDER_BPP = 16;
        private static final String AUDIO_RECORDER_FILE_EXT_WAV = ".wav";
        private static final String AUDIO_RECORDER_FOLDER = "AudioRecorder";
        private static final String AUDIO_RECORDER_TEMP_FILE = "record_temp.raw";
        private static final int RECORDER_SAMPLERATE = 44100;
        private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_STEREO;
        private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
         
        private AudioRecord recorder = null;
        private int bufferSize = 0;
        private Thread recordingThread = null;
        private boolean isRecording = false;
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
         
        setButtonHandlers();
        enableButtons(false);
         
        bufferSize = AudioRecord.getMinBufferSize(8000,
                AudioFormat.CHANNEL_CONFIGURATION_MONO,
                AudioFormat.ENCODING_PCM_16BIT);
    }

 private void startRecording(){
                recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,
                                                RECORDER_SAMPLERATE, RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING, bufferSize);
                 
                int i = recorder.getState();
                if(i==1)
                    recorder.startRecording();
                 
                isRecording = true;
                 
                recordingThread = new Thread(new Runnable() {
                         
                        @Override
                        public void run() {
                                writeAudioDataToFile();
                        }
                },"AudioRecorder Thread");
                 
                recordingThread.start();
        }
what i did is :

Delphi-Quellcode:
uses ..
,Androidapi.JNI.Media;

private
    { Private declarations }
    AudioRecord:TJAudioRecord;
    bufferSize:Integer;
    isRecording:boolean;

     procedure Init();
     procedure startRecording();
  public
    { Public declarations }

  end;

procedure TForm1.Init();
begin
bufferSize:=0;
isRecording := false;

AudioRecord:=TJAudioRecord.Create;

bufferSize:=AudioRecord.JavaClass.getMinBufferSize(8000,
                TJAudioFormat.JavaClass.CHANNEL_CONFIGURATION_MONO,
                TJAudioFormat.JavaClass.ENCODING_PCM_16BIT);

end;
procedure TForm.startRecording;
var
i:Integer;
begin

 AudioRecord:=TJAudioRecord.JavaClass.init;

 {
here how can i convert this procedure :
private void startRecording(){
  }


end;
i really need all your help
  Mit Zitat antworten Zitat
NickD

Registriert seit: 10. Okt 2012
Ort: Burgsinn
53 Beiträge
 
Delphi 10.3 Rio
 
#2

AW: XE5 Firemonkey

  Alt 20. Feb 2014, 08:53
You can find a code snippet in the example folder of Delphi.
In this example they show how to record, play, stop, save and load an audio file.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:22 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz