Reputation: 29925
Is there any reason why this wouldn't work?
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
Upvotes: 1
Views: 1190
Reputation: 29925
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.
Upvotes: 2