示例#1
0
        private void LoadSettings()
        {
            try
            {
                Frequency.Text       = Program.SynthSettings.GetValue("AudioFrequency", 44100).ToString();
                PolyphonyLimit.Value = Convert.ToInt32(Program.SynthSettings.GetValue("MaxVoices", 512));
                MaxCPU.Value         = Convert.ToInt32(Program.SynthSettings.GetValue("MaxRenderingTime", 75));
                FastHotKeys.Checked  = Convert.ToBoolean(Program.SynthSettings.GetValue("FastHotkeys", 0));
                DebugMode.Checked    = Convert.ToBoolean(Program.SynthSettings.GetValue("DebugMode", 0));

                try { PrioBox.SelectedIndex = Convert.ToInt32(Program.SynthSettings.GetValue("DriverPriority", 0)); }
                catch { PrioBox.SelectedIndex = 0; }

                switch (Convert.ToInt32(Program.SynthSettings.GetValue("AudioBitDepth", 1)))
                {
                default:
                case 1:
                    AudioBitDepth.SelectedIndex = 0;
                    break;

                case 0:
                case 2:
                    AudioBitDepth.SelectedIndex = 1;
                    break;

                case 3:
                    AudioBitDepth.SelectedIndex = 2;
                    break;
                }

                DisableChime.Checked       = Convert.ToBoolean(Program.SynthSettings.GetValue("DisableChime", 0));
                LiveChangesTrigger.Checked = Properties.Settings.Default.LiveChanges;

                VolumeBoost.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("VolumeBoost", 0));
                VolTrackBar.Maximum = VolumeBoost.Checked ? 50000 : 10000;
                VolTrackBar.Value   = Convert.ToInt32(Program.SynthSettings.GetValue("OutputVolume", 10000));

                AutoLoad.Checked = Properties.Settings.Default.AutoLoadList;

                Preload.Checked        = Convert.ToBoolean(Program.SynthSettings.GetValue("PreloadSoundfonts", 1));
                EnableSFX.Checked      = Convert.ToBoolean(Program.SynthSettings.GetValue("EnableSFX", 1));
                NoteOffCheck.Checked   = Convert.ToBoolean(Program.SynthSettings.GetValue("NoteOff1", 0));
                SysResetIgnore.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("IgnoreSysReset", 0));
                bufsize.Value          = Convert.ToInt32(Program.SynthSettings.GetValue("BufferLength", 30));

                SincInter.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("SincInter", 0));
                CheckSincEnabled();
                try { SincConv.SelectedIndex = Convert.ToInt32(Program.SynthSettings.GetValue("SincConv", 0)); }
                catch { SincConv.SelectedIndex = 2; }

                FadeoutDisable.Checked   = Convert.ToBoolean(Program.SynthSettings.GetValue("DisableNotesFadeOut", 0));
                MonophonicFunc.Checked   = Convert.ToBoolean(Program.SynthSettings.GetValue("MonoRendering", 0));
                SlowDownPlayback.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("DontMissNotes", 0));
                KSDAPIBox.Checked        = Convert.ToBoolean(Program.SynthSettings.GetValue("KDMAPIEnabled", 1));
                HMode.Checked            = Convert.ToBoolean(Program.SynthSettings.GetValue("HyperPlayback", 0));
                OldBuff.Checked          = Convert.ToBoolean(Program.SynthSettings.GetValue("NotesCatcherWithAudio", 0));

                ReverbV.Value            = Functions.Between0And127(Convert.ToInt32(Program.SynthSettings.GetValue("Reverb", 64)));
                ChorusV.Value            = Functions.Between0And127(Convert.ToInt32(Program.SynthSettings.GetValue("Chorus", 64)));
                EnableRCOverride.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("RCOverride", 0));
                EnableRCOverride_CheckedChanged(null, null);

                DisableCookedPlayer.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("DisableCookedPlayer", 0));
                AllNotesIgnore.Checked      = Convert.ToBoolean(Program.SynthSettings.GetValue("IgnoreAllNotes", 0));
                IgnoreNotes.Checked         = Convert.ToBoolean(Program.SynthSettings.GetValue("IgnoreNotesBetweenVel", 0));

                Int32 LV = Convert.ToInt32(Program.SynthSettings.GetValue("MinVelIgnore", 1));
                Int32 HV = Convert.ToInt32(Program.SynthSettings.GetValue("MaxVelIgnore", 2));
                if (LV > HV)
                {
                    LV = HV;
                }
                if (LV <IgnoreNotesLV.Minimum | LV> IgnoreNotesLV.Maximum)
                {
                    LV = (int)IgnoreNotesLV.Minimum;
                }
                if (HV <IgnoreNotesHV.Minimum | HV> IgnoreNotesHV.Maximum)
                {
                    HV = (int)IgnoreNotesHV.Minimum;
                }
                IgnoreNotesLV.Value = LV;
                IgnoreNotesHV.Value = HV;

                CapFram.Checked            = Convert.ToBoolean(Program.SynthSettings.GetValue("CapFramerate", 1));
                Limit88.Checked            = Convert.ToBoolean(Program.SynthSettings.GetValue("LimitTo88Keys", 0));
                FullVelocityMode.Checked   = Convert.ToBoolean(Program.SynthSettings.GetValue("FullVelocityMode", 0));
                OverrideNoteLength.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("OverrideNoteLength", 0));
                NoteLengthValue.Value      = Convert.ToDecimal((double)Convert.ToInt32(Program.SynthSettings.GetValue("NoteLengthValue", 5)) / 1000.0);
                DelayNoteOff.Checked       = Convert.ToBoolean(Program.SynthSettings.GetValue("DelayNoteOff", 0));
                NoteOffDelayValue.Value    = Convert.ToDecimal((double)Convert.ToInt32(Program.SynthSettings.GetValue("DelayNoteOffValue", 5)) / 1000.0);
                HMode_CheckedChanged(null, null);

                switch (Convert.ToInt32(Program.SynthSettings.GetValue("CurrentEngine", AudioEngine.WASAPI_ENGINE)))
                {
                case AudioEngine.WASAPI_ENGINE:
                default:
                    AudioEngBox.SelectedIndex = AudioEngine.WASAPI_ENGINE;
                    break;

                case AudioEngine.AUDTOWAV:
                    AudioEngBox.SelectedIndex = AudioEngine.AUDTOWAV;
                    break;

                case AudioEngine.DSOUND_ENGINE:
                    AudioEngBox.SelectedIndex = AudioEngine.DSOUND_ENGINE;
                    break;

                case AudioEngine.ASIO_ENGINE:
                    AudioEngBox.SelectedIndex = AudioEngine.ASIO_ENGINE;
                    break;
                }

                UseTGT.Checked = Convert.ToBoolean(Program.SynthSettings.GetValue("StockWinMM", 0));
                ShowChangelogUpdate.Checked = Properties.Settings.Default.ShowChangelogStartUp;

                Functions.LiveChanges.PreviousEngine    = (int)Program.SynthSettings.GetValue("CurrentEngine", AudioEngine.WASAPI_ENGINE);
                Functions.LiveChanges.PreviousFrequency = (int)Program.SynthSettings.GetValue("AudioFrequency", 44100);
                Functions.LiveChanges.PreviousBuffer    = (int)Program.SynthSettings.GetValue("BufferLength", 50);
                Functions.LiveChanges.MonophonicRender  = (int)Program.SynthSettings.GetValue("MonoRendering", 0);
                Functions.LiveChanges.AudioBitDepth     = (int)Program.SynthSettings.GetValue("AudioBitDepth", 1);
            }
            catch (Exception ex)
            {
                Program.ShowError(4, "FATAL ERROR", "The configurator is unable to load its settings.\n\nPress OK to quit.", ex);
                Application.ExitThread();
            }
        }