2022-08-02 21:04:12 +00:00
|
|
|
namespace MoonWorks.Audio
|
|
|
|
{
|
|
|
|
public abstract class StreamingSoundSeekable : StreamingSound
|
|
|
|
{
|
|
|
|
public bool Loop { get; set; }
|
|
|
|
|
2023-05-05 22:26:32 +00:00
|
|
|
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
|
2023-05-05 22:26:32 +00:00
|
|
|
) : base(
|
|
|
|
device,
|
|
|
|
formatTag,
|
|
|
|
bitsPerSample,
|
|
|
|
blockAlign,
|
|
|
|
channels,
|
|
|
|
samplesPerSecond,
|
2023-05-12 00:56:40 +00:00
|
|
|
bufferSize,
|
|
|
|
autoUpdate
|
2023-05-05 22:26:32 +00:00
|
|
|
) {
|
|
|
|
|
2022-08-02 21:04:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public abstract void Seek(uint sampleFrame);
|
|
|
|
|
|
|
|
protected override void OnReachedEnd()
|
|
|
|
{
|
|
|
|
if (Loop)
|
|
|
|
{
|
2023-03-07 23:28:57 +00:00
|
|
|
ConsumingBuffers = true;
|
2022-08-02 21:04:12 +00:00
|
|
|
Seek(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|