/// <summary> /// ポケミクプラグアンドプレイ用のポーリングタイマ処理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer1_Tick(object sender, EventArgs e) { NSX39 Miku = NSX39.GetInstance(); Miku.PlugAndPlay(() => { Miku.Reset(); ApplyAll(); }); if (Miku.IsActive) { toolStripStatusLabel1.Text = "ポケミクにんしきちゅう!"; } else { toolStripStatusLabel1.Text = "ポケミクがいないよ"; } }
/// <summary> /// フォームがロードされた時に各種初期化を行う。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { Controllers.Add(new ComboAndSlider(groupBox1, Constants.Reverbs, (Obj) => { var This = (ComboAndSlider)Obj; NSX39.GetInstance().Reverb(This.Item.Data, This.Value); } )); Controllers.Add(new ComboAndSlider(groupBox2, Constants.Choruses, (Obj) => { var This = (ComboAndSlider)Obj; NSX39.GetInstance().Chorus(This.Item.Data, This.Value); } )); Controllers.Add(new ComboAndSlider(groupBox3, Constants.VarEffects, (Obj) => { var This = (ComboAndSlider)Obj; NSX39.GetInstance().VariationEffect(This.Item.Data, This.Value); } )); PianoPane = new Piano(panel3, (NoteNo, NoteOn) => { NSX39.GetInstance().Note(NoteOn, ((ComboItem <int>)comboBox4.SelectedItem).Data, 12 * comboBox6.SelectedIndex + NoteNo, 100); }); Controllers.Add(new ComboOnly(comboBox5, Constants.Programs, (Obj) => { var This = (ComboOnly)Obj; NSX39.GetInstance().ProgramChange(1, This.Index); })); Controllers.Add(new TextAndButton(panel1, (Obj) => { var This = (TextAndButton)Obj; var Reg = new Regex("(?<Lyric>[あ-ん][ぁぃぅぇぉゃゅょ]?)"); var Matches = Reg.Matches(This.Text); var LyricArray = new List <byte>(); foreach (Match Mat in Matches) { byte Tmp; if (Constants.Lyrics.TryGetValue(Mat.Value, out Tmp)) { LyricArray.Add(Tmp); } else { LyricArray.Add(Constants.Lyrics["ん"]); } } NSX39.GetInstance().Lyrics(LyricArray.ToArray()); })); comboBox4.Items.AddRange(Constants.Channels.ToArray()); comboBox4.SelectedIndex = 0; comboBox6.SelectedIndex = 5; }
/// <summary> /// フォームを閉じるときにポケミクを閉じる /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_FormClosed(object sender, FormClosedEventArgs e) { NSX39.GetInstance().Close(); }
/// <summary> /// フォームがロードされた時に各種初期化を行う。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { Controllers.Add(new ComboAndSlider(groupBox1, Constants.Reverbs, (Obj) => { var This = (ComboAndSlider)Obj; NSX39.GetInstance().Reverb(This.Item.Data, This.Value); })); Controllers.Add(new ComboAndSlider(groupBox2, Constants.Choruses, (Obj) => { var This = (ComboAndSlider)Obj; NSX39.GetInstance().Chorus(This.Item.Data, This.Value); })); Controllers.Add(new ComboAndSlider(groupBox3, Constants.VarEffects, (Obj) => { var This = (ComboAndSlider)Obj; NSX39.GetInstance().VariationEffect(This.Item.Data, This.Value); })); PianoPane = new Piano(panel7, (NoteNo, NoteOn) => { NSX39.GetInstance().Note(NoteOn, 0, 12 * comboBox6.SelectedIndex + NoteNo, 100); }); PianoPane = new Piano(panel8, (NoteNo, NoteOn) => { NSX39.GetInstance().Note(NoteOn, ((ComboItem <int>)comboBox9.SelectedItem).Data, 12 * comboBox7.SelectedIndex + NoteNo, 100); }); Controllers.Add(new ComboOnly <byte>(comboBox8, Constants.Programs, (Obj) => { var This = (ComboOnly <byte>)Obj; NSX39.GetInstance().ProgramChange(1, This.Item.Data); })); Controllers.Add(new TextAndButton(panel1, (Obj) => { var This = (TextAndButton)Obj; NSX39.GetInstance().Lyrics(GetLyricsCode(This.Text)); }, GetLyricErrorPos)); Controllers.Add(new ToggleAndTouchButton(touchSupportedButton1, (Obj) => { var This = (ToggleAndTouchButton)Obj; if (This.On) { touchSupportedButton1.BackColor = Color.Red; NSX39.GetInstance().ControlChange(0, 1, 100); } else { touchSupportedButton1.BackColor = SystemColors.ButtonShadow; NSX39.GetInstance().ControlChange(0, 1, 0); } })); Controllers.Add(new ToggleAndTouchButton(touchSupportedButton2, (Obj) => { var This = (ToggleAndTouchButton)Obj; if (This.On) { touchSupportedButton2.BackColor = Color.Red; NSX39.GetInstance().ControlChange(((ComboItem <int>)comboBox9.SelectedItem).Data, 1, 100); } else { touchSupportedButton2.BackColor = SystemColors.ButtonShadow; NSX39.GetInstance().ControlChange(((ComboItem <int>)comboBox9.SelectedItem).Data, 1, 0); } })); Controllers.Add(new ComboOnly <byte>(comboBox4, Constants.VibTypes, (Obj) => { var This = (ComboOnly <byte>)Obj; NSX39.GetInstance().NRPN(0, 0x70, 0x03, This.Item.Data); })); comboBox4.SelectedIndex = 0; comboBox9.Items.AddRange(Constants.Channels); comboBox9.SelectedIndex = 0; comboBox6.SelectedIndex = 5; comboBox7.SelectedIndex = 5; }