microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.45k stars 371 forks source link

WAV loop regions incorrectly read #83

Closed pklima closed 3 years ago

pklima commented 3 years ago

Hello, I noticed a bug in the reading of WAV loop regions in WaveFindLoopInfo(), specifically the region length is incorrectly set.

Repro

  1. Obtain a WAV with loop points in it, e.g. MinigunWindupAndFireLooped1.wav from the XNA Game Studios audio samples.
  2. Replace musicmono_adpcm.wav in one of the DirectXTK samples with the looped WAV above.
  3. Run the sample in debug, observe an assert:
    XAudio2: Loop region (75008-231711) does not end within the audio buffer (size 128640)
    XAudio2: Invalid source buffer

The same issue is also present in the DX11 version.

pklima commented 3 years ago

The same issue is also present in the DX11 version.

I'm not quite sure what the best way to go about fixing this. I'm happy to provide a pull request into the other repo as well?

walbourn commented 3 years ago

Thanks for the fix. I'll be sure to propagate the fix elsewhere...

walbourn commented 3 years ago