Xaudio CreateBuffers bug

There is a bug in CreateBuffers Method, loopStart and loopEnd must been in samples not in bytes.
And remove bytes to samples conversion in PlatformLoadAudioStream().
Else PlatformInitialize(byte[] buffer, …) method doesn’t work.

private void CreateBuffers(WaveFormat format, DataStream dataStream, int loopStart, int loopLength)
{
_format = format;
_dataStream = dataStream;

  int samplesBegin  = (int)(loopStart / ((format.Channels * format.BitsPerSample) >> 3));
  int samplesLength = (int)(loopLength / ((format.Channels * format.BitsPerSample) >> 3));

  _buffer = new AudioBuffer
  {
    Stream = _dataStream,
    AudioBytes = (int)_dataStream.Length,
    Flags = BufferFlags.EndOfStream,
    PlayBegin = samplesBegin, //In samples !
    PlayLength = samplesLength, //In samples !
    Context = new IntPtr(42),
  };

Interesting! I just posted a somewhat related fix for the Pipeline.
What you are dividing with is format.BlockAlign!