Glatzemann 5b871f27fa - added InputSystems to Windows 8 / Metro build (main build script)
- fixed some compile errors in XAudio SoundSystem when building for Windows 8 / Metro
- updated ProjectConverter to remove OggVorbis assemblies from project references when building for Windows 8 / Metro
2015-03-15 01:12:09 +01:00

47 lines
1.3 KiB
C#

#if !WINDOWSMETRO
using System;
using System.IO;
using OggUtils;
using SharpDX;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.SoundSystem.Windows.XAudio
{
internal class XAudioOggInputStream : OggInputStream
{
public const int BufferLength = 4096 * 8;
public XAudioOggInputStream(Stream input)
: base(input)
{
}
public int Read(DataStream buffer)
{
if (StreamData.EndOfStream)
return 0;
int length = BufferLength;
int readOffset = 0;
while (length > 0)
{
if (FillConversionBufferIfNeeded() == false)
break;
int convertedBytesAvailable = ConversionBufferSize - ConversionBufferOffset;
int bytesToCopy = Math.Min(length, convertedBytesAvailable);
buffer.WriteRange(ConversionBuffer, ConversionBufferOffset, bytesToCopy);
ConversionBufferOffset += bytesToCopy;
length -= bytesToCopy;
readOffset += bytesToCopy;
}
return readOffset;
}
}
}
#endif