Is there any reason why this wouldn't w开发者_开发百科ork?
I'm testing for sound in the microphone and playing a looping sound effect as I'm registering sound.
On the iPod touch this seems to work fine - on the iPhone though the sound effect either doesn't play at all, or is very quiet.
Any ideas? Or any alternative?
Thanks
for some reason had to put this code before I played the sound:
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);
to stop it playing through the earpiece.
精彩评论