public SoundMode4(bool gbc) : base(0xff1f, 64, gbc) { _volumeEnvelope = new VolumeEnvelope(); _polynomialCounter = new PolynomialCounter(); }
static void Main(string[] args) { Source.Function = FunctionType.Sin; EnvelopeGenerator = new VolumeEnvelope(Source); EnvelopeGenerator.Released += EnvelopeGeneratorOnReleased; Player = new AudioPlayer(EnvelopeGenerator); foreach (var (i, dev) in Player.Devices.Select((dev, i) => (i, dev))) { if (i == Player.DefaultDeviceIndex) { Console.WriteLine($"[{i}][Default] {dev.Name}"); } else { Console.WriteLine($"[{i}] {dev.Name}"); } } SoundIODevice device = null; while (device == null) { Console.Write("Device Index > "); var num = Console.ReadLine(); if (int.TryParse(num, out var i) && i >= 0 && i < Player.Devices.Count) { device = Player.Devices[i]; break; } } try { Player.Init(device); } catch (Exception ex) { Console.WriteLine(ex); Player.Dispose(); return; } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Input = new LinuxInput(); } else { Input = new CommonInput(); } Input.Attack += InputOnAttack; Input.Release += InputOnRelease; Input.Exit += InputOnExit; Input.Listen(); while (!exit) { Thread.Sleep(100); } Player.Dispose(); Input.Stop(); }