From df92b2fc8bbc925cb36d3cabb14e708395bad553 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Fri, 27 May 2016 19:52:08 +0300 Subject: [PATCH] SDL: do not use VOICE_CALL audio source, it's only available during voice calls --- project/java/Audio.java | 24 +++++++------------ .../test-record-audio/AndroidAppSettings.cfg | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/project/java/Audio.java b/project/java/Audio.java index 14c2320a3..da42c77f9 100644 --- a/project/java/Audio.java +++ b/project/java/Audio.java @@ -207,27 +207,21 @@ class AudioThread mRecorder.release(); mRecorder = null; try { - mRecorder = new AudioRecord(AudioSource.VOICE_CALL, rate, channelConfig, encodingConfig, minBufferSize); + mRecorder = new AudioRecord(AudioSource.MIC, rate, channelConfig, encodingConfig, minBufferSize); mRecorderBufferSize = minBufferSize; } catch (IllegalArgumentException e) { - Log.i("SDL", "SDL: error: failed to open VOICE_CALL recording device!"); + Log.i("SDL", "SDL: error: failed to open MIC recording device!"); try { - mRecorder = new AudioRecord(AudioSource.VOICE_UPLINK, rate, channelConfig, encodingConfig, minBufferSize); + mRecorder = new AudioRecord(AudioSource.VOICE_RECOGNITION, rate, channelConfig, encodingConfig, minBufferSize); mRecorderBufferSize = minBufferSize; - } catch (IllegalArgumentException ee) { - Log.i("SDL", "SDL: error: failed to open VOICE_UPLINK recording device!"); + } catch (IllegalArgumentException eee) { + Log.i("SDL", "SDL: error: failed to open VOICE_RECOGNITION recording device!"); try { - mRecorder = new AudioRecord(AudioSource.VOICE_RECOGNITION, rate, channelConfig, encodingConfig, minBufferSize); + mRecorder = new AudioRecord(AudioSource.DEFAULT, rate, channelConfig, encodingConfig, minBufferSize); mRecorderBufferSize = minBufferSize; - } catch (IllegalArgumentException eee) { - Log.i("SDL", "SDL: error: failed to open VOICE_RECOGNITION recording device!"); - try { - mRecorder = new AudioRecord(AudioSource.DEFAULT, rate, channelConfig, encodingConfig, minBufferSize); - mRecorderBufferSize = minBufferSize; - } catch (IllegalArgumentException eeee) { - Log.i("SDL", "SDL: error: failed to open DEFAULT recording device!"); - return null; - } + } catch (IllegalArgumentException eeee) { + Log.i("SDL", "SDL: error: failed to open DEFAULT recording device!"); + return null; } } } diff --git a/project/jni/application/test-record-audio/AndroidAppSettings.cfg b/project/jni/application/test-record-audio/AndroidAppSettings.cfg index 568bd6c16..9fa81e1b5 100644 --- a/project/jni/application/test-record-audio/AndroidAppSettings.cfg +++ b/project/jni/application/test-record-audio/AndroidAppSettings.cfg @@ -1,7 +1,7 @@ # The application settings for Android libSDL port # Specify application name (e.x. My Application) -AppName="Ballfield" +AppName="AudioRecordTest" # Specify reversed site name of application (e.x. com.mysite.myapp) AppFullName=net.olofson.ballfield