aboutsummaryrefslogtreecommitdiff
path: root/AudioTester/Program.cs
blob: 14212af5da35309db94ad74ce4c2ae31232b4bb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using AudioTester.Core;
using AudioTester.Core.Extensions;
using NAudio.Wave;
using RayRoom.Core;
using System.Drawing;
using System.Numerics;

namespace AudioTester
{
    internal class Program
    {
#pragma warning disable CA1416 // Проверка совместимости платформы
        static void Main(string[] args)
        {
            AudioSimulator a = new AudioSimulator();

            var array = a.Simulate(Vector2.Zero, 360);
            var bitmap = new Bitmap(2000, 2000);

            Matrix2x2 mat = new Matrix2x2(Vector2.UnitX * 100f, Vector2.UnitY * -100f);

            Pen background = new Pen(Color.FromArgb(5, Color.White), 4);
            Pen foreground = new Pen(Color.FromArgb(25, Color.White), 1);

            using (Graphics g = Graphics.FromImage(bitmap))
            {
                g.Clear(Color.Black);

                for (int i = 0; i < array.Length; i++)
                {
                    g.DrawLine(background, (array[i].a * mat + new Vector2(1000, 1000)).GetPoint(), (array[i].b * mat + new Vector2(1000, 1000)).GetPoint());
                    g.DrawLine(foreground, (array[i].a * mat + new Vector2(1000, 1000)).GetPoint(), (array[i].b * mat + new Vector2(1000, 1000)).GetPoint());
                }
            }

            bitmap.Save("bitmap.bmp");
#pragma warning restore CA1416 // Проверка совместимости платформы
            return;
            var device = new RenderStreamer();
            
            using (var wo = new WasapiOut(NAudio.CoreAudioApi.AudioClientShareMode.Shared, 150))
            {
                wo.Init(device);
                wo.Play();

                while (wo.PlaybackState == PlaybackState.Playing)
                {
                    Thread.Sleep(100);
                    
                    if (Console.KeyAvailable)
                        wo.Stop();
                }
            }
        }
    }
}