예제 #1
0
        private void OmniMapperCpl_Load(object sender, EventArgs e)
        {
            try
            {
                ActiveMovieKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\ActiveMovie\devenum\{4EFE2452-168A-11D1-BC76-00C04FB9453B}\Default MidiOut Device", true);
                MIDIMapperKey  = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Multimedia\MIDIMap", true);

                MIDIOUTCAPS OutCaps = new MIDIOUTCAPS();
                for (uint i = 0; i < DeviceCount; i++)
                {
                    WinMM.midiOutGetDevCaps(i, out OutCaps, (uint)Marshal.SizeOf(OutCaps));
                    if (OutCaps.szPname.Equals("OmniMapper"))
                    {
                        continue;
                    }

                    MIDIOutList.Items.Add(OutCaps.szPname);
                }

                if (Functions.CheckMIDIMapper())
                {
                    bool   Found     = false;
                    String SelDevice = Program.Mapper.GetValue("TrgtSynth", "Microsoft GS Wavetable Synth").ToString();
                    CurDevice.Text = String.Format(CurDrvLab, SelDevice);
                    for (int i = 0; i < MIDIOutList.Items.Count; i++)
                    {
                        if (MIDIOutList.Items[i].ToString().Equals(SelDevice))
                        {
                            MIDIOutList.SelectedIndex = i;
                            Found = true;
                            break;
                        }
                    }

                    if (!Found)
                    {
                        MIDIOutList.SelectedIndex = 0;
                    }
                }
                else
                {
                    Text = String.Format("Change {0} settings", Functions.IsWindows8OrLater() ? "Windows Media Player MIDI output" : "MIDI mapper");
                    if (ActiveMovieKey != null)
                    {
                        MIDIOutList.SelectedIndex = Convert.ToInt32(ActiveMovieKey.GetValue("MidiOutId"));
                    }
                    else
                    {
                        MIDIOutList.SelectedIndex = MIDIOutList.FindStringExact(MIDIMapperKey.GetValue("szPname", "Microsoft GS Wavetable Synth").ToString());
                    }
                    CurDevice.Text = String.Format(CurDrvLab, MIDIOutList.Items[MIDIOutList.SelectedIndex].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #2
0
        public MainWindow(String[] SFs)
        {
            // Initialize form
            InitializeComponent();

            // Fix
            MWSStrip.Padding = new Padding(
                MWSStrip.Padding.Left,
                MWSStrip.Padding.Top,
                MWSStrip.Padding.Left,
                MWSStrip.Padding.Bottom
                );
            MWTab_SelectedIndexChanged(null, null);

            // Check start location
            if (Properties.Settings.Default.LastWindowPos == new Point(-9999, -9999))
            {
                this.StartPosition = FormStartPosition.CenterScreen;
            }
            else
            {
                this.StartPosition = FormStartPosition.Manual;
                this.Location      = Properties.Settings.Default.LastWindowPos;
            }

            // Check size
            if (Properties.Settings.Default.LastWindowSize != new Size(-1, -1))
            {
                this.Size = Properties.Settings.Default.LastWindowSize;
            }

            // Set menu
            Menu = OMMenu;

            // Set updater
            FileVersionInfo Driver = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\OmniMIDI\\OmniMIDI.dll");

            VersionLabel.Text = String.Format("Version {0}.{1}.{2}.{3}", Driver.FileMajorPart, Driver.FileMinorPart, Driver.FileBuildPart, Driver.FilePrivatePart);

            Shown       += CheckUpdatesStartUp;
            DWCF.Checked = Properties.Settings.Default.DrawControlsFaster;

            // Check if MIDI mapper is available
            OMAPCpl.Visible = Functions.CheckMIDIMapper();

            // Add dynamic controls
            CreateSFLEEmbed(SFs);
            CreateSETEmbed();
        }
예제 #3
0
        private void OmniMapperCpl_Load(object sender, EventArgs e)
        {
            try
            {
                ActiveMovieKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\ActiveMovie\devenum\{4EFE2452-168A-11D1-BC76-00C04FB9453B}\Default MidiOut Device", true);
                MIDIMapperKey  = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Multimedia\MIDIMap", true);

                String[] i386  = ReturnMIDIDevices("i386");
                String[] AMD64 = ReturnMIDIDevices("AMD64");
                String[] ARM64 = ReturnMIDIDevices("ARM64");

                foreach (String D in i386)
                {
                    var L = MDevs.FindIndex(x => x.PName == D);

                    if (L == -1)
                    {
                        MDevs.Add(new MIDIDevices()
                        {
                            PName = D, i386 = true, AMD64 = false, ARM64 = false
                        });
                    }
                    else
                    {
                        MDevs[L] = new MIDIDevices()
                        {
                            PName = D, i386 = true, AMD64 = MDevs[L].AMD64, ARM64 = MDevs[L].ARM64
                        }
                    };
                }

                foreach (String D in AMD64)
                {
                    var L = MDevs.FindIndex(x => x.PName == D);

                    if (L == -1)
                    {
                        MDevs.Add(new MIDIDevices()
                        {
                            PName = D, i386 = false, AMD64 = true, ARM64 = false
                        });
                    }
                    else
                    {
                        MDevs[L] = new MIDIDevices()
                        {
                            PName = D, i386 = MDevs[L].i386, AMD64 = true, ARM64 = MDevs[L].ARM64
                        }
                    };
                }

                foreach (String D in ARM64)
                {
                    var L = MDevs.FindIndex(x => x.PName == D);

                    if (L == -1)
                    {
                        MDevs.Add(new MIDIDevices()
                        {
                            PName = D, i386 = false, AMD64 = false, ARM64 = true
                        });
                    }
                    else
                    {
                        MDevs[L] = new MIDIDevices()
                        {
                            PName = D, i386 = MDevs[L].i386, AMD64 = MDevs[L].AMD64, ARM64 = true
                        }
                    };
                }

                foreach (MIDIDevices DV in MDevs)
                {
                    MIDIOutList.Items.Add(DV.PName);
                }

                if (Functions.CheckMIDIMapper())
                {
                    bool   Found     = false;
                    String SelDevice = Program.Mapper.GetValue("TrgtSynth", "Microsoft GS Wavetable Synth").ToString();
                    for (int i = 0; i < MIDIOutList.Items.Count; i++)
                    {
                        if (MIDIOutList.Items[i].ToString().Equals(SelDevice))
                        {
                            MIDIOutList.SelectedIndex = i;
                            Found = true;
                            break;
                        }
                    }

                    if (!Found)
                    {
                        MIDIOutList.SelectedIndex = 0;
                    }
                }
                else
                {
                    Text = String.Format("Change {0} settings", Functions.IsWindows8OrLater() ? "Windows Media Player MIDI output" : "MIDI mapper");
                    if (ActiveMovieKey != null)
                    {
                        MIDIOutList.SelectedIndex = Convert.ToInt32(ActiveMovieKey.GetValue("MidiOutId"));
                    }
                    else
                    {
                        MIDIOutList.SelectedIndex = MIDIOutList.FindStringExact(MIDIMapperKey.GetValue("szPname", "Microsoft GS Wavetable Synth").ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #4
0
 private void OMAPUninstall_Click(object sender, EventArgs e)
 {
     Functions.MIDIMapRegistry(true);
     OMAPCpl.Visible = Functions.CheckMIDIMapper();
 }