private void DPadOn(GuiDrumDPad dp) { Debug.Assert((byte)dp % 2 == 0, "only left, up, right, down is allowed here"); if (GuiLinker.GetButtonChecked(dp) == false) { GuiLinker.CheckboxButton(dp, true); MidiSender.SendNoteOn(GuiLinker.GetMidiNote(dp), GuiLinker.GetButtonVelocity(dp)); if (GuiLinker.GetButtonSwitchType(dp) != SwitchType.KeyboardLike) { MidiSender.SendNoteOff(GuiLinker.GetMidiNote(dp)); } } }
private void DrumButtonPressed(GuiDrumButton b) { if (InvokeRequired) { Invoke(new ButtonDelegate(DrumButtonPressed), new object[] { b }); } else { GuiLinker.CheckboxButton(b, true); MidiSender.SendNoteOn(GuiLinker.GetMidiNote(b), GuiLinker.GetButtonVelocity(b)); if (GuiLinker.GetButtonSwitchType(b) != SwitchType.KeyboardLike) { MidiSender.SendNoteOff(GuiLinker.GetMidiNote(b)); } } }
public FrmMain() { InitializeComponent(); m_Serializer = new Serialize.Serializer(this); MidiSender = new MidiSender(this); // Lists MIDI devices ddlMIDIDevice.DataSource = MidiSender.MidiDevices; // Sets default file browser properties openFileDialog.Filter = "PS360 Setting Files|*.p3s"; openFileDialog.DefaultExt = "*.p3s"; openFileDialog.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath); openFileDialog.FileName = "PS360DrumSettings"; saveFileDialog.Filter = openFileDialog.Filter; saveFileDialog.DefaultExt = openFileDialog.DefaultExt; saveFileDialog.InitialDirectory = openFileDialog.InitialDirectory; saveFileDialog.FileName = openFileDialog.FileName; #region Gui link stuff GuiLinker = new GuiLinker(this); GuiLinker.AddDrum(GuiDrumPad.RedTom, nupRedTom, nupAdvNoteRedTom, chkBoostRedTom, chkAdvBoostRedTom, ddlRedTom, ddlAdvBoostRedTom); GuiLinker.AddDrum(GuiDrumPad.YellowTom, nupYellowTom, nupAdvNoteYellowTom, chkBoostYellowTom, chkAdvBoostYellowTom, ddlYellowTom, ddlAdvBoostYellowTom); GuiLinker.AddDrum(GuiDrumPad.YellowCymbal, nupYellowCymbal, nupAdvNoteYellowCymbal, chkBoostYellowCymbal, chkAdvBoostYellowCymbal, ddlYellowCymbal, ddlAdvBoostYellowCymbal); GuiLinker.AddDrum(GuiDrumPad.BlueTom, nupBlueTom, nupAdvNoteBlueTom, chkBoostBlueTom, chkAdvBoostBlueTom, ddlBlueTom, ddlAdvBoostBlueTom); GuiLinker.AddDrum(GuiDrumPad.BlueCymbal, nupBlueCymbal, nupAdvNoteBlueCymbal, chkBoostBlueCymbal, chkAdvBoostBlueCymbal, ddlBlueCymbal, ddlAdvBoostBlueCymbal); GuiLinker.AddDrum(GuiDrumPad.GreenTom, nupGreenTom, nupAdvNoteGreenTom, chkBoostGreenTom, chkAdvBoostGreenTom, ddlGreenTom, ddlAdvBoostGreenTom); GuiLinker.AddDrum(GuiDrumPad.GreenCymbal, nupGreenCymbal, nupAdvNoteGreenCymbal, chkBoostGreenCymbal, chkAdvBoostGreenCymbal, ddlGreenCymbal, ddlAdvBoostGreenCymbal); GuiLinker.AddDrum(GuiDrumPad.PedalLeft, nupPedalLeft, nupAdvNotePedalLeft, chkBoostPedalLeft, chkAdvBoostPedalLeft, ddlPedalLeft, ddlAdvBoostPedalLeft); GuiLinker.AddDrum(GuiDrumPad.PedalRight, nupPedalRight, nupAdvNotePedalRight, chkBoostPedalRight, chkAdvBoostPedalRight, ddlPedalRight, ddlAdvBoostPedalRight); GuiLinker.AddButton(GuiDrumButton.BigButton, nupBigButton, nupAdvNoteBigButton, nupAdvVelBigButton, ddlAdvSwitchBigButton, chkBigButton); GuiLinker.AddButton(GuiDrumButton.Circle, nupCircle, nupAdvNoteCircle, nupAdvVelCircle, ddlAdvSwitchCircle, chkCircle); GuiLinker.AddButton(GuiDrumButton.Rectangle, nupRectangle, nupAdvNoteRectangle, nupAdvVelRectangle, ddlAdvSwitchRectangle, chkRectangle); GuiLinker.AddButton(GuiDrumButton.Select, nupSelect, nupAdvNoteSelect, nupAdvVelSelect, ddlAdvSwitchSelect, chkSelect); GuiLinker.AddButton(GuiDrumButton.Start, nupStart, nupAdvNoteStart, nupAdvVelStart, ddlAdvSwitchStart, chkStart); GuiLinker.AddButton(GuiDrumButton.Triangle, nupTriangle, nupAdvNoteTriangle, nupAdvVelTriangle, ddlAdvSwitchTriangle, chkTriangle); GuiLinker.AddButton(GuiDrumButton.X, nupX, nupAdvNoteX, nupAdvVelX, ddlAdvSwitchX, chkX); GuiLinker.AddDPad(GuiDrumDPad.Up, nupDPadUp, nupAdvNoteDPadUp, nupAdvVelDPadUp, ddlAdvSwitchDPadUp, chkDPadUp); GuiLinker.AddDPad(GuiDrumDPad.Down, nupDPadDown, nupAdvNoteDPadDown, nupAdvVelDPadDown, ddlAdvSwitchDPadDown, chkDPadDown); GuiLinker.AddDPad(GuiDrumDPad.Right, nupDPadRight, nupAdvNoteDPadRight, nupAdvVelDPadRight, ddlAdvSwitchDPadRight, chkDPadRight); GuiLinker.AddDPad(GuiDrumDPad.Left, nupDPadLeft, nupAdvNoteDPadLeft, nupAdvVelDPadLeft, ddlAdvSwitchDPadLeft, chkDPadLeft); referenceVelocity[(int)GuiDrumPad.RedTom] = pbRedTom; referenceVelocity[(int)GuiDrumPad.YellowTom] = pbYellowTom; referenceVelocity[(int)GuiDrumPad.BlueTom] = pbBlueTom; referenceVelocity[(int)GuiDrumPad.GreenTom] = pbGreenTom; referenceVelocity[(int)GuiDrumPad.YellowCymbal] = pbYellowCymbal; referenceVelocity[(int)GuiDrumPad.BlueCymbal] = pbBlueCymbal; referenceVelocity[(int)GuiDrumPad.GreenCymbal] = pbGreenCymbal; referenceVelocity[(int)GuiDrumPad.PedalLeft] = pbPedalLeft; referenceVelocity[(int)GuiDrumPad.PedalRight] = pbPedalRight; #endregion #region MultiNoteGUi MultiNoteGui = new MultiNoteGui(ddlMNvelCheck, nupMNvelCheck, ddlMNnote, nupMNnoteTo, nupMNvelMult, nupMNvelAdd, btnMNAdd, btnMNRemove, lbMN); #endregion // Tries to load default settings or reverts to if (File.Exists(defaultFilePath)) { m_Serializer.Load(defaultFilePath); } else { m_Serializer.LoadDefaultSettings(); } // Sets high priority and enables search for drums Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; FillUsbList(); ddlController.Items.Add(ControllerType.Xbox360_GHWT_GH5_Drum); ddlController.Items.Add(ControllerType.Ps3_RockBandProDrum); ddlController.SelectedIndex = 0; }
public FrmMain() { InitializeComponent(); m_Serializer = new Serialize.Serializer(this); MidiSender = new MidiSender(this); // Lists MIDI devices ddlMIDIDevice.DataSource = MidiSender.MidiDevices; // Sets default file browser properties openFileDialog.Filter = "PS360 Setting Files|*.p3s"; openFileDialog.DefaultExt = "*.p3s"; openFileDialog.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath); openFileDialog.FileName = "PS360DrumSettings"; saveFileDialog.Filter = openFileDialog.Filter; saveFileDialog.DefaultExt = openFileDialog.DefaultExt; saveFileDialog.InitialDirectory = openFileDialog.InitialDirectory; saveFileDialog.FileName = openFileDialog.FileName; #region Gui link stuff GuiLinker = new GuiLinker(this); GuiLinker.AddDrum(GuiDrumPad.RedTom, nupRedTom, nupAdvNoteRedTom, chkBoostRedTom, chkAdvBoostRedTom, ddlRedTom, ddlAdvBoostRedTom); GuiLinker.AddDrum(GuiDrumPad.YellowTom, nupYellowTom, nupAdvNoteYellowTom, chkBoostYellowTom, chkAdvBoostYellowTom, ddlYellowTom, ddlAdvBoostYellowTom); GuiLinker.AddDrum(GuiDrumPad.YellowCymbal, nupYellowCymbal, nupAdvNoteYellowCymbal, chkBoostYellowCymbal, chkAdvBoostYellowCymbal, ddlYellowCymbal, ddlAdvBoostYellowCymbal); GuiLinker.AddDrum(GuiDrumPad.BlueTom, nupBlueTom, nupAdvNoteBlueTom, chkBoostBlueTom, chkAdvBoostBlueTom, ddlBlueTom, ddlAdvBoostBlueTom); GuiLinker.AddDrum(GuiDrumPad.BlueCymbal, nupBlueCymbal, nupAdvNoteBlueCymbal, chkBoostBlueCymbal, chkAdvBoostBlueCymbal, ddlBlueCymbal, ddlAdvBoostBlueCymbal); GuiLinker.AddDrum(GuiDrumPad.GreenTom, nupGreenTom, nupAdvNoteGreenTom, chkBoostGreenTom, chkAdvBoostGreenTom, ddlGreenTom, ddlAdvBoostGreenTom); GuiLinker.AddDrum(GuiDrumPad.GreenCymbal, nupGreenCymbal, nupAdvNoteGreenCymbal, chkBoostGreenCymbal, chkAdvBoostGreenCymbal, ddlGreenCymbal, ddlAdvBoostGreenCymbal); GuiLinker.AddDrum(GuiDrumPad.PedalLeft, nupPedalLeft, nupAdvNotePedalLeft, chkBoostPedalLeft, chkAdvBoostPedalLeft, ddlPedalLeft, ddlAdvBoostPedalLeft); GuiLinker.AddDrum(GuiDrumPad.PedalRight, nupPedalRight, nupAdvNotePedalRight, chkBoostPedalRight, chkAdvBoostPedalRight, ddlPedalRight, ddlAdvBoostPedalRight); GuiLinker.AddButton(GuiDrumButton.BigButton, nupBigButton, nupAdvNoteBigButton, nupAdvVelBigButton, ddlAdvSwitchBigButton, chkBigButton); GuiLinker.AddButton(GuiDrumButton.Circle, nupCircle, nupAdvNoteCircle, nupAdvVelCircle, ddlAdvSwitchCircle, chkCircle); GuiLinker.AddButton(GuiDrumButton.Rectangle, nupRectangle, nupAdvNoteRectangle, nupAdvVelRectangle, ddlAdvSwitchRectangle, chkRectangle); GuiLinker.AddButton(GuiDrumButton.Select, nupSelect, nupAdvNoteSelect, nupAdvVelSelect, ddlAdvSwitchSelect, chkSelect); GuiLinker.AddButton(GuiDrumButton.Start, nupStart, nupAdvNoteStart, nupAdvVelStart, ddlAdvSwitchStart, chkStart); GuiLinker.AddButton(GuiDrumButton.Triangle, nupTriangle, nupAdvNoteTriangle, nupAdvVelTriangle, ddlAdvSwitchTriangle, chkTriangle); GuiLinker.AddButton(GuiDrumButton.X, nupX, nupAdvNoteX, nupAdvVelX, ddlAdvSwitchX, chkX); GuiLinker.AddDPad(GuiDrumDPad.Up, nupDPadUp, nupAdvNoteDPadUp, nupAdvVelDPadUp, ddlAdvSwitchDPadUp, chkDPadUp); GuiLinker.AddDPad(GuiDrumDPad.Down, nupDPadDown, nupAdvNoteDPadDown, nupAdvVelDPadDown, ddlAdvSwitchDPadDown, chkDPadDown); GuiLinker.AddDPad(GuiDrumDPad.Right, nupDPadRight, nupAdvNoteDPadRight, nupAdvVelDPadRight, ddlAdvSwitchDPadRight, chkDPadRight); GuiLinker.AddDPad(GuiDrumDPad.Left, nupDPadLeft, nupAdvNoteDPadLeft, nupAdvVelDPadLeft, ddlAdvSwitchDPadLeft, chkDPadLeft); referenceVelocity[(int)GuiDrumPad.RedTom] = pbRedTom; referenceVelocity[(int)GuiDrumPad.YellowTom] = pbYellowTom; referenceVelocity[(int)GuiDrumPad.BlueTom] = pbBlueTom; referenceVelocity[(int)GuiDrumPad.GreenTom] = pbGreenTom; referenceVelocity[(int)GuiDrumPad.YellowCymbal] = pbYellowCymbal; referenceVelocity[(int)GuiDrumPad.BlueCymbal] = pbBlueCymbal; referenceVelocity[(int)GuiDrumPad.GreenCymbal] = pbGreenCymbal; referenceVelocity[(int)GuiDrumPad.PedalLeft] = pbPedalLeft; referenceVelocity[(int)GuiDrumPad.PedalRight] = pbPedalRight; #endregion #region MultiNoteGUi MultiNoteGui = new MultiNoteGui(ddlMNvelCheck, nupMNvelCheck, ddlMNnote, nupMNnoteTo, nupMNvelMult, nupMNvelAdd, btnMNAdd, btnMNRemove, lbMN); #endregion // Tries to load default settings or reverts to if (File.Exists(defaultFilePath)) { m_Serializer.Load(defaultFilePath); } else { m_Serializer.LoadDefaultSettings(); } // Sets high priority and enables search for drums Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; ddlController.Items.Add(ControllerType.Xbox360_GHWT_GH5_Drum); ddlController.Items.Add(ControllerType.Ps3_RockBandProDrum); ddlController.SelectedIndex = 0; FillUsbList(); }
public void SetMidiOutDeviceName(string deviceName) { GuiLinker.SetSelectIndex(ref ddlMIDIDevice, deviceName); }