namespace Nerfed.Runtime.Audio;
///
/// Use this in conjunction with a StreamingVoice to play back streaming audio data.
///
public abstract class AudioDataStreamable : AudioResource
{
public Format Format { get; protected set; }
public abstract bool Loaded { get; }
public abstract uint DecodeBufferSize { get; }
protected AudioDataStreamable(AudioDevice device) : base(device)
{
}
///
/// Loads the raw audio data into memory to prepare it for stream decoding.
///
public abstract void Load();
///
/// Unloads the raw audio data from memory.
///
public abstract void Unload();
///
/// Seeks to the given sample frame.
///
public abstract void Seek(uint sampleFrame);
///
/// Attempts to decodes data of length bufferLengthInBytes into the provided buffer.
///
/// The buffer that decoded bytes will be placed into.
/// Requested length of decoded audio data.
/// How much data was actually filled in by the decode.
/// Whether the end of the data was reached on this decode.
public abstract unsafe void Decode(void* buffer, int bufferLengthInBytes, out int filledLengthInBytes, out bool reachedEnd);
protected override void Dispose(bool disposing)
{
if (!IsDisposed)
{
Unload();
}
base.Dispose(disposing);
}
}