opensl

Cannot play pcm > 60kb with the AndroidSimpleBufferQueue

拥有回忆 提交于 2020-01-06 05:51:29
问题 I've initialized an AndroidSimpleBufferQueue such as values: SLDataLocator_AndroidSimpleBufferQueue bufferLocator = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2}; SLDataFormat_PCM pcmFormat = { SL_DATAFORMAT_PCM, 1, SL_SAMPLINGRATE_44_1, SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16, SL_SPEAKER_FRONT_CENTER, SL_BYTEORDER_LITTLEENDIAN}; SLDataSource audioSource = {&bufferLocator, &pcmFormat}; SLDataLocator_OutputMix locatorOutputMix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObj

Playing PCM WAVE sound from memory with OpenSL on Android

筅森魡賤 提交于 2020-01-04 02:45:46
问题 I'm trying to set up OpenSL AudioPlayer to use memory I've allocated to playback a wav file. I want to do this so I can have multiple AudioPlayers that share the same data and conserve memory. I've tried to give openSL the entire file and tell it that it is a WAVE with format_mime SLDataLocator_Address loc_fd = {SL_DATALOCATOR_ADDRESS, data, size}; SLDataFormat_MIME format_mime = { SL_DATAFORMAT_MIME, (SLchar*)"audio/x-wav",SL_CONTAINERTYPE_WAV}; SLDataSource audioSrc = { &loc_fd, &format

undefined reference to slCreateEngine

早过忘川 提交于 2019-12-25 08:06:20
问题 I want to play sound through opensl. Connected library Linker-> Input-> Library Dependencies - OpenSLES. The linker produces an error - undefined reference to slCreateEngine. 回答1: check your target_link_libraries method inside CmakeLists.txt if it has all the necessary libraries included.. target_link_libraries( # Specifies the target library. native-lib android log OpenSLES) 来源: https://stackoverflow.com/questions/40849737/undefined-reference-to-slcreateengine

Buffering URI on OpenSL, Android

妖精的绣舞 提交于 2019-12-25 04:19:17
问题 I have been trying the OpenSL for a few weeks now. I'm trying to access to the buffer while playing a file on sdcard via SL_DATALOCATOR_URI as a source. I want to write a few effects of my own and need the buffer. Currently in the code, I'm creating two audio players. One is reading the file to buffer, other is writing the buffer to the output. When I'm testing the code with the microphone (recorder), everything is fine. Sound in-out works as expected. When I switch the recorder with a uri

Play several sound effects simultaneously using OpenSL ES Android

好久不见. 提交于 2019-12-22 14:04:10
问题 I'm using OpenSL ES for playing music and sounds in my project. I've used native-audio sample as start and it's fine for reproduce background music and a single sound but when I try to reproduce two or more sounds at same time the sounds aren't reproduced simultaneously because the sound buffers are enqueued for playback when all previous buffers are played. Then, after a little research, I've found two ways to fix it , in short: Use several audio players (and therefore buffer queues) for

How to configure OpenSL to record voice call

谁说我不能喝 提交于 2019-12-21 05:14:15
问题 I'm working on a call recorder app using MediaRecorder VOICE_CALL audio source, In some marshmallow devices it's crashing, then I changed source to MIC here incoming voice is not getting recorded. Due to this java limitation now I'm working on native android code to record voice call. I'm managed to record the audio using native-audio recorder for call recorder. Problem is in native code also it's recording one side voice only,incoming voice is not getting recorded. Then I tried the voice

Voice communication at 8KHz sampling rate for all android device using OpenSL

↘锁芯ラ 提交于 2019-12-19 08:26:21
问题 I need to create a VOIP app and I'm using OpenSL ES. I need to capture and play pcm audio data at 8KHz sampling rate for all android devices. But, when i capture audio at sampling rate 8KHz and play it at the same time (voice communication), it produces noise and the audio is distorted for some devices like Samsung Galaxy S3, S4 etc. I know, there's a specific preferred sampling rate for each device and I want to know is there any workaround or any way to work with 8KHz sampling rate only

How to configure OpenSL to work with ear speaker other than main speaker or headphones

放肆的年华 提交于 2019-12-18 05:13:12
问题 I've tried the native-audio code sample in android NDK. When i try to record some speech and then play it back it works fine. It uses the main speaker(loud speaker) for the speech playback. I want to modify the code so that the speech is played in the ear speaker instead of the main speaker. Any help? 回答1: I solved the problem and I've found a google group of related topic. It was really helpful. Here's the link: https://groups.google.com/forum/#!topic/android-ndk/O-hufEm20cU I tested it in

Is it possible to get a byte buffer directly from an audio asset in OpenSL ES (for Android)?

偶尔善良 提交于 2019-12-17 22:44:43
问题 I would like to get a byte buffer from an audio asset using the OpenSL ES FileDescriptor object, so I can enqueue it repeatedly to a SimpleBufferQueue, instead of using SL interfaces to play/stop/seek the file. There are three main reasons why I would like to manage the sample bytes directly: OpenSL uses an AudioTrack layer to play/stop/etc for Player Objects. This does not only introduce unwanted overhead, but it also has several bugs, and rapid starts/stops of the player cause lots of

Supported OpenSL ES Features in Android

孤街醉人 提交于 2019-12-13 12:15:42
问题 Android is supposed to support 3D audio via the OpenSL es API which is accesible via the NDK. That more or less works, I managed it to play sound via a created player and an output mix. But when I try to realise a listener with a 3D location interface (SL_IID_3DLOCATION constant) which is mandatory for playing 3D sound. But when I try to set the constant to SL_BOOLEAN_TRUE the result of the CreateListener method is 12 as passed to the LogCat. 12 is the value of the OpenSL es constant SL