WaveOut: remove hardcoded bits per sample value

To derive the bit depth, we can determine the number of bytes per frame (kChannels * 2), divide by the number of channels to get bytes per sample (2), and finally convert to bits by multiplying by 8 (16 bits).
This commit is contained in:
sukibaby
2025-06-22 19:06:36 -07:00
committed by teejusb
parent d673ae5688
commit 986695d2cd
@@ -154,6 +154,7 @@ RString RageSoundDriver_WaveOut::Init()
fmt.nChannels = kChannels;
fmt.cbSize = 0;
fmt.nSamplesPerSec = wo_samplerate_;
fmt.wBitsPerSample = 8 * (kBytesPerFrame / kChannels);
fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8;
fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign;