MoonWorks/src/Audio/AudioData.cs

37 lines
1.2 KiB
C#

using System;
namespace MoonWorks.Audio
{
public abstract class AudioData
{
public Format Format { get; protected set; }
public abstract uint DecodeBufferSize { get; }
public abstract bool Loaded { get; }
/// <summary>
/// Loads the raw audio data into memory.
/// </summary>
public abstract void Load();
/// <summary>
/// Seeks to the given sample frame.
/// </summary>
public abstract void Seek(uint sampleFrame);
/// <summary>
/// Attempts to decodes data of length bufferLengthInBytes into the provided buffer.
/// </summary>
/// <param name="buffer">The buffer that decoded bytes will be placed into.</param>
/// <param name="bufferLengthInBytes">Requested length of decoded audio data.</param>
/// <param name="filledLengthInBytes">How much data was actually filled in by the decode.</param>
/// <param name="reachedEnd">Whether the end of the data was reached on this decode.</param>
public abstract unsafe void Decode(void* buffer, int bufferLengthInBytes, out int filledLengthInBytes, out bool reachedEnd);
/// <summary>
/// Unloads the raw audio data from memory.
/// </summary>
public abstract void Unload();
}
}