I need the ability to record / get the level from the integrated iPhone microphone while performing playback of audio via the earbuds.

Previous attempts via the iPhone SDK and via FMOD always failed because it looked like it was locked to use one audio package or another.

Audio package 1: Headphone + Microphone 3 part port on top.
Audio package 2: Speakers + Microphone on bottom.

Can FMOD for iPhone handle this scenario?

Thanks in advance!
— Dan

P.S. We use FMOD for Windows for a product I work on, and it is the greatest thing since sliced bread. If the iPhone product is even half as good I will be floored.

  • You must to post comments

Unfortunately FMOD cannot handle that situation. The iPhone SDK doesn’t provide a way to override the audio route change that happens to the microphone when you plug in headphones.

The only override control we have is forcing output to the main speaker when recording (instead of coming out the receiver speaker).

Is there a technical reason why you can’t just use the headphone microphone when listening with headphones?

  • You must to post comments

The application I want to develop really requires the headphone playback and use of the integrated microphone at the same time.

We are trying to use as much stock hardware as we can and most iPhone users don’t use earbuds that have an integrated microphone in them.

I hedged my bet and also contacted Apple regarding this issue. I received the response (pasted below) from Apple personnel.

I can provide the contact info to the Apple personnel via private message.

Thanks for such a quick response. FMOD has been great for other uses and I want to continue using it for iPhone development,

Response from Apple support:

The AudioSession API controls all the routing on the device and both input and output device are chosen depending on the last device plugged in.

So, you can record via the mic and playback on the headphones if the headphones don’t have a microphone, if they are simply the earbuds that come with say a normal iPod for example. If however, the earbuds have a mic, then the default input/output would be the earbuds plus the mic which is part of the earbuds, not the integrated mic.

The only override to this available is kAudioSessionOverrideAudioRoute_Speaker which may be used with the PlayAndRecord category to redirect output audio from the receiver(or earbuds) to the speaker situated at the bottom of the phone.

If there’s other routing control your application would require, please file an enhancement request via bugreporter@apple.com.

There is currently no way to specifically select devices for input and output routing outside of what the AudioSession does automatically.[/color:2zadnwyg]

  • You must to post comments

Yes the response from Apple is what I mentioned in my response, although maybe I wasn’t clear that if you use earbuds that don’t have a mic attached the mic support will default back to the built-in mic.

However there is no way to force route the mic from the headphones to the built-in mic in the situation where the headphones have a built in mic. (which I believe is what you are asking?)

  • You must to post comments

I am using the [b:c1pkt3xq]recording[/b:c1pkt3xq] sample from the latest FMOD for iPhone release on iPhone OS 2.2.1 on both an iPhone 3G and a first gen iPhone.

The [b:c1pkt3xq]recording[/b:c1pkt3xq] sample will crash if I plug in earbuds into the iPhone first gen and attempt to use the 5 second recording function.

See the crash log below for this scenario.

The [b:c1pkt3xq]recording[/b:c1pkt3xq] sample app also seems unstable on iPhone first gen, crashing at different times mostly during record scenarios.

Have other people reported a similar problem with first gen iPhones?

I do have iPhone OS 2.2.1 on the gen 1 iPhone.

I figured I would just reply to the existing iPhone record and playback thread I started a couple of weeks ago rather than start a new one so some of the context of the existing discussion was preserved.

These problems do not occur on the iPhone 3G.

If you want any other diagnostic or repro info please let me know.

Is FMOD for iPhone supported on iPhone first gen?

Thanks in advance for any help or answers,

Crash log:

[code:c1pkt3xq]Incident Identifier: 414B507E-0540-43E9-B5F2-78F93CE7CB60
CrashReporter Key: 226c12145120bcd0d4ad2a4781ed7d1301efcf88
Process: recording [108]
Path: /var/mobile/Applications/D3576206-F8E9-4069-8065-C78BF58251F6/recording.app/recording
Identifier: recording
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]

Date/Time: 2000-01-08 23:11:18.815 -0600
OS Version: iPhone OS 2.2.1 (5H11)
Report Version: 103

Exception Codes: KERN_INVALID_ADDRESS at 0xfc008110
Crashed Thread: 0

