yonix
yonix

Reputation: 12257

iOS Microphone sampling doesn't work on device when mixing CoreAudio and OpenAL code

I tried writing an app that samples the microphone using code from http://code.google.com/p/ios-coreaudio-example/ (Core Audio), and plays sounds using code from https://github.com/hollance/SoundBankPlayer (OpenAL).

This works fine when running on simulator, but when testing on a real device - microphone sampling doesn't work (the recordingCallback in the IosAudioController never gets called).

When I disable the SoundBankPlayer code (do not instantiate a new SoundBankPlayer, therefore no OpenAL code is used), the microphone sampling works just fine.

Is there a known limitation of mixing OpenAL and Core Audio code in the same project? If so - is there a workaround? If not - what else could the problem be?

Upvotes: 0

Views: 772

Answers (1)

yonix
yonix

Reputation: 12257

OK, turns out I had to change the audio session category from kAudioSessionCategory_MediaPlayback to kAudioSessionCategory_PlayAndRecord when initializing the audio session in the OpenAL code.

Upvotes: 1

Related Questions