private void acceptBTN_Click(object sender, RoutedEventArgs e) { settings = Settings.GetInstance(); if (deviceCB.SelectedIndex != -1 && inputCB.SelectedIndex != -1 &&bufferSizeTB.Text != String.Empty && deviceCB.SelectedIndex != -1 && sampleRateTB.Text != String.Empty) { settings.DeviceNumber = deviceCB.SelectedIndex; settings.InputNumber = inputCB.SelectedIndex; settings.BufferSize = Convert.ToInt32(bufferSizeTB.Text); settings.SampleRate = Convert.ToSingle(sampleRateTB.Text); settings.SampleType = (AsioSampleType)bitDepthCB.SelectedItem; switch ((AsioSampleType)bitDepthCB.SelectedItem) { case AsioSampleType.Float32LSB: { settings.MulBitDepth = 4; break; } case AsioSampleType.Int32LSB: { settings.MulBitDepth = 4; break; } case AsioSampleType.Int24LSB: { settings.MulBitDepth = 3; break; } case AsioSampleType.Int16LSB: { settings.MulBitDepth = 2; break; } } } else { MessageBox.Show("Some fields are empty!", "Error"); } settings.IsConversationSetted = true; Audio.GetInstance().Play(); }
public static Settings GetInstance() { return _instance ?? (_instance = new Settings()); }