Ejemplo n.º 1
0
        public static void callback(HMIDIIN hMidiIn, M_MidModel.MidiInMessage wMsg, UIntPtr dwInstance, UIntPtr dwParam1, UIntPtr dwParam2)
        {
            if (wMsg.ToString() == "MIM_OPEN")
            {
                // Console.WriteLine("MIDI connection opened successfully");
            }
            else if (wMsg.ToString() == "MIM_DATA")
            {
                byte[] data     = new byte[4];
                int    highword = unchecked ((short)(long)dwParam1);
                int    lowword  = unchecked ((short)((long)dwParam1 >> 16));
                // unchecked : 오버플로 검사 안함

                data[0] = 0x90;
                data[1] = (byte)(highword >> 8);
                data[2] = (byte)(lowword & 0xff);
                uint msg = BitConverter.ToUInt32(data, 0);

                res = M_MidModel.midiOutShortMsg(ohandle, (int)msg);

                UIntPtr timestamp = dwParam2;
                //Console.WriteLine(String.Format("{0} :\n\tNote Index: {1}\n\tNote Velocity: {2}\n\tTimestamp: {3}", wMsg, data[1], data[2], timestamp));
            }
            return;
        }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            IsMdiContainer = true;

            mMid    = new M_MidModel();
            cMid    = new C_MidControl();
            formCap = new MidiOutCaps();

            gridForm           = new PianoRoll();
            gridForm.MdiParent = this;
            //FormBorderStyle = FormBorderStyle.None;
            //WindowState = FormWindowState.Maximized;

            wGraph           = new WaveGraph();
            wGraph.MdiParent = this;

            num_midi_devices = M_MidModel.midiInGetNumDevs();
            if (num_midi_devices == 0)
            {
                //Console.Write("Please connect MIDI device and try again.\nPress any key...");
                //Console.ReadLine();
                //Environment.Exit(1);
            }
            else
            {
                handle      = new HMIDIIN();
                formDevices = new MIDIINCAPS[num_midi_devices];
            }
        }
Ejemplo n.º 3
0
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            num_midi_devices = M_MidModel.midiInGetNumDevs();

            if (num_midi_devices == 0)
            {
                //Console.Write("Please connect MIDI device and try again.\nPress any key...");
                //Console.ReadLine();
                //Environment.Exit(1);
            }
            else
            {
                handle      = new HMIDIIN();
                formDevices = new MIDIINCAPS[num_midi_devices];
            }
        }
Ejemplo n.º 4
0
 public static MMRESULT midiInOpen(out HMIDIIN lphMidiIn, UIntPtr uDeviceID, MidiInProc dwCallback, UIntPtr dwCallbackInstance)
 {
     return(midiInOpen(out lphMidiIn, uDeviceID, dwCallback, dwCallbackInstance,
                       dwCallback == null ? MidiOpenFlags.CALLBACK_NULL : MidiOpenFlags.CALLBACK_FUNCTION));
 }
Ejemplo n.º 5
0
 public static extern MMRESULT midiInOpen(out HMIDIIN lphMidiIn, UIntPtr uDeviceID, MidiInProc dwCallback, UIntPtr dwCallbackInstance, MidiOpenFlags dwFlags);
Ejemplo n.º 6
0
 public static extern MMRESULT midiInClose(HMIDIIN hMidiIn);
Ejemplo n.º 7
0
 public static extern MMRESULT midiInStop(HMIDIIN hMidiIn);