Beispiel #1
0
 public void MidiOutCallback(MIDI_WIN32_MSDN.HMIDIOUT hMidiOut, MIDI_WIN32_MSDN wMsg, UIntPtr dwInstance, UIntPtr dwParam1, UIntPtr dwParam2)
 {
     if (wMsg.ToString() == "MOM_OPEN")
     {
         MIDI_WIN32_MSDN.midiOutPrepareHeader(hMidiOut, IntPtr.Zero, 65536);
     }
     else if (wMsg.ToString() == "MOM_DONE")
     {
         // do buffering (void code)
     }
     else if (wMsg.ToString() == "MOM_CLOSE")
     {
         MIDI_WIN32_MSDN.midiOutUnprepareHeader(hMidiOut, IntPtr.Zero, 65536);
     }
 }
Beispiel #2
0
        public void MIDIOpenOutDevice()
        {
            hMIDIOUT = new MIDI_WIN32_MSDN.HMIDIOUT();

            /// Open the MIDI output device

            MMRESULT = MIDI_WIN32_MSDN.midiOutOpen(out hMIDIOUT, UIntPtr.Zero, null, UIntPtr.Zero);

            if (MMRESULT == MIDI_WIN32_MSDN.MMRESULT.MMSYSERR_ERROR)
            {
                Console.WriteLine("MIDI OUT OPEN ERR");
                return;
            }

            /// Before playing a MIDI file, you should use the midiOutGetDevCaps function
            /// to determine the capabilities of the MIDI output device that is present in the system.
            /// This function takes an address of a MIDIOUTCAPS structure,
            /// which it fills with information about the capabilities of the given device.

            MIDI_WIN32_MSDN.midiOutGetDevCaps(0, ref MidiOutCap, (uint)Marshal.SizeOf(typeof(MIDI_WIN32_MSDN.MidiOutCaps)));
        }