-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpectrum.xaml.cs
125 lines (105 loc) · 3.57 KB
/
Spectrum.xaml.cs
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
using System.Collections.Generic;
using System.Windows.Controls;
namespace AudioSpectrum
{
/// <summary>
/// Interaction logic for Spectrum.xaml
/// </summary>
public partial class Spectrum : UserControl
{
int iBarSelected = 1;
public Spectrum()
{
InitializeComponent();
}
public void Set(List<byte> data)
{
if (data.Count < 16) return;
Bar01.Value = data[0];
Bar02.Value = data[1];
Bar03.Value = data[2];
Bar04.Value = data[3];
Bar05.Value = data[4];
Bar06.Value = data[5];
Bar07.Value = data[6];
Bar08.Value = data[7];
Bar09.Value = data[8];
Bar10.Value = data[9];
Bar11.Value = data[10];
Bar12.Value = data[11];
Bar13.Value = data[12];
Bar14.Value = data[13];
Bar15.Value = data[14];
Bar16.Value = data[15];
BarSelected.Value = data[iBarSelected - 1];
}
public int GetSelected()
{
return iBarSelected - 1;
}
private void Bar01_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 1;
}
private void Bar02_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 2;
}
private void Bar03_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 3;
}
private void Bar04_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 4;
}
private void Bar05_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 5;
}
private void Bar06_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 6;
}
private void Bar07_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 7;
}
private void Bar08_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 8;
}
private void Bar09_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 9;
}
private void Bar10_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 10;
}
private void Bar11_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 11;
}
private void Bar12_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 12;
}
private void Bar13_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 13;
}
private void Bar14_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 14;
}
private void Bar15_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 15;
}
private void Bar16_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
iBarSelected = 16;
}
}
}