opensl

Android OpenSL “pAudioSrc: data format 2 not allowed” - denying SL_DATAFORMAT_PCM?

只愿长相守 提交于 2019-12-11 01:58:11
问题 I'm trying to create an AudioPlayer with a bufferqueue source and outputmix sink. I've configured the source with a pcm format very similar to that shown in the ndk samples, but OpenSL is rejecting SL_DATAFORMAT_PCM ("data format 2"). This doesn't make any sense to me. Here's the error (on a Samsung Galaxy S2): 02-27 15:43:47.315: E/libOpenSLES(12681): pAudioSrc: data format 2 not allowed 02-27 15:43:47.315: W/libOpenSLES(12681): Leaving Engine::CreateAudioPlayer (SL_RESULT_CONTENT

Play several sound effects simultaneously using OpenSL ES Android

僤鯓⒐⒋嵵緔 提交于 2019-12-06 12:16:02
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 reproduce the sounds. Mix the sound effects buffers together into a single buffer and then enqueue. My

Supported OpenSL ES Features in Android

◇◆丶佛笑我妖孽 提交于 2019-12-04 16:51:55
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_RESULT_FEATURE_UNSUPPORTED. Below you can find a short part of the code, can anyone confirm if I do anything

How to configure OpenSL to record voice call

这一生的挚爱 提交于 2019-12-03 20:07:10
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 communication preset configuration, its not recording. Below is the preset configuration code. const

Tutorials for OpenSL ES for Android

六月ゝ 毕业季﹏ 提交于 2019-11-29 19:12:58
I've been trying to look into using the OpenSL ES library that is available for doing native audio with android 2.3, but it appears that the header files and the 600 page pdf of the spec are the only available documentation. Where should I be looking for examples, tutorials, or a brief overview of the capabilities? Phonon There's an example app that comes with the NDK called NativeAudio . It has examples of nearly anything you would ever want to implement: effects, streaming, synthesis, etc. If you look at its code, you'll get a good head start. You could also check victor lazzarini's audio

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

佐手、 提交于 2019-11-29 08:13:06
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? 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 the native-audio example provided with android NDK. You've to take interface of android configuration first

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

雨燕双飞 提交于 2019-11-28 20:10:51
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 problems. I need to manipulate the byte buffer directly for custom DSP effects. The clips I'm going to be

Tutorials for OpenSL ES for Android

孤街醉人 提交于 2019-11-28 14:41:44
问题 I've been trying to look into using the OpenSL ES library that is available for doing native audio with android 2.3, but it appears that the header files and the 600 page pdf of the spec are the only available documentation. Where should I be looking for examples, tutorials, or a brief overview of the capabilities? 回答1: There's an example app that comes with the NDK called NativeAudio. It has examples of nearly anything you would ever want to implement: effects, streaming, synthesis, etc. If