private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { OptionsForm ops = new OptionsForm(); if (ops.ShowDialog() == System.Windows.Forms.DialogResult.OK) { plist.clearImages(); pctrl.updateButtons(SynthWaveProvider.PlayerState.Stopped); if (sthread != null) { sthread.Close(); sthread.Provider.TimeUpdate -= new SynthWaveProvider.UpdateTime(pctrl.updateTime); } Properties.Settings.Default.Latency = ops.latency; Properties.Settings.Default.SampleRate = ops.sampleRate; Properties.Settings.Default.BufferSize = ops.bufferSize; Properties.Settings.Default.BufferCount = ops.bufferCount; Properties.Settings.Default.Interp = ops.interpolation; Properties.Settings.Default.poly = ops.polyphony; Properties.Settings.Default.Save(); Synthesizer.InterpolationMode = (InterpolationEnum)Properties.Settings.Default.Interp; //dispose of event handlers sthread.Provider.TimeUpdate -= new SynthWaveProvider.UpdateTime(pctrl.updateTime); if (mctrol.Visible == true) { sthread.Provider.UpdateMidiControllers -= new SynthWaveProvider.UpdateTrackBars(mctrol.updateMidiControls); } //create new object with new event handlers sthread = new SynthThread(); sthread.Provider.TimeUpdate += new SynthWaveProvider.UpdateTime(pctrl.updateTime); if (mctrol.Visible == true) { sthread.Provider.UpdateMidiControllers += new SynthWaveProvider.UpdateTrackBars(mctrol.updateMidiControls); } if (File.Exists(Properties.Settings.Default.BankFile)) { sthread.LoadBank(Properties.Settings.Default.BankFile); kctrl.updateBankList(sthread.getProgramNames(kctrl.GetBank())); } } }
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { OptionsForm ops = new OptionsForm(); if (ops.ShowDialog() == System.Windows.Forms.DialogResult.OK) { plist.clearImages(); pctrl.updateButtons(SynthWaveProvider.PlayerState.Stopped); if (sthread != null) { sthread.Close(); sthread.Provider.TimeUpdate -= new SynthWaveProvider.UpdateTime(pctrl.updateTime); } Properties.Settings.Default.Latency = ops.latency; Properties.Settings.Default.SampleRate = ops.sampleRate; Properties.Settings.Default.BufferSize = ops.bufferSize; Properties.Settings.Default.BufferCount = ops.bufferCount; Properties.Settings.Default.Interp = ops.interpolation; Properties.Settings.Default.poly = ops.polyphony; Properties.Settings.Default.Save(); Synthesizer.InterpolationMode = (InterpolationEnum)Properties.Settings.Default.Interp; //dispose of event handlers sthread.Provider.TimeUpdate -= new SynthWaveProvider.UpdateTime(pctrl.updateTime); if (mctrol.Visible == true) sthread.Provider.UpdateMidiControllers -= new SynthWaveProvider.UpdateTrackBars(mctrol.updateMidiControls); //create new object with new event handlers sthread = new SynthThread(); sthread.Provider.TimeUpdate += new SynthWaveProvider.UpdateTime(pctrl.updateTime); if (mctrol.Visible == true) sthread.Provider.UpdateMidiControllers += new SynthWaveProvider.UpdateTrackBars(mctrol.updateMidiControls); if (File.Exists(Properties.Settings.Default.BankFile)) { sthread.LoadBank(Properties.Settings.Default.BankFile); kctrl.updateBankList(sthread.getProgramNames(kctrl.GetBank())); } } }