diff --git a/hooks/bmsbhook.cpp b/hooks/bmsbhook.cpp index b67baf7..973d106 100644 --- a/hooks/bmsbhook.cpp +++ b/hooks/bmsbhook.cpp @@ -317,10 +317,10 @@ public: } }; - [[nodiscard]] static constexpr size_t assertsz_asf(size_t sz) noexcept + [[nodiscard]] static constexpr size_t assertsz_asf(size_t sz, int8_t resampler = 1) noexcept { - //_TODO: second argument data type (float/int) - return static_cast(static_cast(sz) * 14.8) + WAVHDRSIZE; // 0.wma is consistent 180 therefore VBR Q90, sometimes 160 though, but samples are all over the place + resampler = (resampler > 1 || resampler == -1) ? 2 : 1; // resampler ratio multiplier (see pcm_resampler enum, original data is float) + return static_cast(static_cast(sz) * 14.8) * resampler + WAVHDRSIZE; // 0.wma is consistent 180 therefore VBR Q90, sometimes 160 though, but samples are all over the place } [[nodiscard]] constexpr const decltype(bank::header) *header() const noexcept @@ -826,8 +826,8 @@ void run_tests() wavsz = 0; // AV codec (1:1 unmodified PCM data, other than resampling if enabled) - wav = (BYTE *) malloc(snd_2dx::assertsz_asf(snds3p->voice(0)->sz)); - avcodec::BmswTranscoderAsfToWav(snds3p->voice(0)->asf(), snds3p->voice(0)->sz, &wav, &wavsz, avcodec::bmswac_resampler_s16); + wav = (BYTE *) malloc(snd_2dx::assertsz_asf(snds3p->voice(0)->sz, avcodec::bmswac_resampler_f32)); + avcodec::BmswTranscoderAsfToWav(snds3p->voice(0)->asf(), snds3p->voice(0)->sz, &wav, &wavsz, avcodec::bmswac_resampler_f32); dump_("ac_wav.wav", wav, wavsz); free(wav); wav = nullptr;