예제 #1
0
        private void openBankFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Properties.Settings.Default.bank_path;
            openFileDialog.Filter           = "Bank Files (*.bank)|*.bank|SF2 (*.sf2)|*.sf2|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK && File.Exists(openFileDialog.FileName))
            {
                Properties.Settings.Default.BankFile = openFileDialog.FileName;
                Properties.Settings.Default.Save();
                sthread.LoadBank(Properties.Settings.Default.BankFile);
                kctrl.updateBankList(sthread.getProgramNames(kctrl.GetBank()));
                updatetoolstripdisplay();
            }
            try
            {
                if (Directory.Exists(openFileDialog.FileName))
                {
                    Properties.Settings.Default.bank_path = openFileDialog.FileName;
                }
                else if (Directory.Exists(Path.GetDirectoryName(openFileDialog.FileName)))
                {
                    Properties.Settings.Default.bank_path = Path.GetDirectoryName(openFileDialog.FileName);
                }
            }
            catch (ArgumentException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
예제 #2
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     Synthesizer.InterpolationMode = (InterpolationEnum)Properties.Settings.Default.Interp;
     sthread = new SynthThread();
     sthread.Provider.TimeUpdate += new SynthWaveProvider.UpdateTime(pctrl.updateTime);
     if (File.Exists(Properties.Settings.Default.BankFile))
     {
         sthread.LoadBank(Properties.Settings.Default.BankFile);
         kctrl.updateBankList(sthread.getProgramNames(kctrl.GetBank()));
     }
     playListToolStripMenuItem.Checked     = Properties.Settings.Default.show_plist;
     midiControlsToolStripMenuItem.Checked = Properties.Settings.Default.show_mctrl;
     logToolStripMenuItem.Checked          = Properties.Settings.Default.show_log;
     keyBoardToolStripMenuItem.Checked     = Properties.Settings.Default.show_keyboard;
     updatetoolstripdisplay();
 }
예제 #3
0
        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()));
         }
     }
 }
 private void MainForm_Load(object sender, EventArgs e)
 {
     Synthesizer.InterpolationMode = (InterpolationEnum)Properties.Settings.Default.Interp;
     sthread = new SynthThread();
     sthread.Provider.TimeUpdate += new SynthWaveProvider.UpdateTime(pctrl.updateTime);
     if (File.Exists(Properties.Settings.Default.BankFile))
     {
         sthread.LoadBank(Properties.Settings.Default.BankFile);
         kctrl.updateBankList(sthread.getProgramNames(kctrl.GetBank()));
     }
     playListToolStripMenuItem.Checked = Properties.Settings.Default.show_plist;
     midiControlsToolStripMenuItem.Checked = Properties.Settings.Default.show_mctrl;
     logToolStripMenuItem.Checked = Properties.Settings.Default.show_log;
     keyBoardToolStripMenuItem.Checked = Properties.Settings.Default.show_keyboard;
     updatetoolstripdisplay();
 }