using System.Runtime.InteropServices;
namespace Raylib_cs;
///
/// Sound source type
///
[StructLayout(LayoutKind.Sequential)]
public struct Sound
{
///
/// Audio stream
///
public AudioStream Stream;
///
/// Total number of frames (considering channels)
///
public uint FrameCount;
public readonly CBool IsValid => Raylib.IsSoundValid(this);
public readonly CBool IsPlaying => Raylib.IsSoundPlaying(this);
public static Sound Load(string fileName)
{
return Raylib.LoadSound(fileName);
}
public static Sound LoadFromWave(Wave wave)
{
return Raylib.LoadSoundFromWave(wave);
}
public readonly void Play()
{
Raylib.PlaySound(this);
}
public readonly void Pause()
{
Raylib.PauseSound(this);
}
public readonly void Resume()
{
Raylib.ResumeSound(this);
}
///
/// Set pan where 0.5 is center
///
public void SetPan(float pan)
{
Raylib.SetSoundPan(this, pan);
}
///
/// Set pitch where 1.0 is base level
///
public void SetPitch(float pitch)
{
Raylib.SetSoundPitch(this, pitch);
}
///
/// Set volume from 0.0 to 1.0
///
public void SetVolume(float volume)
{
Raylib.SetSoundVolume(this, volume);
}
public void Unload()
{
Raylib.UnloadSound(this);
}
}