[raudio] Support basic capture streaming to speakers#5913
Conversation
This commit introduces basic streaming from a capture source (e.g. a microphone) to the device speakers. The playback format was changed from ma_format_f32 to ma_format_s32 to support capturing audio.
| //---------------------------------------------------------------------------------- | ||
| #ifndef AUDIO_DEVICE_FORMAT | ||
| #define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (float-32bit) | ||
| #define AUDIO_DEVICE_FORMAT ma_format_s32 // Device output format (signed-32bit) |
There was a problem hiding this comment.
This seems a potentially breaking change for many raylib users, did you consider that?
There was a problem hiding this comment.
I tested audio playback and it appears to be just the same as before. I found that recording audio and playing audio from the same device only works properly with this format. However, if changing the audio format will cause breaking changes, I may be able to revert the audio device back to its original format and playback-only mode and create a secondary device with the new format in capture-only mode. Then convert between formats when playing from the capture device to the playback device.
|
I played around with the original f32 format some more and I think the issue I was originally having that caused me to change formats was with my own hardware. I was able to change the format back and leave the rest of the code alone, so hopefully there should be no more breaking changes. Note: There does seem to be an issue where the microphone output is being panned to one side only (and this has nothing to do with formats). I can try to fix this in a future PR, unless you would prefer it done now. |
This commit introduces basic streaming from a capture source (e.g. a microphone) to the device speakers. The playback format was changed from ma_format_f32 to ma_format_s32 to support capturing audio.
Hopefully this commit can be a basis for future capture-related functionality
Note: I have tested this on Windows, macOS, and Linux.