using System.Runtime.InteropServices; namespace Raylib_cs; /// /// Music stream type (audio file streaming from memory)
/// NOTE: Anything longer than ~10 seconds should be streamed ///
[StructLayout(LayoutKind.Sequential)] public unsafe struct Music { /// /// Audio stream /// public AudioStream Stream; /// /// Total number of samples /// public uint FrameCount; /// /// Music looping enable /// public CBool Looping; /// /// Type of music context (audio filetype) /// public int CtxType; //TODO span /// /// Audio context data, depends on type /// public void* CtxData; public readonly CBool IsValid => Raylib.IsMusicValid(this); public static Music Load(string fileName) { return Raylib.LoadMusicStream(fileName); } public readonly void Play() { Raylib.PlayMusicStream(this); } public readonly void Pause() { Raylib.PauseMusicStream(this); } public void Update() { Raylib.UpdateMusicStream(this); } public readonly void Stop() { Raylib.StopMusicStream(this); } /// /// Set pan of this music where 0.5 is centered /// public void SetPan(float pan) { Raylib.SetMusicPan(this, pan); } /// /// Set pitch for this music where 1.0 is base level /// } public void SetPitch(float pitch) { Raylib.SetMusicPitch(this, pitch); } /// /// Set music volume from 0.0 to 1.0 /// public void SetVolume(float volume) { Raylib.SetMusicVolume(this, volume); } /// /// Seek music to a position (in seconds) /// public void Seek(float position) { Raylib.SeekMusicStream(this, position); } public void Unload() { Raylib.UnloadMusicStream(this); } }