Skip to content

Platform audio for Unity#293

Open
MaxHeimbrock wants to merge 4 commits into
mainfrom
max/final-platform-audio
Open

Platform audio for Unity#293
MaxHeimbrock wants to merge 4 commits into
mainfrom
max/final-platform-audio

Conversation

@MaxHeimbrock

@MaxHeimbrock MaxHeimbrock commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Background

Integrates the Rust Platform Audio Module. The old Unity audio input and output is still supported, the platform audio is now a second path to get audio input and output.

Changes

  • Adds platform audio APIs
  • Adds choice in Meet sample to either use platform audio or Unity audio

@MaxHeimbrock MaxHeimbrock force-pushed the max/final-platform-audio branch from 149fad2 to e88ff05 Compare June 8, 2026 13:49
@MaxHeimbrock MaxHeimbrock changed the title All platform audio changes before vacation Platform audio for Unity Jun 9, 2026
@MaxHeimbrock MaxHeimbrock marked this pull request as ready for review June 9, 2026 15:28
@MaxHeimbrock MaxHeimbrock requested a review from ladvoc June 9, 2026 15:28
@MaxHeimbrock MaxHeimbrock force-pushed the max/final-platform-audio branch from 9bd2f8c to 0f2ee14 Compare June 9, 2026 15:39

/// <summary>
/// Sets the recording device (microphone) by index.
///

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add disclaimer here as well about mobile platform no-ops

/// platformAudio.Dispose();
/// </code>
/// </example>
public sealed class PlatformAudio : IDisposable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a Rust side function call for PlatformAudio.DeviceSelectionSupported for clients to query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do support device selection on mobile in the future, the client code does not change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split between input and output device selection?

foreach (var device in playout)
Debug.Log($" [{device.Index}] {device.Name}");

if (_platformAudio.RecordingDeviceCount > 0)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test with a device that has no input or output device

@MaxHeimbrock

Copy link
Copy Markdown
Contributor Author

Add tests to init platform audio.

@MaxHeimbrock

Copy link
Copy Markdown
Contributor Author

Mirror the C++ PlatformAudio test suites in the Unity Test Framework:

- EditMode (pure-managed, always run): AudioProcessingOptions defaults,
  AudioDevice struct, PlatformAudioSource null-arg guard.
- PlayMode unit (ADM-backed, no server): create source/track, custom
  options, enumerate + select-by-GUID, out-of-range index, start/stop
  recording. Skips via Assert.Ignore when no platform ADM is available.
- PlayMode E2E (Category=E2E): publish/unpublish round-trip, multiple
  sources from one manager, and media flow verified via an InboundRtp
  audio stat (the batch-mode-friendly substitute for the C++ frame
  callback).

Shared PlatformAudioTestHelper.TryCreateOrIgnore mirrors GTEST_SKIP for
environments without an ADM.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant