Skip to content

Feat/mono spatial audio#59

Draft
popuz wants to merge 23 commits intomainfrom
feat/mono-spatial-audio
Draft

Feat/mono spatial audio#59
popuz wants to merge 23 commits intomainfrom
feat/mono-spatial-audio

Conversation

@popuz
Copy link
Copy Markdown

@popuz popuz commented Mar 17, 2026

No description provided.

popuz added 19 commits March 6, 2026 20:06
When mono=true, reads 1 channel from native layer and duplicates to stereo output in OnAudioFilterRead. This halves FFI data transfer and enables manual angular panning in future iterations. Backward compatible: mono=false (default) preserves existing stereo behavior.

Made-with: Cursor
AudioStream.ReadAudio with channels=1 triggers internal recreation on the audio thread, which accesses StreamKeyUtils (persistentDataPath) causing a main-thread-only UnityException. Instead, read stereo as usual and extract the left channel as mono post-read. FFI mono optimization deferred to a later iteration.

Made-with: Cursor
Pan (-1..+1) is set from the main thread and applied per-buffer in OnAudioFilterRead using equal-power cos/sin law. Only effective when mono=true.

Made-with: Cursor
@popuz popuz self-assigned this Mar 17, 2026
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