/*void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { if (Mode == mDMode.Off) { OffMode(); } else if (Mode == mDMode.Tool) { LogMode(); } else if (Mode == mDMode.StandBy) { StandbyMode(); } else if (Mode == mDMode.MIDI) { MidiMode(); } }*/ void COMClosed(object sender, EventArgs e) { Mode = mDMode.Off; tcMain.Enabled = false; }
//Cmd=0x01 private void SetState(mDMode State) { byte SendState = 0x00; switch (State) { case mDMode.Off: SendState = 0x00; break; case mDMode.StandBy: SendState = 0x01; break; case mDMode.MIDI: SendState = 0x02; break; case mDMode.Tool: SendState = 0x03; break; } UtilityMIDI.MIDI_SysEx(0x01, SendState, 0x00, 0x00); //serialPort.Write(new byte[] { 0xF0, 0x77, 0x01, SendState,0x00,0x00, 0xF7 }, 0, 7); }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { for (int i = 0; i < TabPages.Length; i++) if (TabPages[i] == tcMain.SelectedTab) { if (i == (int)Tabs.Configuration) { if (!chkAlwaysMIDI.Checked) SetState(mDMode.StandBy); Mode = mDMode.StandBy; } else if (i == (int)Tabs.Tools) { if (!chkAlwaysMIDI.Checked) SetState(mDMode.Tool); Mode = mDMode.Tool; } else if (i == (int)Tabs.Monitor || i == (int)Tabs.Sfz || i == (int)Tabs.Effects) { SetState(mDMode.MIDI); Mode = mDMode.MIDI; } return; } }
private void resetToolStripMenuItem_Click(object sender, EventArgs e) { //XX//UtilitySerial.DiscardAllBuffer(); UtilityMIDI.DiscardAllBuffer(MIDIType.Serial); UtilityMIDI.MIDI_SysEx(0x7F, 0x00, 0x00, 0x00);//RESET Mode = mDMode.Off; }