Fix iOS build and microphone capture for Defold Extender - #2
Open
jcypher wants to merge 5 commits into
Open
Conversation
Compile mic.cpp as ObjC++ with AVFoundation frameworks, rename plist stubs so Defold merges them, and set PlayAndRecord so recording can coexist with engine audio. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop Extender-rejected -x objective-c++ flags; share implementation in mic_body.inl with mic.mm on Apple and mic.cpp elsewhere. Co-authored-by: Cursor <cursoragent@cursor.com>
OpenAL init clears capture devices post AppInitialize; re-apply AVAudioSession and re-init miniaudio context before is_connected/start. Co-authored-by: Cursor <cursoragent@cursor.com>
Deactivate AVAudioSession before switching to PlayAndRecord so OpenAL cannot block the category change; prepare on get_devices too. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep PlayAndRecord session restore; drop temporary build markers and verbose is_connected probes. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1
Summary
Makes defold-mic build and record on iOS under Defold Extender, without changing the non-Apple capture path.
On iOS, miniaudio pulls in AVFoundation (Objective-C). Compiling
mic.cppas pure C++ fails on Foundation headers (@class NSString, etc.). Extender’s allowedext.manifestflags also don’t include-x objective-c++, so this PR compiles Apple targets viamic.mmand keepsmic.cppfor Windows / Linux / HTML5 / Android.Changes
mic/src/mic_body.inl;mic.mmincludes it on iOS/macOS;mic.cppincludes it everywhere else. Extender only compiles.mmon Apple platforms.ext.manifest: linkAVFoundation,AudioToolbox,Foundation+-ObjCforios/arm64-ios/x86_64-ios.mic/manifests/{ios,osx}/mic-Info.plist→Info.plistso Defold’s merge tool actually picks upNSMicrophoneUsageDescription.PlayAndRecord(+default_to_speaker,mix_with_others). Before capture / device enumeration, re-apply that session (and re-init the miniaudio context if capture devices are empty) because Defold’s OpenAL sound init can clear capture after launch.Testing
mic.request_permission→mic.start/ meter →mic.stop→ playback.AndroidManifest.xmlunchanged; non-iOSAppInitializestill uses a NULLma_context_config(same as before); iOS-only session helpers are behindDM_PLATFORM_IOS.Notes for reviewers
mic.request_permission()on Apple before recording (unchanged API).