-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASAPI multi-channel microphone input #96947
Conversation
Support multi-channel microphone input by downmixing to stereo - Enhanced the WASAPI audio driver to support microphones with any number of channels. - This modification ensures compatibility with a broader range of multi-channel microphones, allowing for more versatile input handling in Godot. Regarding “WASAPI: unsupported channel count in microphone!” error.
Thanks for opening your first Godot PR! For information, the audio area in Godot doesn't have a dedicated maintainer right now, so it might take some time to assess. That being said the changes seem fairly straightfoward and fixing long standing issues so I think with some testing from Windows users with multi-channel microphones, it should be easy enough to approve and merge. |
l += sample; | ||
} | ||
} | ||
int32_t last_sample = read_sample(ad->audio_input.format_tag, ad->audio_input.bits_per_sample, data, j * channels + (channels - 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can input have the odd number of channels at all (the assumption here seems to be L,R,Center channel config)?
Also, do this odd/even channel distribution to left/right always holds (is defined somewhere in the WASAPI documented, or based on specific mic sample)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the assumption that the microphone might have a potential configuration with odd channels (e.g., Left, Right, Center), although such configurations are uncommon (in some professional audio equipment). The goal was to ensure that the microphone is at least usable within Godot, regardless of the channel count. The WASAPI documentation itself doesn't explicitly specify how multi-channel microphones should be handled, so I aimed for a more general solution to accommodate various configurations.
I apologize for the inconvenience caused by the multiple review requests. Due to my unfamiliarity with the process, I made several revisions which have led to some wasted time. I have now reviewed and confirmed that everything is correct. |
Support multi-channel microphone input by downmixing to stereo
Fix #82823
Fix #30313
Related issues
I tried compiling and testing the four channel microphone on my laptop, and it turned out to be error free. This enables the successful use of multi-channel microphones in Godot.
Thank you for reviewing !