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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user