andrewrk / libsoundio

C library for cross-platform real-time audio input and output
http://libsound.io/
MIT License
1.93k stars 228 forks source link

Add SoundIoFormatS24PackedLE format for WASAPI #286

Closed satumaimo10 closed 5 months ago

satumaimo10 commented 1 year ago

I add SoundIoFormatS24PackedLE format on wasapi.c for v2 branch.

I'm using a DAC named UR-12, and I notice this DAC probably only support 24bit packed format in wasapi exclusive mode.

Thus, I add supporting SoundIoFormatS24PackedLE on wasapi.c while referencing issue #94.

After this adding, I verified that example/sio_list_devices.exe and example/sio_sine.exe (modified) run correctly on my environment (WIndows 10 version 22H2).

satumaimo10 commented 1 year ago

This may be a problem specific to my environment, but after applying this fix, distorted sound was played back.

The problem seems to be caused by too short BufferDuration and Periodicity when initializing IAudioClient in the function outstream_do_open in wasapi.c. This can be solved by changing the base of these arguments to default_device_period instead of min_device_period.

This is a different problem than the one addressed in this pull request, but we report it just in case.