Exemplo n.º 1
0
        private void MIDIInList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (handle != IntPtr.Zero)
            {
                WinMM.midiInStop(handle);
                WinMM.midiInClose(handle);
            }

            midiInProc = new WinMM.MidiInProc(MidiProc);
            int retval = WinMM.midiInOpen(out handle, MIDIInList.SelectedIndex, midiInProc, IntPtr.Zero, WinMM.CALLBACK_FUNCTION);

            WinMM.midiInStart(handle);
        }
Exemplo n.º 2
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);

            if (handle != IntPtr.Zero)
            {
                WinMM.midiInStop(handle);
                WinMM.midiInClose(handle);
            }

            mut.WaitOne();
            mut.ReleaseMutex();
            mut.Close();

            KDMAPI.TerminateKDMAPIStream();

            if (e.CloseReason == CloseReason.WindowsShutDown)
            {
                return;
            }
        }