tags:

views:

119

answers:

2

Hello all !

I need play a short audio while recording. Run on Simualtor is very well but can't play audio when on device while recording . I see SpeakHere example and change "kAudioSessionCategory_RecordAudio" to "kAudioSessionCategory_PlayAndRecord".

Anybody help me ? Thanks a lot.

A: 

Actually I found the solution .. Try this:

UInt32 category = kAudioSessionCategory_PlayAndRecord; 
status |= AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), &category);
UInt32 allowMixing = true;
status |= AudioSessionSetProperty (
           kAudioSessionProperty_OverrideCategoryMixWithOthers,  // 1
           sizeof (allowMixing),                                 // 2
           &allowMixing                                          // 3
           );
status |= AudioSessionSetProperty (
           kAudioSessionProperty_OtherMixableAudioShouldDuck,  // 1
           sizeof (allowMixing),                                 // 2
           &allowMixing                                          // 3
           );

The final two AudioSessionSetProperty calls are new in the 3.0 OS.

sehugg