Correctly write float header when saving WAV audio clip

Fix wangqr/Aegisub#56
This commit is contained in:
wangqr 2020-06-29 04:53:35 -04:00
parent 65ba6af0f0
commit 5f326cc873

View file

@ -241,7 +241,7 @@ void SaveAudioClip(AudioProvider const& provider, fs::path const& path, int star
out.write("WAVEfmt "); out.write("WAVEfmt ");
out.write<int32_t>(16); // Size of chunk out.write<int32_t>(16); // Size of chunk
out.write<int16_t>(1); // compression format (PCM) out.write<int16_t>(provider.AreSamplesFloat() ? 3 : 1); // compression format (1: WAVE_FORMAT_PCM, 3: WAVE_FORMAT_IEEE_FLOAT)
out.write<int16_t>(provider.GetChannels()); out.write<int16_t>(provider.GetChannels());
out.write<int32_t>(provider.GetSampleRate()); out.write<int32_t>(provider.GetSampleRate());
out.write<int32_t>(provider.GetSampleRate() * provider.GetChannels() * provider.GetBytesPerSample()); out.write<int32_t>(provider.GetSampleRate() * provider.GetChannels() * provider.GetBytesPerSample());