コード例 #1
0
        public void RefreshTrainer(GuitarTrainerType type)
        {
            try
            {
                ListBox list = null;
                RefreshTextEvents();

                if (type == GuitarTrainerType.ProGuitar)
                {
                    list = listProGuitarTrainers;
                }
                else if (type == GuitarTrainerType.ProBass)
                {
                    list = listProBassTrainers;
                }

                if (list != null)
                {
                    list.BeginUpdate();

                    list.Items.Clear();
                    if (EditorPro.IsLoaded)
                    {
                        foreach (var trainer in ProGuitarTrack.Messages.Trainers.Where(t => t.TrainerType == type).ToList())
                        {
                            list.Items.Add(trainer);
                        }
                    }
                    list.EndUpdate();
                }
            }
            catch { }

            EditorPro.Invalidate();
        }
コード例 #2
0
        public void RefreshModifierListBox(GuitarModifierType type)
        {
            var gmod = listedModifiers.Single(x => x.modifierType == type);

            var listBox      = gmod.modifierList;
            var textBoxStart = gmod.modifierStartBox;
            var textBoxEnd   = gmod.modifierEndBox;

            var gt = EditorPro.GuitarTrack;

            if (gt == null || gt.Messages == null)
            {
                return;
            }

            listBox.Items.Clear();


            var modList = gt.Messages.GetModifiersByType(type).ToList();

            foreach (var obj in modList)
            {
                listBox.Items.Add(new StringObject()
                {
                    Name = type.ToString() + (modList.IndexOf(obj)).ToString(),
                    Obj  = obj,
                });

                obj.Selected = false;
            }

            EditorPro.Invalidate();
        }
コード例 #3
0
        public void RefreshTextEvents()
        {
            EditorPro.ClearTextEventSelection();

            listTextEvents.BeginUpdate();
            listTextEvents.Items.Clear();

            if (EditorPro.IsLoaded)
            {
                foreach (var mev in ProGuitarTrack.Messages.TextEvents)
                {
                    if ((checkBoxShowTrainersInTextEvents.Checked == true &&
                         mev.IsTrainerEvent) || mev.IsTrainerEvent == false)
                    {
                        listTextEvents.Items.Add(mev);
                    }
                }
            }

            listTextEvents.EndUpdate();

            EditorPro.Invalidate();
        }
コード例 #4
0
        public void SelectedModifierChanged(GuitarModifierType type)
        {
            var gmod = listedModifiers.Single(x => x.modifierType == type);

            var listBox      = gmod.modifierList;
            var textBoxStart = gmod.modifierStartBox;
            var textBoxEnd   = gmod.modifierEndBox;


            var gt = EditorPro.GuitarTrack;

            if (gt == null || gt.Messages == null)
            {
                return;
            }

            foreach (var p in gt.Messages.GetModifiersByType(type).ToList())
            {
                p.Selected = false;
            }


            if (listBox.Items.Count >= 0 && listBox.SelectedItem != null)
            {
                var obj = (listBox.SelectedItem as StringObject).Obj as GuitarModifier;
                if (obj != null)
                {
                    obj.Selected = true;

                    textBoxStart.Text = obj.DownTick.ToStringEx();
                    textBoxEnd.Text   = obj.UpTick.ToStringEx();
                }
            }

            EditorPro.Invalidate();
        }
コード例 #5
0
        private void timerMidiPlayback_Tick(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            try
            {
                int ipos = 0;

                if (midiPlaybackSequencer == null)
                {
                    midiPlaybackSequencer = new Sequencer();
                }

                if (!MidiPlaybackInProgress)
                {
                    if (checkChordMode.Checked &&
                        checkBoxChordStrum.Checked &&
                        (DateTime.Now - dtLastStrum).TotalMilliseconds > 500 &&
                        labelMidiInputDeviceState.Text != "None Connected")
                    {
                        var hb = GetHoldBoxes();
                        for (int x = 0; x < hb.Length; x++)
                        {
                            if (hb[x].Text.Length > 0)
                            {
                                if (checkRealtimeNotes.Checked)
                                {
                                    PlaceNote(SelectNextEnum.UseConfiguration);
                                }
                                ClearNoteBoxes();
                                ClearHoldBoxes();

                                break;
                            }
                        }
                    }
                }

                if (MidiPlaybackInProgress)
                {
                    ipos = (int)MidiPlaybackPosition;

                    var pos = ProGuitarTrack.TickToTime(ipos);

                    EditorPro.PlaybackPosition     = pos;
                    EditorPro.MidiPlaybackPosition = MidiPlaybackPosition;


                    if (checkBoxMidiPlaybackScroll.Checked)
                    {
                        EditorPro.ScrollToTick(ipos);
                    }

                    try
                    {
                        if (mp3PlaybackEnabled && MidiPlaybackInProgress)
                        {
                            if (mp3Player.LoadedMP3File && !mp3Player.PlayingMP3File)
                            {
                                BeginSongMP3Playback();
                            }
                        }
                    }
                    catch { }


                    if (MidiPlaybackPosition >= ProGuitarTrack.TotalSongTicks)
                    {
                        StopMidiPlayback();
                    }
                }
            }
            catch { }
        }
