using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SynthySound; namespace EvilSatellites { public class MusicManager { public string CurrentFile; public ISoundEffect Song; public float _Volume; public float Volume { get => _Volume; set { if (IsPlaying) { Song.Volume = value; } _Volume = value; } } public bool IsPlaying; public Synthy Engine; public MusicManager(Synthy engine) { Engine = engine; _Volume = 0.2f; IsPlaying = false; } public void Play(string path) { if (path == CurrentFile) return; if (IsPlaying) { Song.Stop(); Song.Destroy(); } Song = Engine.Load(@"sfx/music/" + path + ".mp3", false, true); Song.Play(); Song.Volume = _Volume; Song.Loop = true; CurrentFile = path; IsPlaying = true; } public void Stop() { if (IsPlaying) { Song.Stop(); Song.Destroy(); IsPlaying = false; } } } }