Initial commit — WPF guitar note name tutor using FFT frequency detection
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System.Windows;
|
||||
using SoundCapture;
|
||||
|
||||
namespace GuitarNoteNameTutor
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SelectDevice.xaml
|
||||
/// </summary>
|
||||
public partial class SelectDevice
|
||||
{
|
||||
SoundCaptureDevice[] _devices;
|
||||
|
||||
public SoundCaptureDevice SelectedDevice
|
||||
{
|
||||
get { return _devices[devicesListBox.SelectedIndex]; }
|
||||
}
|
||||
|
||||
public SelectDevice()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void LoadDevices()
|
||||
{
|
||||
devicesListBox.Items.Clear();
|
||||
|
||||
int defaultDeviceIndex = 0;
|
||||
|
||||
_devices = SoundCaptureDevice.GetDevices();
|
||||
for (int i = 0; i < _devices.Length; i++)
|
||||
{
|
||||
devicesListBox.Items.Add(_devices[i].Name);
|
||||
if (_devices[i].IsDefault)
|
||||
defaultDeviceIndex = i;
|
||||
}
|
||||
|
||||
devicesListBox.SelectedIndex = defaultDeviceIndex;
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadDevices();
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void lbi_MouseDoubleClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user