public IModule CreateModule()
        {
            DanmakuSpeechModule speechModule = new DanmakuSpeechModule();

            speechModule.Init(this);
            return(speechModule);
        }
        public DanmakuSpeechControl(DanmakuSpeechModule SpeechModule, string defaultOutputDevice)
        {
            InitializeComponent();

            Module = SpeechModule;

            foreach (DanmakuSpeechConfig.SpeechFilterOptions filterOption in Enum.GetValues(typeof(DanmakuSpeechConfig.SpeechFilterOptions)))
            {
                bool initValue = true;
                if (SpeechModule.OptionDict.ContainsKey(filterOption))
                {
                    initValue = SpeechModule.OptionDict[filterOption];
                }
                else
                {
                    SpeechModule.OptionDict.Add(filterOption, initValue);
                }

                DescriptionAttribute[] attributes = (DescriptionAttribute[])filterOption
                                                    .GetType()
                                                    .GetField(filterOption.ToString())
                                                    .GetCustomAttributes(typeof(DescriptionAttribute), false);
                string description = attributes.Length > 0 ? attributes[0].Description : string.Empty;

                CheckBox checkBox = new CheckBox
                {
                    Content           = description,
                    IsChecked         = initValue,
                    Margin            = new Thickness(4),
                    VerticalAlignment = VerticalAlignment.Center,
                    Tag = filterOption
                };
                checkBox.Checked   += ShowOptionCkb_Checked;
                checkBox.Unchecked += ShowOptionCkb_Unchecked;
                OptionPanel.Children.Add(checkBox);
            }


            OutputDeviceCombo.Items.Add(new ComboBoxItem()
            {
                Content = "默认输出设备", Tag = -1
            });
            OutputDeviceCombo.SelectedIndex = 0;
            int deviceCount = Wave.WaveOut.DeviceCount;

            for (int i = 0; i < deviceCount; i++)
            {
                Wave.MmeInterop.WaveOutCapabilities waveOutCapabilities = Wave.WaveOut.GetCapabilities(i);
                ComboBoxItem comboBoxItem = new ComboBoxItem()
                {
                    Content = waveOutCapabilities.ProductName, Tag = i
                };
                OutputDeviceCombo.Items.Add(comboBoxItem);
                if (waveOutCapabilities.ProductName == defaultOutputDevice)
                {
                    OutputDeviceCombo.SelectedItem = comboBoxItem;
                }
            }

            VolumeSlider.Value = Module.Volume;
        }