Thread 0 Crashed:
0 libSystem.B.dylib 0x31457f64 small_malloc_from_free_list + 196
1 libSystem.B.dylib 0x3145bc70 szone_malloc + 416
2 libSystem.B.dylib 0x314641c2 malloc_zone_malloc + 50
3 libSystem.B.dylib 0x314647a0 malloc + 28
4 libstdc++.6.dylib 0x3007361c operator new(unsigned long) + 92
5 AudioToolbox 0x349776f4 AUBase::AUBase(OpaqueAudioComponentInstance*, unsigned long, unsigned long, unsigned long, unsigned long) + 1008
6 AudioToolbox 0x349712ac AUConverterBase::AUConverterBase(OpaqueAudioComponentInstance*, unsigned long, unsigned long, unsigned long, unsigned long) + 128
7 AudioToolbox 0x349749bc AUGenericOutput::AUGenericOutput(OpaqueAudioComponentInstance*, unsigned long, unsigned long) + 24
8 AudioToolbox 0x34969b5c AURemoteIO::AURemoteIO(OpaqueAudioComponentInstance) + 100
9 AudioToolbox 0x34966938 AudioUnitFactory<AURemoteIO>::Instantiate(OpaqueAudioComponent
, OpaqueAudioComponentInstance**) + 212
10 recording 0x00072960 FMOD::OutputCoreAudio::recordStart(FMOD::FMOD_RECORDING_INFO*, FMOD::Sound*, bool) + 516
11 recording 0x0008b230 FMOD::SystemI::recordStart(int, FMOD::SoundI*, bool) + 348
12 recording 0x00082fc0 FMOD::System::recordStart(int, FMOD::Sound*, bool) + 52
13 recording 0x00002c2e -[ViewController record:] (ViewController.mm:141)
14 CoreFoundation 0x3027ee9c -[NSObject performSelector:withObject:withObject:] + 20
15 UIKit 0x30a4fd6c -[UIApplication sendAction:to:from:forEvent:] + 128
16 UIKit 0x30a4fcd4 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
17 UIKit 0x30ab2c24 -[UIControl sendAction:to:forEvent:] + 44
18 UIKit 0x30ab327c -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 576
19 UIKit 0x30ab216c -[UIControl touchesEnded:withEvent:] + 536
20 UIKit 0x30a66834 -[UIWindow sendEvent:] + 392
21 UIKit 0x30a57acc -[UIApplication sendEvent:] + 248
22 UIKit 0x30a56e04 _UIApplicationHandleEvent + 4656
23 GraphicsServices 0x315698c4 PurpleEventCallback + 428
24 GraphicsServices 0x3156c114 HeartbeatVBLCallback + 152
25 IOMobileFramebuffer 0x31e8d8f8 IOMobileFramebufferNotifyFunc + 124
26 com.apple.framework.IOKit 0x30f57248 IODispatchCalloutFromCFMessage + 304
27 CoreFoundation 0x3026ac70 __CFMachPortPerform + 72
28 CoreFoundation 0x30269c72 CFRunLoopRunSpecific + 2364
29 CoreFoundation 0x30269320 CFRunLoopRunInMode + 44
30 GraphicsServices 0x31567e58 GSEventRunModal + 268
31 UIKit 0x30a4fa6c -[UIApplication _run] + 520
32 UIKit 0x30a591d0 UIApplicationMain + 1132
33 recording 0x0000334c main (main.m:9)
34 recording 0x0000202c start + 44

Thread 1:
0 libSystem.B.dylib 0x3146baa4 mach_msg_trap + 20
1 libSystem.B.dylib 0x31468b70 mach_msg + 60
2 CoreFoundation 0x30269748 CFRunLoopRunSpecific + 1042
3 CoreFoundation 0x30269320 CFRunLoopRunInMode + 44
4 WebCore 0x32bc0740 RunWebThread + 340
5 libSystem.B.dylib 0x31461786 _pthread_body + 34

Thread 2:
0 libSystem.B.dylib 0x3146baa4 mach_msg_trap + 20
1 libSystem.B.dylib 0x31468b70 mach_msg + 60
2 GraphicsServices 0x3156aca8 EventReceiveThread + 504
3 libSystem.B.dylib 0x31461786 _pthread_body + 34

