ruuda / hound

A wav encoding and decoding library in Rust
https://codeberg.org/ruuda/hound
Apache License 2.0
491 stars 65 forks source link

Channel masks do not match spec predefined values #60

Closed diffuse closed 2 years ago

diffuse commented 2 years ago

https://github.com/ruuda/hound/blob/02e66effb33683dd6acb92df792683ee46ad6a59/src/write.rs#L124

It appears that the spec for WAVEFORMATEXTENSIBLE provides predefined values for channel masks:

Speaker position Flag bit
SPEAKER_FRONT_LEFT 0x1
SPEAKER_FRONT_RIGHT 0x2
SPEAKER_FRONT_CENTER 0x4
SPEAKER_LOW_FREQUENCY 0x8
SPEAKER_BACK_LEFT 0x10
SPEAKER_BACK_RIGHT 0x20
SPEAKER_FRONT_LEFT_OF_CENTER 0x40
SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
SPEAKER_BACK_CENTER 0x100
SPEAKER_SIDE_LEFT 0x200
SPEAKER_SIDE_RIGHT 0x400
SPEAKER_TOP_CENTER 0x800
SPEAKER_TOP_FRONT_LEFT 0x1000
SPEAKER_TOP_FRONT_CENTER 0x2000
SPEAKER_TOP_FRONT_RIGHT 0x4000
SPEAKER_TOP_BACK_LEFT 0x8000
SPEAKER_TOP_BACK_CENTER 0x10000
SPEAKER_TOP_BACK_RIGHT 0x20000

However, the method this library uses to generate channel masks does not match the spec. Is this intentional? If not, I'm happy to do a PR to fix it.

ruuda commented 2 years ago

Fixed by #59 in 77e23ef330ad986a309e40c785ea521d3295e548.