using System.Runtime.InteropServices; namespace Raylib_cs; /// /// Wave type, defines audio wave data /// [StructLayout(LayoutKind.Sequential)] public unsafe struct Wave { /// /// Number of samples /// public uint SampleCount; /// /// Frequency (samples per second) /// public uint SampleRate; /// /// Bit depth (bits per sample): 8, 16, 32 (24 not supported) /// public uint SampleSize; /// /// Number of channels (1-mono, 2-stereo) /// public uint Channels; //TODO: SPAN ? /// /// Buffer data pointer /// public void* Data; public readonly CBool IsValid => Raylib.IsWaveValid(this); public static Wave Load(string fileName) { return Raylib.LoadWave(fileName); } public CBool Export(string fileName) { return Raylib.ExportWave(this, fileName); } public CBool ExportAsCode(string fileName) { return Raylib.ExportWaveAsCode(this, fileName); } public void Format(int sampleRate, int sampleSize, int channels) { Raylib.WaveFormat(ref this, sampleRate, sampleSize, channels); } public void Crop(int initFrame, int finalFrame) { Raylib.WaveCrop(ref this, initFrame, finalFrame); } public void Unload() { Raylib.UnloadWave(this); } }