diff options
Diffstat (limited to 'platform/android/audio_driver_opensl.cpp')
-rw-r--r-- | platform/android/audio_driver_opensl.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index 0d62b242a8..1232fc7453 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -53,7 +53,7 @@ void AudioDriverOpenSL::_buffer_callback( } else { int32_t *src_buff = mixdown_buffer; - for (int i = 0; i < buffer_size * 2; i++) { + for (unsigned int i = 0; i < buffer_size * 2; i++) { src_buff[i] = 0; } } @@ -66,7 +66,7 @@ void AudioDriverOpenSL::_buffer_callback( int16_t *ptr = (int16_t *)buffers[last_free]; last_free = (last_free + 1) % BUFFER_COUNT; - for (int i = 0; i < buffer_size * 2; i++) { + for (unsigned int i = 0; i < buffer_size * 2; i++) { ptr[i] = src_buff[i] >> 16; } @@ -230,7 +230,7 @@ void AudioDriverOpenSL::_record_buffer_callbacks(SLAndroidSimpleBufferQueueItf q ad->_record_buffer_callback(queueItf); } -Error AudioDriverOpenSL::capture_start() { +Error AudioDriverOpenSL::capture_init_device() { SLDataLocator_IODevice loc_dev = { SL_DATALOCATOR_IODEVICE, @@ -298,6 +298,15 @@ Error AudioDriverOpenSL::capture_start() { return OK; } +Error AudioDriverOpenSL::capture_start() { + + if (OS::get_singleton()->request_permission("RECORD_AUDIO")) { + return capture_init_device(); + } + + return OK; +} + Error AudioDriverOpenSL::capture_stop() { SLuint32 state; @@ -317,7 +326,7 @@ Error AudioDriverOpenSL::capture_stop() { int AudioDriverOpenSL::get_mix_rate() const { - return 44100; + return 44100; // hardcoded for Android, as selected by SL_SAMPLINGRATE_44_1 } AudioDriver::SpeakerMode AudioDriverOpenSL::get_speaker_mode() const { |