Open jrlanglois opened 6 years ago
I was just digging into this because I needed it for a project, and it looks like if you set the bitsPerSample
argument in WaveAudioFormat::createWriterFor()
to 32, then it will set the format code of the fmt
chunk to WAVE_FORMAT_IEEE_FLOAT
. If the code is assuming you're writing floating point instead of PCM when you set that value to 32, it should probably be mentioned somewhere in the documentation.
That said I think the code is erroneous because it doesn't write 0 to cbSize
which must be done for non-PCM formats without a format chunk extension.
I have never really dug into the Wave spec before so I may be totally off base here.
Both formats mentioned in the title support writing/reading 32-bit float audio, but
AudioFormatWriter
does not allow mutatingusesFloatingPointData
.Needless to say, this would also require checks to be sure
AudioFormatWriter::bitsPerSample
is 32.