MoonWorks/src/Audio/StreamingSoundSeekable.cs

41 lines
652 B
C#
Raw Normal View History

namespace MoonWorks.Audio
{
public abstract class StreamingSoundSeekable : StreamingSound
{
public bool Loop { get; set; }
protected StreamingSoundSeekable(
AudioDevice device,
ushort formatTag,
ushort bitsPerSample,
ushort blockAlign,
ushort channels,
uint samplesPerSecond,
2023-05-12 00:56:40 +00:00
uint bufferSize,
bool autoUpdate
) : base(
device,
formatTag,
bitsPerSample,
blockAlign,
channels,
samplesPerSecond,
2023-05-12 00:56:40 +00:00
bufferSize,
autoUpdate
) {
}
public abstract void Seek(uint sampleFrame);
protected override void OnReachedEnd()
{
if (Loop)
{
ConsumingBuffers = true;
Seek(0);
}
}
}
}