Thread 3:
0 libSystem.B.dylib 0x3146baa4 mach_msg_trap + 20
1 libSystem.B.dylib 0x31468b70 mach_msg + 60
2 AudioToolbox 0x3496abec AURemoteIO::IOThread::Entry(void) + 112
3 AudioToolbox 0x348de2e4 CAPThread::Entry(CAPThread
) + 208
4 libSystem.B.dylib 0x31461786 _pthread_body + 34

Thread 4:
0 libSystem.B.dylib 0x314550cc __semwait_signal_nocancel + 24
1 libSystem.B.dylib 0x31454a2a nanosleep$NOCANCEL + 106
2 libSystem.B.dylib 0x313fc860 usleep + 36
3 recording 0x0006fe9c FMOD_OS_Time_Sleep(unsigned int) + 20
4 recording 0x00090f44 FMOD::Thread::callback(void*) + 188
5 libSystem.B.dylib 0x31461786 _pthread_body + 34

Thread 0 crashed with ARM Thread State:
r0: 0x001b8100 r1: 0xfc008110 r2: 0x00000000 r3: 0xc0000003
r4: 0x006c0070 r5: 0x00000000 r6: 0x001b8000 r7: 0x2fffea8c
r8: 0x00003600 r9: 0x394346d0 r10: 0x00000002 r11: 0x00000001
ip: 0x39401d40 sp: 0x2fffea74 lr: 0x3145bc78 pc: 0x31457f64
cpsr: 0xa0070010

