Add microphone streaming support for Apollo-compatible hosts#537
Add microphone streaming support for Apollo-compatible hosts#537logabell wants to merge 2 commits intoClassicOldSong:moonlight-noirfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f16c1b5df5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .setSampleRate(SAMPLE_RATE) | ||
| .setChannelMask(AudioFormat.CHANNEL_IN_MONO) | ||
| .build()) | ||
| .setBufferSizeInBytes(bufferSizeBytes) | ||
| .build(); |
There was a problem hiding this comment.
Catch
AudioRecord.Builder failures before trying fallback sources
createCaptureConfig() intentionally probes UNPROCESSED, then VOICE_RECOGNITION, then MIC, but buildAudioRecord() lets AudioRecord.Builder.build() throw on unsupported parameters/device states. On Android N+ devices that advertise no usable UNPROCESSED input, opening Stream Settings or starting a stream with microphone enabled will crash here instead of falling back to the later sources, so the new microphone feature is unavailable on a substantial set of phones/tablets.
Useful? React with 👍 / 👎.
| String label = describeDevice(deviceInfo); | ||
| if (!uniqueEntries.containsKey(label)) { | ||
| uniqueEntries.put(label, new InputDeviceEntry(deviceInfo.getId(), label)); |
There was a problem hiding this comment.
Disambiguate duplicate microphone labels instead of dropping devices
This map uses the human-readable label as the uniqueness key, but describeDevice() returns generic names such as "Built-in microphone" and "USB microphone" for many inputs. On devices with multiple built-in mics or two identical USB/Bluetooth headsets, only the first device survives this loop, so users cannot select the intended input and a saved device ID can be silently lost when the list is rebuilt.
Useful? React with 👍 / 👎.
Summary
Ports microphone streaming support from my Moonlight mic forks into Artemis Android so the client can capture microphone audio locally and stream it to Apollo-compatible hosts.
This is intended to work with ClassicOldSong/Apollo#1428.
Dependency
This draft depends on the companion
moonlight-common-cPR:The current branch keeps the submodule URL pointed at my fork so the Android branch can be checked out and tested immediately. Once the common-c PR lands, I can rebase this PR back onto the upstream submodule URL and commit.
User-facing changes
RECORD_AUDIOwhen microphone capture is enabledImplementation
enableMicrophonethroughGame->StreamConfiguration->NvConnection->MoonBridge48 kHzmono PCM16 withAudioRecordmoonlight-common-cMoonBridgeforwardingSource forks
Testing
Focused verification completed on my fork:
:app:assembleNonRoot_gameDebugNvConnectionMicrophoneTestStreamConfigurationTestPreferenceConfigurationTestA test build is available via Obtainium from my fork:
On device, Obtainium can be pointed at the fork repo above to install the published
arm64-v8adebug APK for manual validation. The test build uses theArtemis-micapp label so it can be installed alongside an existing Artemis install.