Ejemplo n.º 1
0
        private void RefreshInputs_Click(object sender, EventArgs e)
        {
            // Check count
            DeviceCount = WinMM.midiInGetNumDevs();
            if (DeviceCount < 1)
            {
                // None available, close
                MessageBox.Show("No MIDI input devices available.", "OmniMIDI - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }

            // Initialize KDMAPI
            if (sender == null)
            {
                if (!Convert.ToBoolean(KDMAPI.InitializeKDMAPIStream()))
                {
                    MessageBox.Show("Unable to initialize KDMAPI.", "OmniMIDI - Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Close();
                    return;
                }

                KDMAPI.ResetKDMAPIStream();
            }

            // Initialize MIDI inputs list
            MIDIINCAPS InCaps = new MIDIINCAPS();

            MIDIInList.Items.Clear();
            for (uint i = 0; i < DeviceCount; i++)
            {
                WinMM.midiInGetDevCaps(i, out InCaps, (uint)Marshal.SizeOf(InCaps));
                MIDIInList.Items.Add(InCaps.szPname);
            }
        }
Ejemplo n.º 2
0
 internal static extern int midiInGetDevCaps(
     uint uDeviceID,
     out MIDIINCAPS caps,
     uint cbMidiInCaps);