diff --git a/.gitignore b/.gitignore index 07bd45e6..638c872a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.suo *.suo *.tmp -keppydrvcfg2/ /*.dll /*.exe /*.opensdf @@ -11,8 +10,8 @@ keppydrvcfg2/ /*.user /*.vcxproj.user /Debug -/Release -/ipch +/KeppyDriverConfigurator/KeppyDriverConfigurator/bin +/KeppyDriverConfigurator/KeppyDriverConfigurator/obj /KeppyDrv/*.dll /KeppyDrv/*.exe /KeppyDrv/*.exp @@ -49,12 +48,11 @@ keppydrvcfg2/ /KeppyDrvWasapi/out /KeppyDrvWasapi/output /KeppyDrvWasapi/x64 +/Release +/ipch /keppydrvconfig -/KeppyDriverConfigurator/KeppyDriverConfigurator/bin -/KeppyDriverConfigurator/KeppyDriverConfigurator/obj /output/*.config /output/*.dll -/output/*.exe /output/*.manifest /output/*.pdb /output/*.xml @@ -73,4 +71,7 @@ README.txt git_ver.h keppydrv.exe keppydrvcfg2.v12.suo -keppydrvcfg2.v12.suo \ No newline at end of file +keppydrvcfg2.v12.suo +keppydrvcfg2/ +output/KeppyDriverConfigurator.exe +output/KeppyDriverConfigurator.vshost.exe \ No newline at end of file diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/App.config b/KeppyDriverConfigurator/KeppyDriverConfigurator/App.config index 343984d0..72a71af9 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/App.config +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/App.config @@ -2,5 +2,5 @@ - + diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfigurator.csproj b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfigurator.csproj index 42820985..423e1b79 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfigurator.csproj +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfigurator.csproj @@ -9,7 +9,7 @@ Properties KeppyDriverConfigurator KeppyDriverConfigurator - v2.0 + v4.0 512 publish\ @@ -90,18 +90,18 @@ KeppyDriverInformation.cs - - Form - - - KeppyDriverMIDIOutSelectorWin.cs - Form KeppyDriverOutputWAVDir.cs + + Form + + + KeppyDriverUpdater.cs + @@ -124,12 +124,12 @@ KeppyDriverInformation.cs - - KeppyDriverMIDIOutSelectorWin.cs - KeppyDriverOutputWAVDir.cs + + KeppyDriverUpdater.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.Designer.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.Designer.cs index 5bb7538a..515146ce 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.Designer.cs +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.Designer.cs @@ -114,6 +114,7 @@ private void InitializeComponent() this.openTheBlacklistManagerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.changeDefaultMIDIOutDeviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.changeDefault64bitMIDIOutDeviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -134,6 +135,7 @@ private void InitializeComponent() this.SoundfontImport = new System.Windows.Forms.OpenFileDialog(); this.ExternalListImport = new System.Windows.Forms.OpenFileDialog(); this.ExportList = new System.Windows.Forms.SaveFileDialog(); + this.changeDefaultMIDIOutDeviceToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.TabsForTheControls.SuspendLayout(); this.List1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.SFZComp1)).BeginInit(); @@ -1237,7 +1239,9 @@ private void InitializeComponent() this.openDebugWindowToolStripMenuItem, this.openTheBlacklistManagerToolStripMenuItem, this.toolStripSeparator3, + this.changeDefaultMIDIOutDeviceToolStripMenuItem1, this.changeDefaultMIDIOutDeviceToolStripMenuItem, + this.changeDefault64bitMIDIOutDeviceToolStripMenuItem, this.toolStripSeparator1, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; @@ -1247,38 +1251,45 @@ private void InitializeComponent() // openDebugWindowToolStripMenuItem // this.openDebugWindowToolStripMenuItem.Name = "openDebugWindowToolStripMenuItem"; - this.openDebugWindowToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.openDebugWindowToolStripMenuItem.Size = new System.Drawing.Size(275, 22); this.openDebugWindowToolStripMenuItem.Text = "Open debug window"; this.openDebugWindowToolStripMenuItem.Click += new System.EventHandler(this.openDebugWindowToolStripMenuItem_Click); // // openTheBlacklistManagerToolStripMenuItem // this.openTheBlacklistManagerToolStripMenuItem.Name = "openTheBlacklistManagerToolStripMenuItem"; - this.openTheBlacklistManagerToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.openTheBlacklistManagerToolStripMenuItem.Size = new System.Drawing.Size(275, 22); this.openTheBlacklistManagerToolStripMenuItem.Text = "Open the blacklist manager"; this.openTheBlacklistManagerToolStripMenuItem.Click += new System.EventHandler(this.openTheBlacklistManagerToolStripMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(238, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(272, 6); // // changeDefaultMIDIOutDeviceToolStripMenuItem // this.changeDefaultMIDIOutDeviceToolStripMenuItem.Name = "changeDefaultMIDIOutDeviceToolStripMenuItem"; - this.changeDefaultMIDIOutDeviceToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.changeDefaultMIDIOutDeviceToolStripMenuItem.Text = "Change default MIDI out device"; - this.changeDefaultMIDIOutDeviceToolStripMenuItem.Click += new System.EventHandler(this.changeDefaultMIDIOutDeviceToolStripMenuItem_Click); + this.changeDefaultMIDIOutDeviceToolStripMenuItem.Size = new System.Drawing.Size(275, 22); + this.changeDefaultMIDIOutDeviceToolStripMenuItem.Text = "Change default 32-bit MIDI out device"; + this.changeDefaultMIDIOutDeviceToolStripMenuItem.Click += new System.EventHandler(this.changeDefault32bitMIDIOutDeviceToolStripMenuItem_Click); + // + // changeDefault64bitMIDIOutDeviceToolStripMenuItem + // + this.changeDefault64bitMIDIOutDeviceToolStripMenuItem.Name = "changeDefault64bitMIDIOutDeviceToolStripMenuItem"; + this.changeDefault64bitMIDIOutDeviceToolStripMenuItem.Size = new System.Drawing.Size(275, 22); + this.changeDefault64bitMIDIOutDeviceToolStripMenuItem.Text = "Change default 64-bit MIDI out device"; + this.changeDefault64bitMIDIOutDeviceToolStripMenuItem.Click += new System.EventHandler(this.changeDefault64bitMIDIOutDeviceToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(238, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(272, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(275, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -1413,6 +1424,13 @@ private void InitializeComponent() // this.ExportList.Filter = "Soundfont list (.sflist)|*.sflist|Text file (.txt)|*.txt"; // + // changeDefaultMIDIOutDeviceToolStripMenuItem1 + // + this.changeDefaultMIDIOutDeviceToolStripMenuItem1.Name = "changeDefaultMIDIOutDeviceToolStripMenuItem1"; + this.changeDefaultMIDIOutDeviceToolStripMenuItem1.Size = new System.Drawing.Size(275, 22); + this.changeDefaultMIDIOutDeviceToolStripMenuItem1.Text = "Change default MIDI out device"; + this.changeDefaultMIDIOutDeviceToolStripMenuItem1.Click += new System.EventHandler(this.changeDefaultMIDIOutDeviceToolStripMenuItem1_Click); + // // KeppyDriverConfiguratorMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1574,6 +1592,8 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem howCanIResetTheDriverToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem whatsTheBestSettingsForTheBufferToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem changeDefault64bitMIDIOutDeviceToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem changeDefaultMIDIOutDeviceToolStripMenuItem1; } } diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.cs index e9d395ec..783b2bb9 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.cs +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.cs @@ -31,6 +31,11 @@ public KeppyDriverConfiguratorMain(String[] args) } // Just stuff to reduce code's length + private void SFZCompliant() + { + MessageBox.Show("This driver is \"SFZ format 2.0\" compliant.", "SFZ format support", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + private void ReinitializeList(Exception ex, ListBox selectedlist, String selectedlistpath) { try @@ -94,6 +99,178 @@ private void SaveList(String SelectedList, ListBox OriginalList) } } + private void AddSoundfont(String SelectedList, ListBox OriginalList) + { + try + { + SoundfontImport.FileName = ""; + if (SoundfontImport.ShowDialog() == DialogResult.OK) + { + foreach (string str in SoundfontImport.FileNames) + { + if (Path.GetExtension(str) == ".sf2" | Path.GetExtension(str) == ".SF2" | Path.GetExtension(str) == ".sfpack" | Path.GetExtension(str) == ".SFPACK") + { + OriginalList.Items.Add(str); + } + else if (Path.GetExtension(str) == ".sfz" | Path.GetExtension(str) == ".SFZ") + { + using (var form = new BankNPresetSel(Path.GetFileName(str), 0)) + { + var result = form.ShowDialog(); + if (result == DialogResult.OK) + { + string bank = form.BankValueReturn; + string preset = form.PresetValueReturn; + OriginalList.Items.Add("p" + bank + "," + preset + "=0,0|" + str); + } + } + } + else + { + MessageBox.Show(Path.GetFileName(str) + " is not a valid soundfont file!", "Error while adding soundfont", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + SaveList(SelectedList, OriginalList); + } + } + catch (Exception ex) + { + ReinitializeList(ex, OriginalList, SelectedList); + } + } + + private void AddSoundfontDragNDrop(String SelectedList, ListBox OriginalList, DragEventArgs e) + { + string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); + int i; + for (i = 0; i < s.Length; i++) + { + if (Path.GetExtension(s[i]) == ".sf2" | Path.GetExtension(s[i]) == ".SF2" | Path.GetExtension(s[i]) == ".sf3" | Path.GetExtension(s[i]) == ".SF3" | Path.GetExtension(s[i]) == ".sfpack" | Path.GetExtension(s[i]) == ".SFPACK") + { + OriginalList.Items.Add(s[i]); + } + else if (Path.GetExtension(s[i]) == ".sfz" | Path.GetExtension(s[i]) == ".SFZ") + { + using (var form = new BankNPresetSel(Path.GetFileName(s[i]), 1)) + { + var result = form.ShowDialog(); + if (result == DialogResult.OK) + { + string bank = form.BankValueReturn; + string preset = form.PresetValueReturn; + Lis1.Items.Add("p" + bank + "," + preset + "=0,0|" + s[i]); + SaveList(SelectedList, OriginalList); + } + } + } + else if (Path.GetExtension(s[i]) == ".dls" | Path.GetExtension(s[i]) == ".DLS") + { + MessageBox.Show("BASSMIDI does NOT support the downloadable sounds (DLS) format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else if (Path.GetExtension(s[i]) == ".exe" | Path.GetExtension(s[i]) == ".EXE" | Path.GetExtension(s[i]) == ".dll" | Path.GetExtension(s[i]) == ".DLL") + { + MessageBox.Show("Are you really trying to add executables to the soundfonts list?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + MessageBox.Show("Invalid soundfont!\n\nPlease select a valid soundfont and try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + public void AddSoundfontDragNDropTriv(DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.All; + else + e.Effect = DragDropEffects.None; + } + + private void RemoveSoundfont(String SelectedList, ListBox OriginalList) + { + try + { + for (int i = OriginalList.SelectedIndices.Count - 1; i >= 0; i--) + { + OriginalList.Items.RemoveAt(OriginalList.SelectedIndices[i]); + } + SaveList(SelectedList, OriginalList); + } + catch (Exception ex) + { + ReinitializeList(ex, OriginalList, SelectedList); + } + } + + private void MoveUpSoundfont(String SelectedList, ListBox OriginalList) + { + try + { + object selected = OriginalList.SelectedItem; + int indx = OriginalList.Items.IndexOf(selected); + int totl = OriginalList.Items.Count; + if (indx == 0) + { + OriginalList.Items.Remove(selected); + OriginalList.Items.Insert(totl - 1, selected); + OriginalList.SetSelected(totl - 1, true); + } + else + { + OriginalList.Items.Remove(selected); + OriginalList.Items.Insert(indx - 1, selected); + OriginalList.SetSelected(indx - 1, true); + } + SaveList(SelectedList, OriginalList); + } + catch (Exception ex) + { + ReinitializeList(ex, OriginalList, SelectedList); + } + } + + private void MoveDownSoundfont(String SelectedList, ListBox OriginalList) + { + try + { + object selected = OriginalList.SelectedItem; + int indx = OriginalList.Items.IndexOf(selected); + int totl = OriginalList.Items.Count; + if (indx == totl - 1) + { + OriginalList.Items.Remove(selected); + OriginalList.Items.Insert(0, selected); + OriginalList.SetSelected(0, true); + } + else + { + OriginalList.Items.Remove(selected); + OriginalList.Items.Insert(indx + 1, selected); + OriginalList.SetSelected(indx + 1, true); + } + SaveList(SelectedList, OriginalList); + } + catch (Exception ex) + { + ReinitializeList(ex, OriginalList, SelectedList); + } + } + + private void CleanList(String SelectedList, ListBox OriginalList) + { + try + { + OriginalList.Items.Clear(); + File.Delete(SelectedList); + var TempFile = File.Create(SelectedList); + TempFile.Close(); + } + catch (Exception ex) + { + ReinitializeList(ex, OriginalList, SelectedList); + } + } + private void SaveSettings() { try @@ -200,13 +377,30 @@ private void SaveSettings() private void KeppyDriverConfiguratorMain_Load(object sender, EventArgs e) { // MIDI out selector disabler - Version win8version = new Version(6, 2, 9200, 0); + Version win10version = new Version(10, 0, 0, 0); if (Environment.OSVersion.Platform == PlatformID.Win32NT && - Environment.OSVersion.Version >= win8version) + Environment.OSVersion.Version >= win10version) { changeDefaultMIDIOutDeviceToolStripMenuItem.Visible = false; + changeDefault64bitMIDIOutDeviceToolStripMenuItem.Visible = false; + changeDefaultMIDIOutDeviceToolStripMenuItem1.Visible = false; toolStripSeparator1.Visible = false; } + else + { + if (Environment.Is64BitOperatingSystem == false) + { + changeDefaultMIDIOutDeviceToolStripMenuItem1.Visible = true; + changeDefaultMIDIOutDeviceToolStripMenuItem.Visible = false; + changeDefault64bitMIDIOutDeviceToolStripMenuItem.Visible = false; + } + else if (Environment.Is64BitOperatingSystem == true) + { + changeDefaultMIDIOutDeviceToolStripMenuItem1.Visible = false; + changeDefaultMIDIOutDeviceToolStripMenuItem.Visible = true; + changeDefault64bitMIDIOutDeviceToolStripMenuItem.Visible = true; + } + } // Initialize the four list paths List1Path = Environment.GetEnvironmentVariable("LocalAppData") + "\\Keppy's Driver\\lists\\keppymidi.sflist"; @@ -286,829 +480,283 @@ private void KeppyDriverConfiguratorMain_Load(object sender, EventArgs e) File.Create(List4Path).Dispose(); } MessageBox.Show("One of the soundfont lists were missing, so the configurator automatically restored them.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - catch (Exception ex) - { - MessageBox.Show("Fatal error during the execution of the program.\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand); - } - - - // ======= Load settings from the registry - try - { - // First, the most important settings - RegistryKey Settings = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Keppy's Driver\\Settings", true); - VolTrackBar.Value = Convert.ToInt32(Settings.GetValue("volume")); - PolyphonyLimit.Value = Convert.ToInt32(Settings.GetValue("polyphony")); - if (Settings.GetValue("cpu").ToString() == "0") - { - MaxCPU.Text = "Disabled"; - } - else - { - MaxCPU.Text = Settings.GetValue("cpu").ToString(); - } - Frequency.Text = Settings.GetValue("frequency").ToString(); - TracksLimit.Value = Convert.ToInt32(Settings.GetValue("tracks")); - - // Then the filthy checkboxes - if (Convert.ToInt32(Settings.GetValue("preload")) == 1) - { - Preload.Checked = true; - } - else - { - Preload.Checked = false; - } - if (Convert.ToInt32(Settings.GetValue("nofx")) == 1) - { - DisableSFX.Checked = true; - } - else - { - DisableSFX.Checked = false; - } - if (Convert.ToInt32(Settings.GetValue("noteoff")) == 1) - { - NoteOffCheck.Checked = true; - } - else - { - NoteOffCheck.Checked = false; - } - if (Convert.ToInt32(Settings.GetValue("sinc")) == 1) - { - SincInter.Checked = true; - } - else - { - SincInter.Checked = false; - } - if (Convert.ToInt32(Settings.GetValue("sysresetignore")) == 1) - { - SysResetIgnore.Checked = true; - } - else - { - SysResetIgnore.Checked = false; - } - if (Convert.ToInt32(Settings.GetValue("encmode")) == 1) - { - OutputWAV.Checked = true; - } - else - { - OutputWAV.Checked = false; - } - if (Environment.OSVersion.Version.Major == 5) - { - XAudioDisable.Checked = true; - XAudioDisable.Enabled = false; - } - else - { - if (Convert.ToInt32(Settings.GetValue("xaudiodisabled")) == 1) - { - XAudioDisable.Checked = true; - VMSEmu.Visible = true; - if (Convert.ToInt32(Settings.GetValue("vmsemu")) == 1) - { - VMSEmu.Checked = true; - } - else - { - VMSEmu.Checked = false; - } - } - else - { - XAudioDisable.Checked = false; - VMSEmu.Visible = false; - } - } - - // LEL - bufsize.Value = Convert.ToInt32(Settings.GetValue("buflen")); - - // And finally, the volume! - int VolumeValue = Convert.ToInt32(Settings.GetValue("volume")); - double x = VolumeValue / 100; - VolSimView.Text = x.ToString("000\\%"); - VolIntView.Text = "Volume in 32-bit integer: " + VolumeValue.ToString("00000") + " (" + (VolumeValue / 100).ToString("000") + "%)"; - VolTrackBar.Value = VolumeValue; - } - catch (Exception ex) - { - MessageBox.Show("Can not read settings from the registry!\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand); - } - } - - private void VolTrackBar_Scroll(object sender, EventArgs e) - { - try - { - RegistryKey Settings = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Keppy's Driver\\Settings", true); - int VolumeValue = 0; - double x = VolTrackBar.Value / 100; - VolumeValue = Convert.ToInt32(x); - VolSimView.Text = VolumeValue.ToString("000\\%"); - VolIntView.Text = "Volume in 32-bit integer: " + VolTrackBar.Value.ToString("00000") + " (" + (VolTrackBar.Value / 100).ToString("000") + "%)"; - Settings.SetValue("volume", VolTrackBar.Value.ToString(), RegistryValueKind.DWord); - } - catch - { - - } - } - - private void AddSF1_Click(object sender, EventArgs e) - { - try - { - SoundfontImport.FileName = ""; - if (SoundfontImport.ShowDialog() == DialogResult.OK) - { - foreach (string str in SoundfontImport.FileNames) - { - if (Path.GetExtension(str) == ".sf2" | Path.GetExtension(str) == ".SF2" | Path.GetExtension(str) == ".sfpack" | Path.GetExtension(str) == ".SFPACK") - { - Lis1.Items.Add(str); - } - else if (Path.GetExtension(str) == ".sfz" | Path.GetExtension(str) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(str), 0)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis1.Items.Add("p" + bank + "," + preset + "=0,0|" + str); - } - } - } - else - { - MessageBox.Show(Path.GetFileName(str) + " is not a valid soundfont file!", "Error while adding soundfont", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - SaveList(List1Path, Lis1); - } - } - catch (Exception ex) - { - ReinitializeList(ex, Lis1, List1Path); - } - } - - private void AddSF2_Click(object sender, EventArgs e) - { - try - { - SoundfontImport.FileName = ""; - if (SoundfontImport.ShowDialog() == DialogResult.OK) - { - foreach (string str in SoundfontImport.FileNames) - { - if (Path.GetExtension(str) == ".sf2" | Path.GetExtension(str) == ".SF2" | Path.GetExtension(str) == ".sfpack" | Path.GetExtension(str) == ".SFPACK") - { - Lis2.Items.Add(str); - } - else if (Path.GetExtension(str) == ".sfz" | Path.GetExtension(str) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(str), 0)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis2.Items.Add("p" + bank + "," + preset + "=0,0|" + str); - } - } - } - else - { - MessageBox.Show(Path.GetFileName(str) + " is not a valid soundfont file!", "Error while adding soundfont", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - SaveList(List2Path, Lis2); - } - } - catch (Exception ex) - { - ReinitializeList(ex, Lis2, List2Path); - } - } - - private void AddSF3_Click(object sender, EventArgs e) - { - try - { - SoundfontImport.FileName = ""; - if (SoundfontImport.ShowDialog() == DialogResult.OK) - { - foreach (string str in SoundfontImport.FileNames) - { - if (Path.GetExtension(str) == ".sf2" | Path.GetExtension(str) == ".SF2" | Path.GetExtension(str) == ".sfpack" | Path.GetExtension(str) == ".SFPACK") - { - Lis3.Items.Add(str); - } - else if (Path.GetExtension(str) == ".sfz" | Path.GetExtension(str) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(str), 0)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis3.Items.Add("p" + bank + "," + preset + "=0,0|" + str); - } - } - } - else - { - MessageBox.Show(Path.GetFileName(str) + " is not a valid soundfont file!", "Error while adding soundfont", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - SaveList(List3Path, Lis3); - } - } - catch (Exception ex) - { - ReinitializeList(ex, Lis3, List3Path); - } - } - - private void AddSF4_Click(object sender, EventArgs e) - { - try - { - SoundfontImport.FileName = ""; - if (SoundfontImport.ShowDialog() == DialogResult.OK) - { - foreach (string str in SoundfontImport.FileNames) - { - if (Path.GetExtension(str) == ".sf2" | Path.GetExtension(str) == ".SF2" | Path.GetExtension(str) == ".sfpack" | Path.GetExtension(str) == ".SFPACK") - { - Lis4.Items.Add(str); - } - else if (Path.GetExtension(str) == ".sfz" | Path.GetExtension(str) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(str), 0)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis4.Items.Add("p" + bank + "," + preset + "=0,0|" + str); - } - } - } - else - { - MessageBox.Show(Path.GetFileName(str) + " is not a valid soundfont file!", "Error while adding soundfont", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - SaveList(List4Path, Lis4); - } - } - catch (Exception ex) - { - ReinitializeList(ex, Lis4, List4Path); - } - } - - private void RmvSF1_Click(object sender, EventArgs e) - { - try - { - for (int i = Lis1.SelectedIndices.Count - 1; i >= 0; i--) - { - Lis1.Items.RemoveAt(Lis1.SelectedIndices[i]); - } - SaveList(List1Path, Lis1); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis1, List1Path); - } - } - - private void RmvSF2_Click(object sender, EventArgs e) - { - try - { - for (int i = Lis2.SelectedIndices.Count - 1; i >= 0; i--) - { - Lis2.Items.RemoveAt(Lis2.SelectedIndices[i]); - } - SaveList(List2Path, Lis2); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis2, List2Path); - } - } - - private void RmvSF3_Click(object sender, EventArgs e) - { - try - { - for (int i = Lis3.SelectedIndices.Count - 1; i >= 0; i--) - { - Lis3.Items.RemoveAt(Lis3.SelectedIndices[i]); - } - SaveList(List3Path, Lis3); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis3, List3Path); - } - } - - private void RmvSF4_Click(object sender, EventArgs e) - { - try - { - for (int i = Lis4.SelectedIndices.Count - 1; i >= 0; i--) - { - Lis4.Items.RemoveAt(Lis4.SelectedIndices[i]); - } - SaveList(List4Path, Lis4); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis4, List4Path); - } - } - - private void Lis1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) - { - string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); - int i; - for (i = 0; i < s.Length; i++) - { - if (Path.GetExtension(s[i]) == ".sf2" | Path.GetExtension(s[i]) == ".SF2" | Path.GetExtension(s[i]) == ".sf3" | Path.GetExtension(s[i]) == ".SF3" | Path.GetExtension(s[i]) == ".sfpack" | Path.GetExtension(s[i]) == ".SFPACK") - { - Lis1.Items.Add(s[i]); - } - else if (Path.GetExtension(s[i]) == ".sfz" | Path.GetExtension(s[i]) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(s[i]), 1)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis1.Items.Add("p" + bank + "," + preset + "=0,0|" + s[i]); - SaveList(List1Path, Lis1); - } - } - } - else if (Path.GetExtension(s[i]) == ".dls" | Path.GetExtension(s[i]) == ".DLS") - { - MessageBox.Show("BASSMIDI does NOT support the downloadable sounds (DLS) format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else if (Path.GetExtension(s[i]) == ".exe" | Path.GetExtension(s[i]) == ".EXE" | Path.GetExtension(s[i]) == ".dll" | Path.GetExtension(s[i]) == ".DLL") - { - MessageBox.Show("Are you really trying to add executables to the soundfonts list?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - MessageBox.Show("Invalid soundfont!\n\nPlease select a valid soundfont and try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - - private void Lis1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.All; - else - e.Effect = DragDropEffects.None; - } - - private void Lis2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) - { - string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); - int i; - for (i = 0; i < s.Length; i++) - { - if (Path.GetExtension(s[i]) == ".sf2" | Path.GetExtension(s[i]) == ".SF2" | Path.GetExtension(s[i]) == ".sf3" | Path.GetExtension(s[i]) == ".SF3" | Path.GetExtension(s[i]) == ".sfpack" | Path.GetExtension(s[i]) == ".SFPACK") - { - Lis2.Items.Add(s[i]); - } - else if (Path.GetExtension(s[i]) == ".sfz" | Path.GetExtension(s[i]) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(s[i]), 1)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis2.Items.Add("p" + bank + "," + preset + "=0,0|" + s[i]); - SaveList(List2Path, Lis2); - } - } - } - else if (Path.GetExtension(s[i]) == ".dls" | Path.GetExtension(s[i]) == ".DLS") - { - MessageBox.Show("BASSMIDI does NOT support the downloadable sounds (DLS) format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else if (Path.GetExtension(s[i]) == ".exe" | Path.GetExtension(s[i]) == ".EXE" | Path.GetExtension(s[i]) == ".dll" | Path.GetExtension(s[i]) == ".DLL") - { - MessageBox.Show("Are you really trying to add executables to the soundfonts list?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - MessageBox.Show("Invalid soundfont!\n\nPlease select a valid soundfont and try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - - private void Lis2_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.All; - else - e.Effect = DragDropEffects.None; - } - - private void Lis3_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) - { - string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); - int i; - for (i = 0; i < s.Length; i++) - { - if (Path.GetExtension(s[i]) == ".sf2" | Path.GetExtension(s[i]) == ".SF2" | Path.GetExtension(s[i]) == ".sf3" | Path.GetExtension(s[i]) == ".SF3" | Path.GetExtension(s[i]) == ".sfpack" | Path.GetExtension(s[i]) == ".SFPACK") - { - Lis3.Items.Add(s[i]); - } - else if (Path.GetExtension(s[i]) == ".sfz" | Path.GetExtension(s[i]) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(s[i]), 1)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis3.Items.Add("p" + bank + "," + preset + "=0,0|" + s[i]); - SaveList(List3Path, Lis3); - } - } - } - else if (Path.GetExtension(s[i]) == ".dls" | Path.GetExtension(s[i]) == ".DLS") - { - MessageBox.Show("BASSMIDI does NOT support the downloadable sounds (DLS) format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else if (Path.GetExtension(s[i]) == ".exe" | Path.GetExtension(s[i]) == ".EXE" | Path.GetExtension(s[i]) == ".dll" | Path.GetExtension(s[i]) == ".DLL") - { - MessageBox.Show("Are you really trying to add executables to the soundfonts list?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - MessageBox.Show("Invalid soundfont!\n\nPlease select a valid soundfont and try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - - private void Lis3_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.All; - else - e.Effect = DragDropEffects.None; - } - - private void Lis4_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) - { - string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); - int i; - for (i = 0; i < s.Length; i++) - { - if (Path.GetExtension(s[i]) == ".sf2" | Path.GetExtension(s[i]) == ".SF2" | Path.GetExtension(s[i]) == ".sf3" | Path.GetExtension(s[i]) == ".SF3" | Path.GetExtension(s[i]) == ".sfpack" | Path.GetExtension(s[i]) == ".SFPACK") - { - Lis4.Items.Add(s[i]); - } - else if (Path.GetExtension(s[i]) == ".sfz" | Path.GetExtension(s[i]) == ".SFZ") - { - using (var form = new BankNPresetSel(Path.GetFileName(s[i]), 1)) - { - var result = form.ShowDialog(); - if (result == DialogResult.OK) - { - string bank = form.BankValueReturn; - string preset = form.PresetValueReturn; - Lis4.Items.Add("p" + bank + "," + preset + "=0,0|" + s[i]); - SaveList(List4Path, Lis4); - } - } - } - else if (Path.GetExtension(s[i]) == ".dls" | Path.GetExtension(s[i]) == ".DLS") - { - MessageBox.Show("BASSMIDI does NOT support the downloadable sounds (DLS) format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else if (Path.GetExtension(s[i]) == ".exe" | Path.GetExtension(s[i]) == ".EXE" | Path.GetExtension(s[i]) == ".dll" | Path.GetExtension(s[i]) == ".DLL") - { - MessageBox.Show("Are you really trying to add executables to the soundfonts list?", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - else - { - MessageBox.Show("Invalid soundfont!\n\nPlease select a valid soundfont and try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } - } - - private void Lis4_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - e.Effect = DragDropEffects.All; - else - e.Effect = DragDropEffects.None; - } + catch (Exception ex) + { + MessageBox.Show("Fatal error during the execution of the program.\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand); + } - private void MvU1_Click(object sender, EventArgs e) - { + // ======= Load settings from the registry try { - object selected = Lis1.SelectedItem; - int indx = Lis1.Items.IndexOf(selected); - int totl = Lis1.Items.Count; - if (indx == 0) + // First, the most important settings + RegistryKey Settings = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Keppy's Driver\\Settings", true); + VolTrackBar.Value = Convert.ToInt32(Settings.GetValue("volume")); + PolyphonyLimit.Value = Convert.ToInt32(Settings.GetValue("polyphony")); + if (Settings.GetValue("cpu").ToString() == "0") { - Lis1.Items.Remove(selected); - Lis1.Items.Insert(totl - 1, selected); - Lis1.SetSelected(totl - 1, true); + MaxCPU.Text = "Disabled"; } else { - Lis1.Items.Remove(selected); - Lis1.Items.Insert(indx - 1, selected); - Lis1.SetSelected(indx - 1, true); + MaxCPU.Text = Settings.GetValue("cpu").ToString(); } - SaveList(List1Path, Lis1); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis1, List1Path); - } - } + Frequency.Text = Settings.GetValue("frequency").ToString(); + TracksLimit.Value = Convert.ToInt32(Settings.GetValue("tracks")); - private void MvU2_Click(object sender, EventArgs e) - { - try - { - object selected = Lis2.SelectedItem; - int indx = Lis2.Items.IndexOf(selected); - int totl = Lis2.Items.Count; - if (indx == 0) + // Then the filthy checkboxes + if (Convert.ToInt32(Settings.GetValue("preload")) == 1) { - Lis2.Items.Remove(selected); - Lis2.Items.Insert(totl - 1, selected); - Lis2.SetSelected(totl - 1, true); + Preload.Checked = true; } else { - Lis2.Items.Remove(selected); - Lis2.Items.Insert(indx - 1, selected); - Lis2.SetSelected(indx - 1, true); + Preload.Checked = false; } - SaveList(List2Path, Lis2); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis2, List2Path); - } - } - - private void MvU3_Click(object sender, EventArgs e) - { - try - { - object selected = Lis3.SelectedItem; - int indx = Lis3.Items.IndexOf(selected); - int totl = Lis3.Items.Count; - if (indx == 0) + if (Convert.ToInt32(Settings.GetValue("nofx")) == 1) { - Lis3.Items.Remove(selected); - Lis3.Items.Insert(totl - 1, selected); - Lis3.SetSelected(totl - 1, true); + DisableSFX.Checked = true; } else { - Lis3.Items.Remove(selected); - Lis3.Items.Insert(indx - 1, selected); - Lis3.SetSelected(indx - 1, true); + DisableSFX.Checked = false; } - SaveList(List3Path, Lis3); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis3, List3Path); - } - } - - private void MvU4_Click(object sender, EventArgs e) - { - try - { - object selected = Lis4.SelectedItem; - int indx = Lis4.Items.IndexOf(selected); - int totl = Lis4.Items.Count; - if (indx == 0) + if (Convert.ToInt32(Settings.GetValue("noteoff")) == 1) { - Lis4.Items.Remove(selected); - Lis4.Items.Insert(totl - 1, selected); - Lis4.SetSelected(totl - 1, true); + NoteOffCheck.Checked = true; } else { - Lis4.Items.Remove(selected); - Lis4.Items.Insert(indx - 1, selected); - Lis4.SetSelected(indx - 1, true); + NoteOffCheck.Checked = false; } - SaveList(List4Path, Lis4); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis4, List4Path); - } - } - - private void MvD1_Click(object sender, EventArgs e) - { - try - { - object selected = Lis1.SelectedItem; - int indx = Lis1.Items.IndexOf(selected); - int totl = Lis1.Items.Count; - if (indx == totl - 1) + if (Convert.ToInt32(Settings.GetValue("sinc")) == 1) { - Lis1.Items.Remove(selected); - Lis1.Items.Insert(0, selected); - Lis1.SetSelected(0, true); + SincInter.Checked = true; } else { - Lis1.Items.Remove(selected); - Lis1.Items.Insert(indx + 1, selected); - Lis1.SetSelected(indx + 1, true); + SincInter.Checked = false; } - SaveList(List1Path, Lis1); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis1, List1Path); - } - } - - private void MvD2_Click(object sender, EventArgs e) - { - try - { - object selected = Lis2.SelectedItem; - int indx = Lis2.Items.IndexOf(selected); - int totl = Lis2.Items.Count; - if (indx == totl - 1) + if (Convert.ToInt32(Settings.GetValue("sysresetignore")) == 1) { - Lis2.Items.Remove(selected); - Lis2.Items.Insert(0, selected); - Lis2.SetSelected(0, true); + SysResetIgnore.Checked = true; } else { - Lis2.Items.Remove(selected); - Lis2.Items.Insert(indx + 1, selected); - Lis2.SetSelected(indx + 1, true); + SysResetIgnore.Checked = false; } - SaveList(List2Path, Lis2); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis2, List2Path); - } - } - - private void MvD3_Click(object sender, EventArgs e) - { - try - { - object selected = Lis3.SelectedItem; - int indx = Lis3.Items.IndexOf(selected); - int totl = Lis3.Items.Count; - if (indx == totl - 1) + if (Convert.ToInt32(Settings.GetValue("encmode")) == 1) { - Lis3.Items.Remove(selected); - Lis3.Items.Insert(0, selected); - Lis3.SetSelected(0, true); + OutputWAV.Checked = true; } else { - Lis3.Items.Remove(selected); - Lis3.Items.Insert(indx + 1, selected); - Lis3.SetSelected(indx + 1, true); + OutputWAV.Checked = false; } - SaveList(List3Path, Lis3); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis3, List3Path); - } - } - - private void MvD4_Click(object sender, EventArgs e) - { - try - { - object selected = Lis4.SelectedItem; - int indx = Lis4.Items.IndexOf(selected); - int totl = Lis4.Items.Count; - if (indx == totl - 1) + if (Environment.OSVersion.Version.Major == 5) { - Lis4.Items.Remove(selected); - Lis4.Items.Insert(0, selected); - Lis4.SetSelected(0, true); + XAudioDisable.Checked = true; + XAudioDisable.Enabled = false; } else { - Lis4.Items.Remove(selected); - Lis4.Items.Insert(indx + 1, selected); - Lis4.SetSelected(indx + 1, true); + if (Convert.ToInt32(Settings.GetValue("xaudiodisabled")) == 1) + { + XAudioDisable.Checked = true; + VMSEmu.Visible = true; + if (Convert.ToInt32(Settings.GetValue("vmsemu")) == 1) + { + VMSEmu.Checked = true; + } + else + { + VMSEmu.Checked = false; + } + } + else + { + XAudioDisable.Checked = false; + VMSEmu.Visible = false; + } } - SaveList(List4Path, Lis4); + + // LEL + bufsize.Value = Convert.ToInt32(Settings.GetValue("buflen")); + + // And finally, the volume! + int VolumeValue = Convert.ToInt32(Settings.GetValue("volume")); + double x = VolumeValue / 100; + VolSimView.Text = x.ToString("000\\%"); + VolIntView.Text = "Volume in 32-bit integer: " + VolumeValue.ToString("00000") + " (" + (VolumeValue / 100).ToString("000") + "%)"; + VolTrackBar.Value = VolumeValue; } catch (Exception ex) { - ReinitializeList(ex, Lis4, List4Path); + MessageBox.Show("Can not read settings from the registry!\n\nPress OK to quit.\n\n.NET error:\n" + ex.Message.ToString(), "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } - private void CLi1_Click(object sender, EventArgs e) + private void VolTrackBar_Scroll(object sender, EventArgs e) { try { - Lis1.Items.Clear(); - File.Delete(List1Path); - var TempFile = File.Create(List1Path); - TempFile.Close(); + RegistryKey Settings = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Keppy's Driver\\Settings", true); + int VolumeValue = 0; + double x = VolTrackBar.Value / 100; + VolumeValue = Convert.ToInt32(x); + VolSimView.Text = VolumeValue.ToString("000\\%"); + VolIntView.Text = "Volume in 32-bit integer: " + VolTrackBar.Value.ToString("00000") + " (" + (VolTrackBar.Value / 100).ToString("000") + "%)"; + Settings.SetValue("volume", VolTrackBar.Value.ToString(), RegistryValueKind.DWord); } - catch (Exception ex) + catch { - ReinitializeList(ex, Lis1, List1Path); + } } + // ------------------------- + // Soundfont lists functions + + private void AddSF1_Click(object sender, EventArgs e) + { + AddSoundfont(List1Path, Lis1); + } + + private void AddSF2_Click(object sender, EventArgs e) + { + AddSoundfont(List2Path, Lis2); + } + + private void AddSF3_Click(object sender, EventArgs e) + { + AddSoundfont(List3Path, Lis3); + } + + private void AddSF4_Click(object sender, EventArgs e) + { + AddSoundfont(List4Path, Lis4); + } + + private void RmvSF1_Click(object sender, EventArgs e) + { + RemoveSoundfont(List1Path, Lis1); + } + + private void RmvSF2_Click(object sender, EventArgs e) + { + RemoveSoundfont(List2Path, Lis2); + } + + private void RmvSF3_Click(object sender, EventArgs e) + { + RemoveSoundfont(List3Path, Lis3); + } + + private void RmvSF4_Click(object sender, EventArgs e) + { + RemoveSoundfont(List4Path, Lis4); + } + + private void Lis1_DragDrop(object sender, DragEventArgs e) + { + AddSoundfontDragNDrop(List1Path, Lis1, e); + } + + private void Lis1_DragEnter(object sender, DragEventArgs e) + { + AddSoundfontDragNDropTriv(e); + } + + private void Lis2_DragDrop(object sender, DragEventArgs e) + { + AddSoundfontDragNDrop(List2Path, Lis2, e); + } + + private void Lis2_DragEnter(object sender, DragEventArgs e) + { + AddSoundfontDragNDropTriv(e); + } + + private void Lis3_DragDrop(object sender, DragEventArgs e) + { + AddSoundfontDragNDrop(List3Path, Lis3, e); + } + + private void Lis3_DragEnter(object sender, DragEventArgs e) + { + AddSoundfontDragNDropTriv(e); + } + + private void Lis4_DragDrop(object sender, DragEventArgs e) + { + AddSoundfontDragNDrop(List4Path, Lis4, e); + } + + private void Lis4_DragEnter(object sender, DragEventArgs e) + { + AddSoundfontDragNDropTriv(e); + } + + private void MvU1_Click(object sender, EventArgs e) + { + MoveUpSoundfont(List1Path, Lis1); + } + + private void MvU2_Click(object sender, EventArgs e) + { + MoveUpSoundfont(List2Path, Lis2); + } + + private void MvU3_Click(object sender, EventArgs e) + { + MoveUpSoundfont(List3Path, Lis3); + } + + private void MvU4_Click(object sender, EventArgs e) + { + MoveUpSoundfont(List4Path, Lis4); + } + + private void MvD1_Click(object sender, EventArgs e) + { + MoveDownSoundfont(List1Path, Lis1); + } + + private void MvD2_Click(object sender, EventArgs e) + { + MoveDownSoundfont(List2Path, Lis2); + } + + private void MvD3_Click(object sender, EventArgs e) + { + MoveDownSoundfont(List3Path, Lis3); + } + + private void MvD4_Click(object sender, EventArgs e) + { + MoveDownSoundfont(List4Path, Lis4); + } + + private void CLi1_Click(object sender, EventArgs e) + { + CleanList(List1Path, Lis1); + } + private void CLi2_Click(object sender, EventArgs e) { - try - { - Lis2.Items.Clear(); - File.Delete(List2Path); - var TempFile = File.Create(List2Path); - TempFile.Close(); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis2, List2Path); - } + CleanList(List2Path, Lis2); } private void CLi3_Click(object sender, EventArgs e) { - try - { - Lis3.Items.Clear(); - File.Delete(List3Path); - var TempFile = File.Create(List3Path); - TempFile.Close(); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis3, List3Path); - } + CleanList(List3Path, Lis3); } private void CLi4_Click(object sender, EventArgs e) { - try - { - Lis4.Items.Clear(); - File.Delete(List4Path); - var TempFile = File.Create(List4Path); - TempFile.Close(); - } - catch (Exception ex) - { - ReinitializeList(ex, Lis4, List4Path); - } + CleanList(List4Path, Lis4); } @@ -1188,6 +836,9 @@ private void EL4_Click(object sender, EventArgs e) } } + // End of the soundfont lists functions + // ------------------------------------ + private void ApplySettings_Click(object sender, EventArgs e) { // Just save the settings @@ -1266,15 +917,25 @@ private void informationAboutTheDriverToolStripMenuItem_Click(object sender, Eve frm.ShowDialog(); } - private void changeDefaultMIDIOutDeviceToolStripMenuItem_Click(object sender, EventArgs e) + private void changeDefaultMIDIOutDeviceToolStripMenuItem1_Click(object sender, EventArgs e) { - KeppyDriverMIDIOutSelectorWin frm = new KeppyDriverMIDIOutSelectorWin(); - frm.ShowDialog(); + System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\keppydrv\\midioutsetter32.exe"); + } + + private void changeDefault32bitMIDIOutDeviceToolStripMenuItem_Click(object sender, EventArgs e) + { + System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + "\\keppydrv\\midioutsetter32.exe"); + } + + private void changeDefault64bitMIDIOutDeviceToolStripMenuItem_Click(object sender, EventArgs e) + { + System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) + "\\keppydrv\\midioutsetter64.exe"); } private void openUpdaterToolStripMenuItem_Click(object sender, EventArgs e) { - Process.Start("https://github.com/KaleidonKep99/Keppy-s-Driver/releases"); + KeppyDriverUpdater frm = new KeppyDriverUpdater(); + frm.ShowDialog(); } private void reportABugToolStripMenuItem_Click(object sender, EventArgs e) @@ -1338,22 +999,22 @@ private void whatsTheBestSettingsForTheBufferToolStripMenuItem_Click(object send // SFZ compliant part private void SFZComp1_Click(object sender, EventArgs e) { - MessageBox.Show("This driver is \"SFZ format 2.0\" compliant.", "SFZ format support", MessageBoxButtons.OK, MessageBoxIcon.Information); + SFZCompliant(); } private void SFZComp2_Click(object sender, EventArgs e) { - MessageBox.Show("This driver is \"SFZ format 2.0\" compliant.", "SFZ format support", MessageBoxButtons.OK, MessageBoxIcon.Information); + SFZCompliant(); } private void SFZComp3_Click(object sender, EventArgs e) { - MessageBox.Show("This driver is \"SFZ format 2.0\" compliant.", "SFZ format support", MessageBoxButtons.OK, MessageBoxIcon.Information); + SFZCompliant(); } private void SFZComp4_Click(object sender, EventArgs e) { - MessageBox.Show("This driver is \"SFZ format 2.0\" compliant.", "SFZ format support", MessageBoxButtons.OK, MessageBoxIcon.Information); + SFZCompliant(); } // Brand new output mode diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.resx b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.resx index 1746bd85..3c9955a4 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.resx +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverConfiguratorMain.resx @@ -112,27 +112,27 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 - + 127, 17 - + 273, 17 - + 423, 17 - + 64 - + AAABAAkAAAAAAAEAIAAlLAAAlgAAAICAAAABACAAKAgBALssAABgYAAAAQAgAKiUAADjNAEASEgAAAEA diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.Designer.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.Designer.cs index f013762c..219d3477 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.Designer.cs +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.Designer.cs @@ -41,10 +41,10 @@ private void InitializeComponent() // label1 // this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(12, 9); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(58, 25); + this.label1.Size = new System.Drawing.Size(67, 31); this.label1.TabIndex = 0; this.label1.Text = "Voices:"; this.label1.UseCompatibleTextRendering = true; @@ -52,12 +52,12 @@ private void InitializeComponent() // Voices // this.Voices.AutoSize = true; - this.Voices.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Voices.Location = new System.Drawing.Point(76, 9); + this.Voices.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Voices.Location = new System.Drawing.Point(81, 9); this.Voices.Name = "Voices"; - this.Voices.Size = new System.Drawing.Size(30, 25); + this.Voices.Size = new System.Drawing.Size(99, 31); this.Voices.TabIndex = 1; - this.Voices.Text = "1/1"; + this.Voices.Text = "0000/0000"; this.Voices.UseCompatibleTextRendering = true; // // DebugRefresh @@ -69,10 +69,10 @@ private void InitializeComponent() // label2 // this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(12, 34); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(99, 25); + this.label2.Size = new System.Drawing.Size(112, 31); this.label2.TabIndex = 2; this.label2.Text = "CPU usage*:"; this.label2.UseCompatibleTextRendering = true; @@ -80,12 +80,12 @@ private void InitializeComponent() // CPU // this.CPU.AutoSize = true; - this.CPU.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.CPU.Location = new System.Drawing.Point(117, 34); + this.CPU.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.CPU.Location = new System.Drawing.Point(125, 34); this.CPU.Name = "CPU"; - this.CPU.Size = new System.Drawing.Size(30, 25); + this.CPU.Size = new System.Drawing.Size(54, 31); this.CPU.TabIndex = 3; - this.CPU.Text = "1/1"; + this.CPU.Text = "000%"; this.CPU.UseCompatibleTextRendering = true; // // DecodedInt diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.cs index c01a814e..af47656c 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.cs +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverDebugWindow.cs @@ -42,8 +42,25 @@ private void DebugRefresh_Tick(object sender, EventArgs e) RegistryKey Debug = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Keppy's Driver", false); RegistryKey Settings = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Keppy's Driver\\Settings", false); Voices.Text = Convert.ToInt32(Debug.GetValue("currentvoices0")).ToString("0000") + "/" + Convert.ToInt32(Settings.GetValue("polyphony")).ToString("0000"); - CPU.Text = (Convert.ToInt32(Debug.GetValue("currentcpuusage0")) * 1.125).ToString("000") + "%"; // With a little overhead, for the real CPU usage. - DecodedInt.Text = "Decoded data size: " + Debug.GetValue("int") +" frames (Int32 value)"; + if (Convert.ToInt32(Settings.GetValue("encmode")) == 1) + { + CPU.Text = "Unavailable"; + } + else + { + CPU.Text = (Convert.ToInt32(Debug.GetValue("currentcpuusage0"))).ToString("000") + "%"; + } + if (Convert.ToInt32(Settings.GetValue("xaudiodisabled")) == 1) + { + DecodedInt.Visible = false; + DecodedInt.Text = ""; + } + else + { + DecodedInt.Visible = true; + DecodedInt.Text = "Decoded data size: " + Debug.GetValue("int") + " frames (Int32 value)"; + } + } catch (Exception ex) { diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverInformation.resx b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverInformation.resx index c1e27549..330d1d7f 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverInformation.resx +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverInformation.resx @@ -112,14 +112,14 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Keppy's Driver is a direct for of the original BASSMIDI Driver by -Brad Mille and Chris Moeller. +Brad Miller and Chris Moeller. Copyright (c) 2011-2016 Brad Miller, Chris Moeller and Riccardo Loi All rights reserved. diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.Designer.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.Designer.cs deleted file mode 100644 index 041b13ec..00000000 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.Designer.cs +++ /dev/null @@ -1,133 +0,0 @@ -namespace KeppyDriverConfigurator -{ - partial class KeppyDriverMIDIOutSelectorWin - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.lvwOutputs = new System.Windows.Forms.ListView(); - this.clmName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.clmID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.lblOutputDevices = new System.Windows.Forms.Label(); - this.btnSetAsDefault = new System.Windows.Forms.Button(); - this.backgroundWorker = new System.ComponentModel.BackgroundWorker(); - this.lblStatus = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // lvwOutputs - // - this.lvwOutputs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.clmName, - this.clmID}); - this.lvwOutputs.Enabled = false; - this.lvwOutputs.FullRowSelect = true; - this.lvwOutputs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.lvwOutputs.HideSelection = false; - this.lvwOutputs.Location = new System.Drawing.Point(12, 27); - this.lvwOutputs.MultiSelect = false; - this.lvwOutputs.Name = "lvwOutputs"; - this.lvwOutputs.Size = new System.Drawing.Size(299, 131); - this.lvwOutputs.TabIndex = 5; - this.lvwOutputs.UseCompatibleStateImageBehavior = false; - this.lvwOutputs.View = System.Windows.Forms.View.Details; - // - // clmName - // - this.clmName.Text = "Name"; - this.clmName.Width = 235; - // - // clmID - // - this.clmID.Text = "ID"; - this.clmID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // lblOutputDevices - // - this.lblOutputDevices.AutoSize = true; - this.lblOutputDevices.Enabled = false; - this.lblOutputDevices.Location = new System.Drawing.Point(12, 11); - this.lblOutputDevices.Name = "lblOutputDevices"; - this.lblOutputDevices.Size = new System.Drawing.Size(107, 13); - this.lblOutputDevices.TabIndex = 4; - this.lblOutputDevices.Text = "&MIDI Output Devices"; - // - // btnSetAsDefault - // - this.btnSetAsDefault.Enabled = false; - this.btnSetAsDefault.Location = new System.Drawing.Point(12, 164); - this.btnSetAsDefault.Name = "btnSetAsDefault"; - this.btnSetAsDefault.Size = new System.Drawing.Size(299, 23); - this.btnSetAsDefault.TabIndex = 6; - this.btnSetAsDefault.Text = "&Set Selected Device As Default"; - this.btnSetAsDefault.UseVisualStyleBackColor = true; - this.btnSetAsDefault.Click += new System.EventHandler(this.btnSetAsDefault_Click); - // - // lblStatus - // - this.lblStatus.BackColor = System.Drawing.Color.Transparent; - this.lblStatus.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblStatus.ForeColor = System.Drawing.Color.Black; - this.lblStatus.Location = new System.Drawing.Point(12, 194); - this.lblStatus.Name = "lblStatus"; - this.lblStatus.Size = new System.Drawing.Size(299, 22); - this.lblStatus.TabIndex = 7; - this.lblStatus.Text = "Loading devices and reading registry... please wait!"; - this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // KeppyDriverMIDIOutSelectorWin - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(325, 229); - this.Controls.Add(this.lvwOutputs); - this.Controls.Add(this.lblOutputDevices); - this.Controls.Add(this.btnSetAsDefault); - this.Controls.Add(this.lblStatus); - this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "KeppyDriverMIDIOutSelectorWin"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Change default MIDI out device"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ListView lvwOutputs; - private System.Windows.Forms.ColumnHeader clmName; - private System.Windows.Forms.ColumnHeader clmID; - private System.Windows.Forms.Label lblOutputDevices; - private System.Windows.Forms.Button btnSetAsDefault; - private System.ComponentModel.BackgroundWorker backgroundWorker; - private System.Windows.Forms.Label lblStatus; - } -} \ No newline at end of file diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.cs deleted file mode 100644 index ae5a4d97..00000000 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using MIDI.NET.Devices; - -namespace KeppyDriverConfigurator -{ - public partial class KeppyDriverMIDIOutSelectorWin : Form - { - private Int32 defaultID = -2; // MIDI Mapper has a device ID of -1 and all other devices are 0 or greater. - private int newID = -2; - private bool writeMode = false; - private bool writeOK = false; - - public KeppyDriverMIDIOutSelectorWin() - { - InitializeComponent(); - Load += new EventHandler(CheckDevices); - backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); - backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); - lvwOutputs.SelectedIndexChanged += new EventHandler(lvwOutputs_SelectedIndexChanged); - btnSetAsDefault.Click += new EventHandler(btnSetAsDefault_Click); - } - - private void CheckDevices(object sender, EventArgs e) - { - backgroundWorker.RunWorkerAsync(); - } - - void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) - { - if (writeMode) - { - try - { - Output.DefaultDeviceID = newID; - writeOK = true; - } - catch - { - writeOK = false; - } - } - else - { - Collections.Load(); - defaultID = Output.DefaultDeviceID; - } - } - - void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) - { - if (writeMode) - { - if (writeOK) - { - lblStatus.Text = "Default MIDI out device updated successfully."; - lblStatus.Update(); - System.Threading.Thread.Sleep(1000); - defaultID = newID; - lblOutputDevices.Enabled = true; - lvwOutputs.Enabled = true; - lvwOutputs.Focus(); - lblStatus.Visible = false; - } - else - { - MessageBox.Show( - this, - "An error occurred when attempting to write to the registry.", - "Registry Write Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - lblOutputDevices.Enabled = true; - lvwOutputs.Enabled = true; - lvwOutputs.Focus(); - btnSetAsDefault.Enabled = true; - lblStatus.Visible = false; - } - } - else - { - int itemCounter = 0; - foreach (Output midiDevice in Collections.Outputs) - { - ListViewItem item = new ListViewItem(midiDevice.Name); - item.Tag = midiDevice; - item.SubItems.Add(new ListViewItem.ListViewSubItem(item, midiDevice.ID.ToString())); - lvwOutputs.Items.Add(item); - lvwOutputs.Items[itemCounter].Selected = midiDevice.ID == defaultID; - lvwOutputs.Items[itemCounter].Focused = true; - itemCounter++; - } - lblOutputDevices.Enabled = true; - lvwOutputs.Enabled = true; - lvwOutputs.Focus(); - lblStatus.Visible = false; - } - } - - void lvwOutputs_SelectedIndexChanged(object sender, EventArgs e) - { - if (lvwOutputs.SelectedItems.Count == 1) - { - btnSetAsDefault.Enabled = ((Output)lvwOutputs.SelectedItems[0].Tag).ID != defaultID; - } - else - { - btnSetAsDefault.Enabled = false; - } - } - - void btnSetAsDefault_Click(object sender, EventArgs e) - { - writeOK = false; - btnSetAsDefault.Enabled = false; - lblOutputDevices.Enabled = false; - lvwOutputs.Enabled = false; - lblStatus.Text = "Writing to registry... please wait!"; - lblStatus.Visible = true; - newID = ((Output)lvwOutputs.SelectedItems[0].Tag).ID; - writeMode = true; - backgroundWorker.RunWorkerAsync(); - } - } -} diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.Designer.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.Designer.cs new file mode 100644 index 00000000..c7c8c3f3 --- /dev/null +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.Designer.cs @@ -0,0 +1,122 @@ +namespace KeppyDriverConfigurator +{ + partial class KeppyDriverUpdater + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label2 = new System.Windows.Forms.Label(); + this.LatestVersion = new System.Windows.Forms.Label(); + this.ThisVersion = new System.Windows.Forms.Label(); + this.UpdateCheck = new System.Windows.Forms.Button(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Trebuchet MS", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(12, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(301, 27); + this.label2.TabIndex = 8; + this.label2.Text = "Keppy\'s Driver Update Checker"; + // + // LatestVersion + // + this.LatestVersion.AutoSize = true; + this.LatestVersion.Location = new System.Drawing.Point(14, 67); + this.LatestVersion.Name = "LatestVersion"; + this.LatestVersion.Size = new System.Drawing.Size(356, 13); + this.LatestVersion.TabIndex = 7; + this.LatestVersion.Text = "Click on \"Check for updates\" to check for the latest version of the driver."; + // + // ThisVersion + // + this.ThisVersion.AutoSize = true; + this.ThisVersion.Location = new System.Drawing.Point(14, 51); + this.ThisVersion.Name = "ThisVersion"; + this.ThisVersion.Size = new System.Drawing.Size(325, 13); + this.ThisVersion.TabIndex = 6; + this.ThisVersion.Text = "The current version of the driver, installed on your system, is: IDK"; + // + // UpdateCheck + // + this.UpdateCheck.Location = new System.Drawing.Point(432, 11); + this.UpdateCheck.Name = "UpdateCheck"; + this.UpdateCheck.Size = new System.Drawing.Size(106, 23); + this.UpdateCheck.TabIndex = 5; + this.UpdateCheck.Text = "Check for updates"; + this.UpdateCheck.UseVisualStyleBackColor = true; + this.UpdateCheck.Click += new System.EventHandler(this.UpdateCheck_Click); + // + // pictureBox1 + // + this.pictureBox1.Image = global::KeppyDriverConfigurator.Properties.Resources.updatebk; + this.pictureBox1.Location = new System.Drawing.Point(243, 83); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(329, 248); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 9; + this.pictureBox1.TabStop = false; + // + // KeppyDriverUpdater + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(549, 277); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.label2); + this.Controls.Add(this.LatestVersion); + this.Controls.Add(this.ThisVersion); + this.Controls.Add(this.UpdateCheck); + this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "KeppyDriverUpdater"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Keppy\'s Driver Update Checker"; + this.Load += new System.EventHandler(this.KeppyDriverUpdater_Load); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label LatestVersion; + private System.Windows.Forms.Label ThisVersion; + private System.Windows.Forms.Button UpdateCheck; + private System.Windows.Forms.PictureBox pictureBox1; + } +} \ No newline at end of file diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.cs new file mode 100644 index 00000000..06d9132e --- /dev/null +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Text; +using System.Reflection; +using System.Windows.Forms; +using System.Net; +using System.IO; + +namespace KeppyDriverConfigurator +{ + public partial class KeppyDriverUpdater : Form + { + public KeppyDriverUpdater() + { + InitializeComponent(); + } + + private void KeppyDriverUpdater_Load(object sender, EventArgs e) + { + FileVersionInfo Driver = FileVersionInfo.GetVersionInfo(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\keppydrv\\keppydrv.dll"); + ThisVersion.Text = "The current version of the driver, installed on your system, is: " + Driver.FileVersion.ToString(); + } + + private void UpdateCheck_Click(object sender, EventArgs e) + { + try + { + UpdateCheck.Enabled = false; + WebClient client = new WebClient(); + Stream stream = client.OpenRead("https://raw.githubusercontent.com/KaleidonKep99/Keppy-s-Driver/master/output/keppydriverupdate.txt"); + StreamReader reader = new StreamReader(stream); + String newestversion = reader.ReadToEnd(); + FileVersionInfo Driver = FileVersionInfo.GetVersionInfo(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\keppydrv\\keppydrv.dll"); + LatestVersion.Text = "Checking for updates, please wait..."; + ThisVersion.Text = "The current version of the driver, installed on your system, is: " + Driver.FileVersion.ToString(); + Version x = null; + Version.TryParse(newestversion.ToString(), out x); + Version y = null; + Version.TryParse(Driver.FileVersion.ToString(), out y); + if (x > y) + { + UpdateCheck.Enabled = true; + LatestVersion.Text = "New updates found! Version " + newestversion.ToString() + " is online!"; + MessageBox.Show("New update found, press OK to open the release page.", "New update found!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + Process.Start("https://github.com/KaleidonKep99/Keppy-s-Driver/releases"); + } + else if (x < y) + { + UpdateCheck.Enabled = true; + LatestVersion.Text = "Seems that the version on GitHub (" + newestversion.ToString() + ") is older than the version you're currently using.\nReally strange huh?"; + MessageBox.Show("Is this a joke? You have a newer version than the one currently released on GitHub...\n\nYou dirty hacker.", "Wowie.", MessageBoxButtons.OK, MessageBoxIcon.Question); + } + else + { + UpdateCheck.Enabled = true; + LatestVersion.Text = "There are no updates available right now. Try checking later."; + MessageBox.Show("This release is already updated.", "No updates found.", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + catch (Exception ex) + { + UpdateCheck.Enabled = true; + FileVersionInfo Driver = FileVersionInfo.GetVersionInfo(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\keppydrv\\keppydrv.dll"); + ThisVersion.Text = "The current version of the driver, installed on your system, is: " + Driver.FileVersion.ToString(); + LatestVersion.Text = "Can not check for updates! You're offline, or maybe the website is temporarily down."; + MessageBox.Show("Can not check for updates!\n\nSpecific .NET error:\n" + ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.resx b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.resx similarity index 94% rename from KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.resx rename to KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.resx index da308e76..1af7de15 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverMIDIOutSelectorWin.resx +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/KeppyDriverUpdater.resx @@ -112,12 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - \ No newline at end of file diff --git a/KeppyDriverConfigurator/KeppyDriverConfigurator/Properties/Settings.Designer.cs b/KeppyDriverConfigurator/KeppyDriverConfigurator/Properties/Settings.Designer.cs index 987d9321..eb250e56 100644 --- a/KeppyDriverConfigurator/KeppyDriverConfigurator/Properties/Settings.Designer.cs +++ b/KeppyDriverConfigurator/KeppyDriverConfigurator/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // Il codice è stato generato da uno strumento. -// Versione runtime:4.0.30319.42000 +// Versione runtime:4.0.30319.34014 // // Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se // il codice viene rigenerato. diff --git a/keppydrv.iss b/keppydrv.iss index dd59dec0..7cd0a258 100644 --- a/keppydrv.iss +++ b/keppydrv.iss @@ -10,7 +10,7 @@ AppPublisherURL=http://keppystudios.com AppSupportPhone=+393511888475 AppSupportURL=mailto:kaleidonkep99@outlook.com AppUpdatesURL=https://github.com/KaleidonKep99/Keppy-s-MIDI-Driver/releases -AppVersion=3.1.3.0 +AppVersion=3.1.3.1 ArchitecturesAllowed=x86 x64 ArchitecturesInstallIn64BitMode=x64 Compression=bzip @@ -37,9 +37,9 @@ VersionInfoCompany=Keppy Studios VersionInfoCopyright=Copyright (c) 2011-2016 Brad Miller, Chris Moeller and Riccardo Loi. All rights reserved. VersionInfoDescription=User-mode MIDI driver for Windows Vista and newer VersionInfoProductName=Keppy's Driver -VersionInfoProductTextVersion=3.1.3.0 +VersionInfoProductTextVersion=3.1.3.1 VersionInfoTextVersion=User-mode MIDI driver for Windows Vista and newer -VersionInfoVersion=3.1.3.0 +VersionInfoVersion=3.1.3.1 [Files] ; 64-bit OS @@ -61,6 +61,8 @@ Source: "external_packages\lib\basswasapi.dll"; DestDir: "{syswow64}\keppydrv"; Source: "external_packages\lib\bassopus.dll"; DestDir: "{syswow64}\keppydrv"; DestName: "bassopus.dll"; Flags: replacesameversion ignoreversion; Check: Is64BitInstallMode Source: "external_packages\lib\basswv.dll"; DestDir: "{syswow64}\keppydrv"; DestName: "basswv.dll"; Flags: replacesameversion ignoreversion; Check: Is64BitInstallMode Source: "output\keppydrv.dll"; DestDir: "{syswow64}\keppydrv"; DestName: "keppydrv.dll"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: Is64BitInstallMode +Source: "output\midioutsetter32.exe"; DestDir: "{syswow64}\keppydrv"; DestName: "midioutsetter32.exe"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: Is64BitInstallMode +Source: "output\midioutsetter64.exe"; DestDir: "{syswow64}\keppydrv"; DestName: "midioutsetter64.exe"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: Is64BitInstallMode Source: "output\KeppyDriverConfigurator.exe"; DestDir: "{syswow64}\keppydrv"; DestName: "KeppyDriverConfigurator.exe"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: Is64BitInstallMode Source: "output\sfpacker.exe"; DestDir: "{syswow64}\keppydrv"; DestName: "sfpacker.exe"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: Is64BitInstallMode Source: "output\sfzguide.txt"; DestDir: "{syswow64}\keppydrv"; DestName: "sfzguide.txt"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: Is64BitInstallMode @@ -74,6 +76,7 @@ Source: "external_packages\lib\basswasapi.dll"; DestDir: "{sys}\keppydrv"; DestN Source: "external_packages\lib\bassopus.dll"; DestDir: "{sys}\keppydrv"; DestName: "bassopus.dll"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: not Is64BitInstallMode Source: "external_packages\lib\basswv.dll"; DestDir: "{sys}\keppydrv"; DestName: "basswv.dll"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: not Is64BitInstallMode Source: "output\keppydrv.dll"; DestDir: "{sys}\keppydrv"; DestName: "keppydrv.dll"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: not Is64BitInstallMode +Source: "output\midioutsetter32.exe"; DestDir: "{sys}\keppydrv"; DestName: "midioutsetter32.exe"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: not Is64BitInstallMode Source: "output\KeppyDriverConfigurator.exe"; DestDir: "{sys}\keppydrv"; DestName: "KeppyDriverConfigurator.exe"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: not Is64BitInstallMode Source: "output\sfpacker.exe"; DestDir: "{sys}\keppydrv"; DestName: "sfpacker.exe"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: not Is64BitInstallMode Source: "output\sfzguide.txt"; DestDir: "{sys}\keppydrv"; DestName: "sfzguide.txt"; Flags: replacesameversion ignoreversion; MinVersion: 0,5.01sp3; Check: not Is64BitInstallMode diff --git a/keppydrv/Resource.aps b/keppydrv/Resource.aps index e9aecfcd..8e32f49d 100644 Binary files a/keppydrv/Resource.aps and b/keppydrv/Resource.aps differ diff --git a/keppydrv/Resource.rc b/keppydrv/Resource.rc index 1e837303..d9f8b5d2 100644 Binary files a/keppydrv/Resource.rc and b/keppydrv/Resource.rc differ diff --git a/output/keppydriverupdate.txt b/output/keppydriverupdate.txt index a51b5161..3f86269e 100644 --- a/output/keppydriverupdate.txt +++ b/output/keppydriverupdate.txt @@ -1 +1 @@ -3.1.3.0 \ No newline at end of file +3.1.3.1 \ No newline at end of file diff --git a/output/midioutsetter32.exe b/output/midioutsetter32.exe new file mode 100644 index 00000000..b1a96871 Binary files /dev/null and b/output/midioutsetter32.exe differ diff --git a/output/midioutsetter64.exe b/output/midioutsetter64.exe new file mode 100644 index 00000000..04f06cc5 Binary files /dev/null and b/output/midioutsetter64.exe differ diff --git a/output/sfpacker.exe b/output/sfpacker.exe new file mode 100644 index 00000000..83633cfb Binary files /dev/null and b/output/sfpacker.exe differ