Binary Images:
0x1000 – 0xbefff +recording ??? (???) <8f359e31268698f96e7362953c1125cc> /var/mobile/Applications/D3576206-F8E9-4069-8065-C78BF58251F6/recording.app/recording
0x1ca000 – 0x1cbfff dns.so ??? (???) <7e54f40c0e9e0860314e49c290b340a3> /usr/lib/info/dns.so
0x2fe00000 – 0x2fe22fff dyld ??? (???) <f6a50d5f57a676b54276d0ecef46d5f0> /usr/lib/dyld
0x30000000 – 0x30008fff libgcc_s.1.dylib ??? (???) <2c68d752c35e553ce4944253c3e7aa02> /usr/lib/libgcc_s.1.dylib
0x3000c000 – 0x30079fff libstdc++.6.dylib ??? (???) <810ba7a889418c2fa42c2d82676249be> /usr/lib/libstdc++.6.dylib
0x300bb000 – 0x301a8fff libobjc.A.dylib ??? (???) <9b4b6a1caf13c2adfb8d235e76ec0618> /usr/lib/libobjc.A.dylib
0x301f9000 – 0x30200fff libbsm.dylib ??? (???) <f07f6291583d6e883f529b925f767cf6> /usr/lib/libbsm.dylib
0x30204000 – 0x30212fff libz.1.dylib ??? (???) <b590559dfa798361013a0f6e31018df7> /usr/lib/libz.1.dylib
0x30237000 – 0x302ddfff CoreFoundation ??? (???) <e461335556641a9049d6e12c53ffc13a> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x303a1000 – 0x30430fff libsqlite3.0.dylib ??? (???) <693269a3109bff32213a75a815e6cfe4> /usr/lib/libsqlite3.0.dylib
0x3066c000 – 0x3073ffff Foundation ??? (???) <2f0bb76cfade98f2e82f6ca281bca713> /System/Library/Frameworks/Foundation.framework/Foundation
0x3085c000 – 0x30866fff CoreVideo ??? (???) <b6f9991ce47441fc89d4badec7f3c4e6> /System/Library/PrivateFrameworks/CoreVideo.framework/CoreVideo
0x30875000 – 0x30884fff AppSupport ??? (???) <db82c3fc166570ea397ee1a3db682d55> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x30891000 – 0x30896fff liblockdown.dylib ??? (???) <31770f505dbc8e7f93165b075313dd93> /usr/lib/liblockdown.dylib
0x30a45000 – 0x30cc7fff UIKit ??? (???) <9d01f1e817aeeb32a7baa24dce8dcddf> /System/Library/Frameworks/UIKit.framework/UIKit
0x30f53000 – 0x30fd5fff com.apple.framework.IOKit 1.5.1 (???) <20aeee7efe340c9d7b2acc82221bb923> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x30ff3000 – 0x311a4fff com.apple.CoreGraphics 1.359.13 (???) <62747319453a181e5b507100afe3dac2> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x311f3000 – 0x31242fff CFNetwork ??? (???) <c99a3a401edecf543a6814982376fdea> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x31270000 – 0x312a6fff OpenGLES ??? (???) <d93585c3ba5bc619845e0cbb931b2b82> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x312b2000 – 0x3137afff JavaScriptCore ??? (???) <03567ce85a6b3f826de52833e35da633> /System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore
0x313fa000 – 0x31521fff libSystem.B.dylib ??? (???) <0fc9fef437491a94d875daf247f36fbc> /usr/lib/libSystem.B.dylib
0x31564000 – 0x3156ffff GraphicsServices ??? (???) <02da76f5933f98481eee4e3f1b4b1c10> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x3158b000 – 0x315c0fff Security ??? (???) <7c0b94dedc0363335b62de411a4c53c0> /System/Library/Frameworks/Security.framework/Security
0x315d9000 – 0x31686fff ImageIO ??? (???) <b85f0939025af03f5b006fe3cdbae76b> /System/Library/PrivateFrameworks/ImageIO.framework/ImageIO
0x31822000 – 0x3184ffff SystemConfiguration ??? (???) <b673ff214ecb18f48ab3809c68b9f82c> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x31946000 – 0x319b6fff CoreAudio ??? (???) <66c5fd8f095c2e6c399240959674756e> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x31ad4000 – 0x31aeefff AddressBook ??? (???) <87f470763ba528f47d58f7e9486dfc42> /System/Library/Frameworks/AddressBook.framework/AddressBook
0x31bcd000 – 0x31bd2fff MBX2D ??? (???) <0f0d56c6fde0670732a89cc3166bbced> /System/Library/PrivateFrameworks/MBX2D.framework/MBX2D
0x31bd6000 – 0x31bd7fff MBXConnect ??? (???) <5cb05b6860d3e5d31e2907344c60ddbc> /System/Library/PrivateFrameworks/MBXConnect.framework/MBXConnect
0x31dcd000 – 0x31e4cfff QuartzCore ??? (???) <cb1aa94a3175bc326223fa7551b4d47c> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x31e85000 – 0x31e87fff CoreSurface ??? (???) <6aabe16c45a9ac9ec358efcb8e74ee2b> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface
0x31e8c000 – 0x31e8dfff IOMobileFramebuffer ??? (???) <2622d9270459e18635ac3b9abe184249> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
0x3213e000 – 0x32223fff libicucore.A.dylib ??? (???) <ae540de6fb39ea79d564dded1607e1ae> /usr/lib/libicucore.A.dylib
0x32409000 – 0x324dafff libxml2.2.dylib ??? (???) <8784b9ffec64404a6a26fefe67ba45bd> /usr/lib/libxml2.2.dylib
0x325ec000 – 0x32c89fff WebCore ??? (???) <5ddaa2736116d1f8fae09e113b64037b> /System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x32fcb000 – 0x33051fff WebKit ??? (???) <5cba5d32b2f5de0b72384b14f13df575> /System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x33404000 – 0x33442fff libCGFreetype.A.dylib ??? (???) <adbae889ac28b4d42297bcf951c9ae2e> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
0x33cc8000 – 0x33ceafff libRIP.A.dylib ??? (???) <ee70d178b545087d3b93cebac2f44270> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
0x33d10000 – 0x33d16fff SpringBoardServices ??? (???) <dffc7baf9374e6ccc3dc75bfa4294ae1> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x344ec000 – 0x34509fff libresolv.9.dylib ??? (???) <d2cf3f40b8297909dcfd2ee83326af8c> /usr/lib/libresolv.9.dylib
0x34884000 – 0x3499dfff AudioToolbox ??? (???) <176bbb6b69d15cf4262fe5de5874eba3> /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox


  • You must to post comments

Unfortunately yes this bug is known, but it is out of our control. We have an outstanding bug ticket with Apple that they have ignored for the last two months. I have just pinged them again so hopefully they will get back to us and give us a work around.

Until that time I cannot guarantee the stability of recording on iPhone 1st Gen or the simulator, iPhone 3G and iPod Touch 2nd Gen work without error.

  • You must to post comments

Just a followup to the recording issue with iPhone 1st Gen. Apple has gotten back to us regarding the crash and given us a workaround for the bug. Keep an eye out for our next release which will have the fix.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.