コード例 #6
0
        void CheckInstrumentNote(SysExMessageEventArgs e)
        {
            if (labelMidiInputDeviceState.Text == "None Connected")
            {
                if (e.Message.Length == 18)
                {
                    if (e.Message.GetBytes()[3] == 8)
                    {
                        labelMidiInputDeviceState.Text = "Squier";
                    }
                    else if (e.Message.GetBytes()[3] == 0x0A)
                    {
                        labelMidiInputDeviceState.Text = "Mustang";
                    }
                }
            }
            else
            {
                TextBox[] tb = GetNoteBoxes();

                if (e.Message.Length == 18)
                {
                    if (checkBoxEnableClearTimer.Checked)
                    {
                        resetCount--;
                        if (resetCount <= 0)
                        {
                            bool allzero = true;
                            for (int x = 0; x < 6; x++)
                            {
                                if (tb[x].Text.Length > 0 &&
                                    tb[x].Text != "0")
                                {
                                    allzero = false;
                                    break;
                                }
                            }
                            if (allzero)
                            {
                                foreach (var tbox in tb)
                                {
                                    tbox.Text = "";
                                }
                                resetCount = resetTime;
                            }
                        }
                    }
                }
                if (e.Message.Length == 8)
                {
                    resetCount = resetTime;

                    byte[] b = e.Message.GetBytes();

                    int noteString = b[5] - 1;

                    byte[] offsets = new byte[] { 0x40, 0x3B, 0x37, 0x32, 0x2D, 0x28 };

                    bool isStrum = b[4] == 5;


                    if (isStrum)
                    {
                        var dtNowStrum = DateTime.Now;

                        var dtStrumTime = (dtNowStrum - dtLastStrum);


                        if (checkChordMode.Checked == false ||
                            (checkChordMode.Checked == true && checkBoxChordStrum.Checked == true))
                        {
                            if (!checkBoxChordStrum.Checked)
                            {
                                ClearNoteBoxes();
                                ClearHoldBoxes();
                            }
                        }


                        tb[noteString].Text = (guitar6Notes[noteString]).ToString();
                        if (checkTwoNotePowerChord.Checked || checkThreeNotePowerChord.Checked)
                        {
                            if (checkTwoNotePowerChord.Checked)
                            {
                                if (noteString > 0)
                                {
                                    int noteP1 = tb[noteString].Text.ToInt();
                                    if (!noteP1.IsNull())
                                    {
                                        int offset = 2;
                                        if (noteString == 3)
                                        {
                                            offset = 3;
                                        }
                                        tb[noteString - 1].Text = (noteP1 + offset).ToString();
                                    }
                                }
                            }
                            if (checkThreeNotePowerChord.Checked)
                            {
                                if (noteString > 1)
                                {
                                    int noteP1 = tb[noteString].Text.ToInt();
                                    if (!noteP1.IsNull())
                                    {
                                        int offset = 2;
                                        if (noteString == 3 || noteString == 2)
                                        {
                                            offset = 3;
                                        }
                                        tb[noteString - 2].Text = (noteP1 + offset).ToString();
                                    }
                                }
                            }
                        }

                        if (checkChordMode.Checked == false ||
                            (checkChordMode.Checked == true && checkBoxChordStrum.Checked == true))
                        {
                            if (checkBoxChordStrum.Checked == true)
                            {
                                GetHoldBoxes()[noteString].Text = tb[noteString].Text;
                            }
                            else
                            {
                                PlaceHeldNotesIntoHoldBoxes();
                            }
                        }
                        else
                        {
                            PlaceHeldNotesIntoHoldBoxes();
                        }

                        if (checkRealtimeNotes.Checked)
                        {
                            if ((checkChordMode.Checked == true && checkBoxChordStrum.Checked == true) == false)
                            {
                                EditorPro.BackupSequence();
                                PlaceNote(SelectNextEnum.UseConfiguration);
                                ClearNoteBoxes();
                                ClearHoldBoxes();
                            }
                        }

                        if (checkBoxPlayMidiStrum.Checked)
                        {
                            if (dtStrumTime.TotalMilliseconds > 10)
                            {
                                PlayHoldBoxMidi();
                            }
                        }

                        dtLastStrum = DateTime.Now;
                    }
                    else
                    {
                        guitar6Notes[noteString] = b[6] - offsets[noteString];
                        tb[noteString].Text      = (guitar6Notes[noteString]).ToString();
                    }


                    if (checkBoxClearIfNoFrets.Checked == true)
                    {
                        bool allzero = true;
                        for (int x = 0; x < 6; x++)
                        {
                            if (tb[x].Text.Length > 0 &&
                                tb[x].Text != "0")
                            {
                                allzero = false;
                                break;
                            }
                        }
                        if (allzero)
                        {
                            StopHoldBoxMidi();
                            ClearHoldBoxes();
                            ClearNoteBoxes();
                        }
                    }
                }
            }
        }
コード例 #7
0
 public void ClearValue()
 {
     mValueDataEditor = new EditorPro();
     mDefines.Clear();
     mValuePatchs.Clear();
 }