public static int[] GetKnownData1ForDifficulty(bool isPro, GuitarDifficulty diff)
        {
            List <int> ret = new List <int>();

            for (int x = 0; x < 128; x++)
            {
                var d = x.GetData1Difficulty(isPro);
                if (d.IsAll() && diff.IsAll())
                {
                    ret.Add(x);
                }
                else if (d.IsExpert() && diff.IsExpert())
                {
                    ret.Add(x);
                }
                else if (d.IsHard() && diff.IsHard())
                {
                    ret.Add(x);
                }
                else if (d.IsMedium() && diff.IsMedium())
                {
                    ret.Add(x);
                }
                else if (d.IsEasy() && diff.IsEasy())
                {
                    ret.Add(x);
                }
            }
            return(ret.ToArray());
        }
        void peTrack_DifficultyItemDropped(PEMidiTrack sender, GuitarDifficulty difficulty, DragEventArgs e)
        {
            var o = e.GetDropObject <PETrackDifficulty>();

            o.IfObjectNotNull(op =>
            {
                DoRequestBackup();

                var messages = sender.Track.GetChanMessagesByDifficulty(difficulty);
                sender.Track.Remove(messages);

                var otrack = o.MidiTrack.Track;

                var clonedTrack = otrack.CloneDifficulty(o.Difficulty, difficulty, sender.Track.FileType);

                var clonedMessages = clonedTrack.GetChanMessagesByDifficulty(difficulty).ToList();

                foreach (var msg in clonedMessages)
                {
                    sender.Track.Insert(msg.AbsoluteTicks, msg.Clone());
                }

                SetSelectedItem(sender.Track, o.Difficulty);

                TrackClicked.IfObjectNotNull(x => x(this, sender.Track.Sequence, sender.Track, difficulty));
            });
        }
Beispiel #3
0
        public GuitarChord CloneToMemory(GuitarMessageList owner, GuitarDifficulty difficulty)
        {
            GuitarChord ret   = null;
            var         notes = Notes.Select(x => x.CloneToMemory(owner)).Where(x => x != null).ToList();

            if (notes.Any())
            {
                ret = GuitarChord.GetChord(owner, difficulty, notes, false);
                if (ret != null)
                {
                    if (HasSlide)
                    {
                        ret.AddSlide(HasSlideReversed, false);
                    }
                    if (HasStrum)
                    {
                        ret.AddStrum(StrumMode, false);
                    }
                    if (HasHammeron)
                    {
                        ret.AddHammeron(false);
                    }
                }
            }
            return(ret);
        }
Beispiel #4
0
        private void SelectTrack(Sequence sequence, Track track, GuitarDifficulty difficulty)
        {
            if (DesignMode)
            {
                return;
            }
            if (sequence != null && track != null)
            {
                if (lastTrack != null && sequence.Contains(lastTrack))
                {
                    TrackProperties.FirstOrDefault(x => x.Track == lastTrack).IfObjectNotNull(x => UpdateWebTabTrack(x));
                }

                lastTrack = track;


                if (!TrackProperties.Any(x => x.Track == track))
                {
                    TrackProperties.Add(new WebTabTrackProperties(track, EditorPro));
                }
            }
            else
            {
                TrackProperties.Clear();

                lastTrack = null;
            }

            setWebTabTrackToScreen(track == null ? null : TrackProperties.FirstOrDefault(x => x.Track == track));
        }
Beispiel #5
0
        public GuitarTrack SetTrack(Track selectedTrack, GuitarDifficulty diff)
        {
            if (selectedTrack == null || midiTrack == null)
            {
                midiTrack   = null;
                dirtyItems |= DirtyItem.Track;
            }
            if (selectedTrack != null)
            {
                if (midiTrack == selectedTrack && !midiTrack.Dirty && currentDifficulty == diff && dirtyItems == DirtyItem.None)
                {
                }
                else
                {
                    midiTrack         = selectedTrack;
                    currentDifficulty = diff;

                    if (midiTrack == null || midiTrack.Sequence == null)
                    {
                        this.SequenceDivision = 480;
                    }
                    else
                    {
                        this.SequenceDivision = midiTrack.Sequence.Division;
                    }

                    RebuildEvents();

                    this.dirtyItems     = DirtyItem.None;
                    selectedTrack.Dirty = false;
                }
            }
            return(this);
        }
Beispiel #6
0
        public static GuitarChord GetChord(GuitarMessageList owner,
                                           GuitarDifficulty difficulty,
                                           TickPair ticks,
                                           GuitarChordConfig config)
        {
            GuitarChord ret = null;

            var lowE = Utility.GetStringLowE(difficulty);

            var notes = new List <GuitarNote>();

            for (int x = 0; x < config.Frets.Length; x++)
            {
                var fret    = config.Frets[x];
                var channel = config.Channels[x];

                if (!fret.IsNull() && fret >= 0 && fret <= 23)
                {
                    var note = GuitarNote.GetNote(owner,
                                                  difficulty, ticks, x, fret,
                                                  channel == Utility.ChannelTap,
                                                  channel == Utility.ChannelArpeggio,
                                                  channel == Utility.ChannelX);

                    if (note != null && note.NoteFretDown.IsNotNull() && note.NoteString.IsNotNull())
                    {
                        notes.Add(note);
                    }
                    else
                    {
                    }
                }
            }

            if (notes.Any())
            {
                ret             = new GuitarChord(owner, ticks, difficulty, notes);
                ret.chordConfig = config.Clone();

                if (ret != null)
                {
                    if (config.IsSlide || config.IsSlideReverse)
                    {
                        ret.AddSlide(config.IsSlideReverse, false);
                    }

                    if (config.IsHammeron)
                    {
                        ret.AddHammeron(false);
                    }

                    ret.AddStrum(config.StrumMode, false);
                }
            }

            return(ret);
        }
Beispiel #7
0
        public void CreateChordNameEvents(GuitarDifficulty difficulty,
                                          int[] GuitarTuning, int[] BassTuning, Track ownerTrack)
        {
            var x108 = Generate108().Where(x => x.Chord != null).ToList();

            foreach (var item in x108)
            {
                if (item.Chord.Notes.Count() > 1)
                {
                    ChordNameMeta name = null;
                    if (ownerTrack.Name.IsBassTrackName())
                    {
                        name = item.Chord.GetTunedChordName(BassTuning);
                    }
                    else
                    {
                        name = item.Chord.GetTunedChordName(GuitarTuning);
                    }

                    int data1            = -1;
                    var useUserChordName = false;
                    var chordName        = string.Empty;
                    var hideChordName    = false;

                    item.Chord.RootNoteConfig.IfNotNull(x => useUserChordName = x.UseUserChordName);
                    item.Chord.RootNoteConfig.IfNotNull(x => chordName        = x.UserChordName);
                    item.Chord.RootNoteConfig.IfNotNull(x => data1            = x.RootNoteData1);
                    item.Chord.RootNoteConfig.IfNotNull(x => hideChordName    = x.HideNoteName);

                    if (difficulty == GuitarDifficulty.Expert)
                    {
                        if (hideChordName || (data1 == -1 && (name == null || (name != null && name.ToneName.ToToneNameData1() == ToneNameData1.NotSet))))
                        {
                            ownerTrack.Insert(item.Ticks.Down, new ChannelMessage(ChannelCommand.NoteOn, Utility.ChordNameHiddenData1, 100 + item.Fret));
                            ownerTrack.Insert(item.Ticks.Up, new ChannelMessage(ChannelCommand.NoteOff, Utility.ChordNameHiddenData1, 0));
                        }
                        else
                        {
                            if (data1 == -1)
                            {
                                data1 = name.ToneName.ToToneNameData1().ToInt();
                            }
                            ownerTrack.Insert(item.Ticks.Down, new ChannelMessage(ChannelCommand.NoteOn, data1, 100 + item.Fret));
                            ownerTrack.Insert(item.Ticks.Up, new ChannelMessage(ChannelCommand.NoteOff, data1, 0));
                        }
                    }


                    var chordNameText = Utility.CreateChordNameText(item.Chord.Difficulty, useUserChordName ? chordName : name.ToStringEx());

                    if (chordNameText.IsNotEmpty())
                    {
                        ownerTrack.Insert(item.Chord.AbsoluteTicks, new MetaMessage(MetaType.Text, chordNameText));
                    }
                }
            }
        }
        public static GuitarNote CreateNote(GuitarMessageList owner, GuitarDifficulty diff, TickPair ticks,
                                            int noteString, int noteFret, bool isTap, bool isArpeggio, bool isX)
        {
            var ret = GetNote(owner, diff, ticks, noteString, noteFret, isTap, isArpeggio, isX);

            ret.IsNew = true;
            ret.CreateEvents();

            return(ret);
        }
Beispiel #9
0
            public PEListViewItem(PEListView ownerView, PEListView.PEListViewItem parentItem, string text, Track track, GuitarDifficulty difficulty)
                : base(text)
            {
                this.StateImageIndex = 0;

                this.ownerView  = ownerView;
                this.parentItem = parentItem;
                this.track      = track;
                this.difficulty = difficulty;
            }
        void t_TrackDifficultyChanged(object sender, Track track, GuitarDifficulty difficulty)
        {
            (sender as PEMidiTrack).IfObjectNotNull(x =>
            {
                SelectedTrack = x;
            });

            this.SelectedDifficulty = difficulty;

            TrackClicked.IfObjectNotNull(x => x(this, track.Sequence, track, difficulty));
        }
 public static int GetStrumData1(GuitarDifficulty diff)
 {
     if (diff.IsExpertAll())
     {
         return(ExpertStrumData1);
     }
     else if (diff.IsHard())
     {
         return(HardStrumData1);
     }
     return(Int32.MinValue);
 }
Beispiel #12
0
        public static IEnumerable <int> GetData1ForModifierType(this GuitarModifierType type,
                                                                GuitarDifficulty difficulty = GuitarDifficulty.All, bool isPro = true)
        {
            var ret = new List <int>();

            switch (type)
            {
            case GuitarModifierType.Arpeggio:
            {
                ret.AddRange(Utility.AllArpeggioData1);
            }
            break;

            case GuitarModifierType.BigRockEnding:
            {
                ret.AddRange(Utility.BigRockEndingData1);
            }
            break;

            case GuitarModifierType.Powerup:
            {
                ret.AddRange(Utility.PowerupData1.MakeEnumerable());
            }
            break;

            case GuitarModifierType.Solo:
            {
                if (isPro)
                {
                    ret.AddRange(Utility.SoloData1.MakeEnumerable());
                }
                else
                {
                    ret.AddRange(Utility.SoloData1.MakeEnumerable().Concat(Utility.SoloData1_G5));
                }
            }
            break;

            case GuitarModifierType.MultiStringTremelo:
            {
                ret.AddRange(Utility.MultiStringTremeloData1.MakeEnumerable());
            }
            break;

            case GuitarModifierType.SingleStringTremelo:
            {
                ret.AddRange(Utility.SingleStringTremeloData1.MakeEnumerable());
            }
            break;
            }
            return(ret);
        }
Beispiel #13
0
        public static GuitarChord GetChord(GuitarMessageList owner,
                                           GuitarDifficulty difficulty,
                                           IEnumerable <GuitarNote> notes,
                                           bool findModifiers = true)
        {
            GuitarChord ret = null;

            try
            {
                if (notes != null && notes.Any())
                {
                    if (notes.Any(x => x.IsDeleted))
                    {
                        Debug.WriteLine("getting deleted note");
                    }

                    var tickPair = notes.GetTickPairSmallest();

                    if (!tickPair.IsValid)
                    {
                        Debug.WriteLine("short chord");
                        return(ret);
                    }

                    var unfit = notes.Where(x => x.TickPair != tickPair);
                    if (unfit.Any())
                    {
                        unfit.ForEach(x => x.SetTicks(tickPair));
                    }

                    ret = new GuitarChord(owner, tickPair, difficulty, notes.ToList());

                    if (findModifiers)
                    {
                        ret.Modifiers.AddRange(owner.Hammerons.Where(x => x.Chord == null).GetBetweenTick(ret.TickPair).ToList());
                        ret.Modifiers.AddRange(owner.Slides.Where(x => x.Chord == null).GetBetweenTick(ret.TickPair).ToList());
                        ret.Modifiers.AddRange(owner.ChordStrums.Where(x => x.Chord == null).GetBetweenTick(ret.TickPair).ToList());

                        ret.ChordNameEvents.SetNames(owner.ChordNames.GetAtTick(ret.AbsoluteTicks).ToList());

                        var mods = ret.Modifiers.Where(x => x.TickPair != ret.TickPair).ToList();
                        foreach (var mod in mods)
                        {
                            mod.SetTicks(ret.TickPair);
                        }
                        mods.ForEach(x => x.Chord = ret);
                    }
                }
            }
            catch (Exception ex) { Debug.WriteLine("GetChord: " + ex.Message); }
            return(ret);
        }
 public static GuitarArpeggio CreateArpeggio(GuitarMessageList owner, TickPair ticks, GuitarDifficulty difficulty)
 {
     GuitarArpeggio ret = null;
     if (Utility.GetArpeggioData1(difficulty).IsNotNull())
     {
         ret = new GuitarArpeggio(owner, ticks, difficulty);
         if (ret != null)
         {
             ret.IsNew = true;
             ret.CreateEvents();
         }
     }
     return ret;
 }
Beispiel #15
0
        public static GuitarChord CreateChord(GuitarMessageList owner, GuitarDifficulty difficulty, TickPair ticks,
                                              GuitarChordConfig config)
        {
            GuitarChord ret = null;

            ret = GetChord(owner, difficulty, ticks, config);

            if (ret != null)
            {
                ret.IsNew = true;
                ret.CreateEvents();
            }
            return(ret);
        }
        public static IEnumerable<int> GetData1ForModifierType(this GuitarModifierType type,
            GuitarDifficulty difficulty = GuitarDifficulty.All, bool isPro = true)
        {
            var ret = new List<int>();
            switch (type)
            {

                case GuitarModifierType.Arpeggio:
                    {
                        ret.AddRange(Utility.AllArpeggioData1);
                    }
                    break;
                case GuitarModifierType.BigRockEnding:
                    {
                        ret.AddRange(Utility.BigRockEndingData1);
                    }
                    break;
                case GuitarModifierType.Powerup:
                    {
                        ret.AddRange(Utility.PowerupData1.MakeEnumerable());
                    }
                    break;
                case GuitarModifierType.Solo:
                    {
                        if (isPro)
                        {
                            ret.AddRange(Utility.SoloData1.MakeEnumerable());
                        }
                        else
                        {
                            ret.AddRange(Utility.SoloData1.MakeEnumerable().Concat(Utility.SoloData1_G5));
                        }
                    }
                    break;
                case GuitarModifierType.MultiStringTremelo:
                    {
                        ret.AddRange(Utility.MultiStringTremeloData1.MakeEnumerable());
                    }
                    break;
                case GuitarModifierType.SingleStringTremelo:
                    {
                        ret.AddRange(Utility.SingleStringTremeloData1.MakeEnumerable());
                    }
                    break;

            }
            return ret;
        }
Beispiel #17
0
        public static IEnumerable <int> GetData1ForChordModifierType(this ChordModifierType type,
                                                                     GuitarDifficulty difficulty, bool isPro)
        {
            var ret = new List <int>();

            if (difficulty.IsAll())
            {
                difficulty = GuitarDifficulty.Expert;
            }

            switch (type)
            {
            case ChordModifierType.Hammeron:
            {
                var d1 = Utility.GetHammeronData1(difficulty);

                if (!d1.IsNull())
                {
                    ret.Add(d1);
                }
            }
            break;

            case ChordModifierType.Slide:
            case ChordModifierType.SlideReverse:
            {
                var d1 = Utility.GetSlideData1(difficulty);
                if (!d1.IsNull())
                {
                    ret.Add(d1);
                }
            }
            break;

            case ChordModifierType.ChordStrumLow:
            case ChordModifierType.ChordStrumMed:
            case ChordModifierType.ChordStrumHigh:
            {
                var d1 = Utility.GetStrumData1(difficulty);
                if (!d1.IsNull())
                {
                    ret.Add(d1);
                }
            }
            break;
            }
            return(ret);
        }
 public static int GetStringLowE5(GuitarDifficulty difficulty)
 {
     if (difficulty == GuitarDifficulty.Easy)
     {
         return(EasyData1LowE5);
     }
     if (difficulty == GuitarDifficulty.Medium)
     {
         return(MediumData1LowE5);
     }
     if (difficulty == GuitarDifficulty.Hard)
     {
         return(HardData1LowE5);
     }
     return(ExpertData1LowE);
 }
        public static int GetNoteData1(int stringOffset, GuitarDifficulty difficulty, bool isPro)
        {
            int ret = Int32.MinValue;

            if (stringOffset >= 0)
            {
                if (isPro)
                {
                    if (difficulty == GuitarDifficulty.Expert && stringOffset < ExpertData1Strings.Length)
                    {
                        ret = ExpertData1Strings[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Hard && stringOffset < HardData1Strings.Length)
                    {
                        ret = HardData1Strings[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Medium && stringOffset < MediumData1Strings.Length)
                    {
                        ret = MediumData1Strings[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Easy && stringOffset < EasyData1Strings.Length)
                    {
                        ret = EasyData1Strings[stringOffset];
                    }
                }
                else
                {
                    if (difficulty == GuitarDifficulty.Expert && stringOffset < ExpertData1StringsG5.Length)
                    {
                        ret = ExpertData1StringsG5[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Hard && stringOffset < HardData1StringsG5.Length)
                    {
                        ret = HardData1StringsG5[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Medium && stringOffset < MediumData1StringsG5.Length)
                    {
                        ret = MediumData1StringsG5[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Easy && stringOffset < EasyData1StringsG5.Length)
                    {
                        ret = EasyData1StringsG5[stringOffset];
                    }
                }
            }
            return(ret);
        }
        void setDifficulty(GuitarDifficulty diff)
        {
            if (!diff.IsEasyMediumHardExpert())
            {
                diff = GuitarDifficulty.Expert;
            }

            if (SelectedDifficulty != diff)
            {
                SelectedDifficulty = diff;

                this.track.IfObjectNotNull(tr =>
                                           TrackDifficultyChanged.IfObjectNotNull(x => x(this, tr, this.SelectedDifficulty)));
            }
            else
            {
                TrackClicked.IfObjectNotNull(x => x(this, this.track, this.SelectedDifficulty));
            }
        }
        public static IEnumerable<int> GetData1ForChordModifierType(this ChordModifierType type,
            GuitarDifficulty difficulty, bool isPro)
        {
            var ret = new List<int>();
            if (difficulty.IsAll())
                difficulty = GuitarDifficulty.Expert;

            switch (type)
            {
                case ChordModifierType.Hammeron:
                    {
                        var d1 = Utility.GetHammeronData1(difficulty);

                        if (!d1.IsNull())
                        {
                            ret.Add(d1);
                        }
                    }
                    break;
                case ChordModifierType.Slide:
                case ChordModifierType.SlideReverse:
                    {
                        var d1 = Utility.GetSlideData1(difficulty);
                        if (!d1.IsNull())
                        {
                            ret.Add(d1);
                        }
                    }
                    break;
                case ChordModifierType.ChordStrumLow:
                case ChordModifierType.ChordStrumMed:
                case ChordModifierType.ChordStrumHigh:
                    {
                        var d1 = Utility.GetStrumData1(difficulty);
                        if (!d1.IsNull())
                        {
                            ret.Add(d1);
                        }
                    }
                    break;
            }
            return ret;
        }
Beispiel #22
0
        public GuitarChord(GuitarMessageList owner, TickPair pair, GuitarDifficulty difficulty, IEnumerable <GuitarNote> notes)
            : base(owner, pair, GuitarMessageType.GuitarChord)
        {
            Notes           = new GuitarChordNoteList(this);
            Modifiers       = new List <ChordModifier>();
            ChordNameEvents = new GuitarChordNameList(this);

            Notes.SetNotes(notes);
            SetTicks(pair);

            chordConfig = new GuitarChordConfig()
            {
                Frets          = this.NoteFrets.ToArray(),
                Channels       = this.NoteChannels.ToArray(),
                IsHammeron     = this.HasHammeron,
                IsSlide        = this.HasSlide,
                IsSlideReverse = this.HasSlideReversed,
                StrumMode      = this.StrumMode,
            };
        }
 public static int GetSoloData1_G5(GuitarDifficulty difficulty)
 {
     if (difficulty.IsUnknown() || difficulty.IsAll() || difficulty.IsExpert())
     {
         return(ExpertSoloData1_G5);
     }
     if (difficulty.IsHard())
     {
         return(HardSoloData1_G5);
     }
     else if (difficulty.IsMedium())
     {
         return(MediumSoloData1_G5);
     }
     else if (difficulty.IsEasy())
     {
         return(EasySoloData1_G5);
     }
     return(ExpertSoloData1_G5);
 }
        public GuitarChord Deserialize(GuitarMessageList owner, GuitarDifficulty diff, TickPair ticks)
        {
            int[] frets;
            int[] channels;
            ChordStrum chordStrum;
            bool isSlide;
            bool isSlideReverse;
            bool isHammeron;
            GuitarChordRootNoteConfig rootConfig;
            GetProperties(out frets, out channels, out chordStrum, out isSlide, out isSlideReverse, out isHammeron, out rootConfig);

            var ret = GuitarChord.CreateChord(owner, diff, ticks,
                new GuitarChordConfig(frets, channels,
                    isSlide,
                    isSlideReverse,
                    isHammeron,
                    chordStrum,
                        rootConfig));

            return ret;
        }
        public GuitarChord Deserialize(GuitarMessageList owner, GuitarDifficulty diff, TickPair ticks)
        {
            int[]      frets;
            int[]      channels;
            ChordStrum chordStrum;
            bool       isSlide;
            bool       isSlideReverse;
            bool       isHammeron;
            GuitarChordRootNoteConfig rootConfig;

            GetProperties(out frets, out channels, out chordStrum, out isSlide, out isSlideReverse, out isHammeron, out rootConfig);

            var ret = GuitarChord.CreateChord(owner, diff, ticks,
                                              new GuitarChordConfig(frets, channels,
                                                                    isSlide,
                                                                    isSlideReverse,
                                                                    isHammeron,
                                                                    chordStrum,
                                                                    rootConfig));

            return(ret);
        }
        public static string GetChordNameTextPrefix(GuitarDifficulty difficulty)
        {
            int iDiff;

            if (difficulty.IsExpertAll())
            {
                iDiff = 3;
            }
            else if (difficulty.IsHard())
            {
                iDiff = 2;
            }
            else if (difficulty.IsMedium())
            {
                iDiff = 1;
            }
            else
            {
                iDiff = 0;
            }
            return("chrd" + iDiff + " ");
        }
        public static IEnumerable <int> GetStringsForDifficulty5(GuitarDifficulty diff)
        {
            var ret = new List <int>();

            if (diff.HasFlag(GuitarDifficulty.Easy))
            {
                ret.AddRange(EasyData1StringsG5);
            }
            if (diff.HasFlag(GuitarDifficulty.Medium))
            {
                ret.AddRange(MediumData1StringsG5);
            }
            if (diff.HasFlag(GuitarDifficulty.Hard))
            {
                ret.AddRange(HardData1StringsG5);
            }
            if (diff.HasFlag(GuitarDifficulty.Expert))
            {
                ret.AddRange(ExpertData1StringsG5);
            }
            return(ret);
        }
 public static int GetSlideData1(GuitarDifficulty diff)
 {
     if (diff.IsExpertAll())
     {
         return(ExpertSlideData1);
     }
     else if (diff.IsHard())
     {
         return(HardSlideData1);
     }
     else if (diff.IsMedium())
     {
         return(MediumSlideData1);
     }
     else if (diff.IsEasy())
     {
         return(EasySlideData1);
     }
     else
     {
         return(Int32.MinValue);
     }
 }
        public static GuitarNote GetNotePro(GuitarMessageList owner, GuitarDifficulty diff,
                                            TickPair ticks, int noteString, int noteFret, bool isTap, bool isArpeggio, bool isX)
        {
            var ret = new GuitarNote(owner, ticks);

            ret.Data1        = Utility.GetNoteData1(noteString, diff, true);
            ret.NoteFretDown = noteFret;

            if (isX)
            {
                ret.Channel = Utility.ChannelX;
            }
            else if (isArpeggio)
            {
                ret.Channel = Utility.ChannelArpeggio;
            }
            else if (isTap)
            {
                ret.Channel = Utility.ChannelTap;
            }

            return(ret);
        }
 public static int GetHammeronData1(GuitarDifficulty diff)
 {
     if (diff.IsExpertAll())
     {
         return(ExpertHammeronData1);
     }
     else if (diff.IsHard())
     {
         return(HardHammeronData1);
     }
     else if (diff.IsMedium())
     {
         return(MediumHammeronData1);
     }
     else if (diff.IsEasy())
     {
         return(EasyHammeronData1);
     }
     else
     {
         return(Int32.MinValue);
     }
 }
        bool SetSelectedItem(Track item, GuitarDifficulty difficulty)
        {
            bool ret = true;

            if (item != null)
            {
                var sel    = SelectedTrack;
                var newSel = TrackList.SingleOrDefault(x => x.Track == item);
                if (sel == null || sel != newSel)
                {
                    ret           = true;
                    SelectedTrack = newSel;
                }
            }
            else
            {
                SelectedTrack = null;
            }
            SelectedDifficulty = difficulty;

            panelTracks.Invalidate();
            return(ret);
        }
 public void SetTrack(Track track, GuitarDifficulty difficulty)
 {
     if (!settingTrack)
     {
         settingTrack = true;
         try
         {
             if (track != null)
             {
                 this.sequence = track.Sequence;
             }
             else
             {
                 this.sequence = null;
             }
             if (this.sequence == null)
             {
                 panelTracks.Controls.Clear();
                 SelectedTrack = null;
                 Invalidate();
             }
             else
             {
                 this.CreatePanelTracks(this.sequence);
                 if (SetSelectedItem(track, difficulty))
                 {
                     t_TrackClicked(this, track, difficulty);
                 }
             }
         }
         finally
         {
             settingTrack = false;
         }
     }
 }
 public PETrackDifficulty(PEMidiTrack track, GuitarDifficulty diff)
 {
     this.MidiTrack = track;
     this.Difficulty = diff;
 }
 public static int GetStrumData1(GuitarDifficulty diff)
 {
     if (diff.IsExpertAll())
     {
         return ExpertStrumData1;
     }
     else if (diff.IsHard())
     {
         return HardStrumData1;
     }
     return Int32.MinValue;
 }
 public static string CreateChordNameText(GuitarDifficulty difficulty, string chordName)
 {
     return "[" + GetChordNameTextPrefix(difficulty) + " " + chordName.GetIfEmpty(" ") + "]";
 }
 private void trackEditorPro_TrackClicked(PEMidiTrackEditPanel sender, Sequence sequence, Track track, GuitarDifficulty difficulty)
 {
     sender.SetTrack(track, difficulty);
     SelectTrack(sequence, track, difficulty);
 }
 public bool SetTrack(string name, GuitarDifficulty difficulty = GuitarDifficulty.Unknown)
 {
     var ret = false;
     if (difficulty.IsUnknown())
         difficulty = this.CurrentDifficulty;
     var track = GetTrack(name);
     if (track != null)
     {
         ret = SetTrack(track, difficulty);
     }
     return ret;
 }
 public bool SetTrack6(Track t, GuitarDifficulty difficulty = GuitarDifficulty.Unknown)
 {
     return SetTrack6(this.Sequence == null ? t != null ? t.Sequence : null : this.Sequence, t, difficulty);
 }
 public static int GetSlideData1(GuitarDifficulty diff)
 {
     if (diff.IsExpertAll())
     {
         return ExpertSlideData1;
     }
     else if (diff.IsHard())
     {
         return HardSlideData1;
     }
     else if (diff.IsMedium())
     {
         return MediumSlideData1;
     }
     else if (diff.IsEasy())
     {
         return EasySlideData1;
     }
     else
     {
         return Int32.MinValue;
     }
 }
        public static int GetModifierData1ForDifficulty(
            int sourceData1,
            GuitarDifficulty sourceDifficulty,
            GuitarDifficulty targetDifficulty)
        {
            if (targetDifficulty.IsUnknown())
                targetDifficulty = sourceDifficulty;

            if (AllHammeronData1.Contains(sourceData1))
            {
                if (targetDifficulty == GuitarDifficulty.Expert)
                {
                    return ExpertHammeronData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Hard)
                {
                    return HardHammeronData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Medium)
                {
                    return MediumHammeronData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Easy)
                {
                    return EasyHammeronData1;
                }
                else
                {
                    return Int32.MinValue;
                }
            }
            else if (AllSlideData1.Contains(sourceData1))
            {
                if (targetDifficulty == GuitarDifficulty.Expert)
                {
                    return ExpertSlideData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Hard)
                {
                    return HardSlideData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Medium)
                {
                    return MediumSlideData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Easy)
                {
                    return EasySlideData1;
                }
                else
                {
                    return Int32.MinValue;
                }
            }
            else if (AllArpeggioData1.Contains(sourceData1))
            {
                if (targetDifficulty == GuitarDifficulty.Expert)
                {
                    return ExpertArpeggioData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Hard)
                {
                    return HardArpeggioData1;
                }
                else
                {
                    return Int32.MinValue;
                }
            }
            else if (AllStrumData1.Contains(sourceData1))
            {
                if (targetDifficulty == GuitarDifficulty.Expert)
                {
                    return ExpertStrumData1;
                }
                else if (targetDifficulty == GuitarDifficulty.Hard)
                {
                    return HardStrumData1;
                }
                else
                {
                    return Int32.MinValue;
                }
            }

            else
            {
                return Int32.MinValue;
            }
        }
        public static int GetNoteData1(int stringOffset, GuitarDifficulty difficulty, bool isPro)
        {
            int ret = Int32.MinValue;

            if (stringOffset >= 0)
            {
                if (isPro)
                {
                    if (difficulty == GuitarDifficulty.Expert && stringOffset < ExpertData1Strings.Length)
                    {
                        ret = ExpertData1Strings[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Hard && stringOffset < HardData1Strings.Length)
                    {
                        ret = HardData1Strings[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Medium && stringOffset < MediumData1Strings.Length)
                    {
                        ret = MediumData1Strings[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Easy && stringOffset < EasyData1Strings.Length)
                    {
                        ret = EasyData1Strings[stringOffset];
                    }
                }
                else
                {
                    if (difficulty == GuitarDifficulty.Expert && stringOffset < ExpertData1StringsG5.Length)
                    {
                        ret = ExpertData1StringsG5[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Hard && stringOffset < HardData1StringsG5.Length)
                    {
                        ret = HardData1StringsG5[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Medium && stringOffset < MediumData1StringsG5.Length)
                    {
                        ret = MediumData1StringsG5[stringOffset];
                    }
                    else if (difficulty == GuitarDifficulty.Easy && stringOffset < EasyData1StringsG5.Length)
                    {
                        ret = EasyData1StringsG5[stringOffset];
                    }
                }
            }
            return ret;
        }
 public static int[] GetKnownData1ForDifficulty(bool isPro, GuitarDifficulty diff)
 {
     List<int> ret = new List<int>();
     for (int x = 0; x < 128; x++)
     {
         var d = x.GetData1Difficulty(isPro);
         if (d.IsAll() && diff.IsAll())
         {
             ret.Add(x);
         }
         else if (d.IsExpert() && diff.IsExpert())
         {
             ret.Add(x);
         }
         else if (d.IsHard() && diff.IsHard())
         {
             ret.Add(x);
         }
         else if (d.IsMedium() && diff.IsMedium())
         {
             ret.Add(x);
         }
         else if (d.IsEasy() && diff.IsEasy())
         {
             ret.Add(x);
         }
     }
     return ret.ToArray();
 }
 public static int GetHammeronData1(GuitarDifficulty diff)
 {
     if (diff.IsExpertAll())
     {
         return ExpertHammeronData1;
     }
     else if (diff.IsHard())
     {
         return HardHammeronData1;
     }
     else if (diff.IsMedium())
     {
         return MediumHammeronData1;
     }
     else if (diff.IsEasy())
     {
         return EasyHammeronData1;
     }
     else
     {
         return Int32.MinValue;
     }
 }
 public static string GetChordNameTextPrefix(GuitarDifficulty difficulty)
 {
     int iDiff;
     if (difficulty.IsExpertAll())
     {
         iDiff = 3;
     }
     else if (difficulty.IsHard())
     {
         iDiff = 2;
     }
     else if (difficulty.IsMedium())
     {
         iDiff = 1;
     }
     else
     {
         iDiff = 0;
     }
     return "chrd" + iDiff + " ";
 }
        void setDifficulty(GuitarDifficulty diff)
        {
            if (!diff.IsEasyMediumHardExpert())
                diff = GuitarDifficulty.Expert;

            if (SelectedDifficulty != diff)
            {
                SelectedDifficulty = diff;

                this.track.IfObjectNotNull(tr =>
                    TrackDifficultyChanged.IfObjectNotNull(x => x(this, tr, this.SelectedDifficulty)));
            }
            else
            {
                TrackClicked.IfObjectNotNull(x => x(this, this.track, this.SelectedDifficulty));
            }
        }
 public static int GetSoloData1_G5(GuitarDifficulty difficulty)
 {
     if (difficulty.IsUnknown() || difficulty.IsAll() || difficulty.IsExpert())
         return ExpertSoloData1_G5;
     if (difficulty.IsHard())
         return HardSoloData1_G5;
     else if (difficulty.IsMedium())
         return MediumSoloData1_G5;
     else if (difficulty.IsEasy())
         return EasySoloData1_G5;
     return ExpertSoloData1_G5;
 }
        public static GuitarArpeggio CreateArpeggio(GuitarMessageList owner, TickPair ticks, GuitarDifficulty difficulty)
        {
            GuitarArpeggio ret = null;

            if (Utility.GetArpeggioData1(difficulty).IsNotNull())
            {
                ret = new GuitarArpeggio(owner, ticks, difficulty);
                if (ret != null)
                {
                    ret.IsNew = true;
                    ret.CreateEvents();
                }
            }
            return(ret);
        }
 public static int GetStringLowE(GuitarDifficulty difficulty, bool isPro)
 {
     return isPro ? GetStringLowE(difficulty) : GetStringLowE5(difficulty);
 }
        public bool SetTrack6(Sequence seq, Track t, GuitarDifficulty difficulty = GuitarDifficulty.Unknown)
        {
            bool ret = true;

            if (settingTrack6)
                return ret;

            settingTrack6 = true;
            try
            {
                if (!difficulty.IsEasyMediumHardExpert())
                {
                    if (!CurrentDifficulty.IsEasyMediumHardExpert())
                        difficulty = GuitarDifficulty.Expert;
                    else
                        difficulty = CurrentDifficulty;
                }
                guitarTrack.SetTrack(t, difficulty);

                ret = guitarTrack.IsLoaded;

            }
            catch { }

            try
            {
                if (ret == true && OnLoadTrack != null)
                {
                    this.OnLoadTrack(this, this.Sequence, t);
                }
            }
            catch { }
            try
            {

                SetTrackMaximum();
            }
            catch { }

            settingTrack6 = false;

            Invalidate();
            return ret;
        }
 public static int GetStringLowE(GuitarDifficulty difficulty)
 {
     if (difficulty == GuitarDifficulty.Easy)
         return EasyData1LowE;
     if (difficulty == GuitarDifficulty.Medium)
         return MediumData1LowE;
     if (difficulty == GuitarDifficulty.Hard)
         return HardData1LowE;
     if (difficulty == GuitarDifficulty.Expert)
         return ExpertData1LowE;
     return Int32.MinValue;
 }
        public bool SetTrack(Track track, GuitarDifficulty difficulty = GuitarDifficulty.Unknown)
        {
            var ret = false;
            if (difficulty.IsUnknown())
                difficulty = this.CurrentDifficulty;

            if (track.IsFileTypePro())
            {
                ret = SetTrack6(track, difficulty);
            }
            else
            {
                ret = SetTrack5(track, difficulty);
            }
            return ret;
        }
 public static int GetStringLowE5(GuitarDifficulty difficulty)
 {
     if (difficulty == GuitarDifficulty.Easy)
         return EasyData1LowE5;
     if (difficulty == GuitarDifficulty.Medium)
         return MediumData1LowE5;
     if (difficulty == GuitarDifficulty.Hard)
         return HardData1LowE5;
     return ExpertData1LowE;
 }
 private void trackEditorPro_TrackRemoved(PEMidiTrackEditPanel sender, Sequence sequence, Track track, GuitarDifficulty difficulty)
 {
     if (DesignMode)
         return;
     TrackProperties.FirstOrDefault(x => x.Track == track).IfObjectNotNull(x => TrackProperties.Remove(x));
 }
 public static IEnumerable<int> GetStringsForDifficulty6(GuitarDifficulty diff)
 {
     var ret = new List<int>();
     if (diff.HasFlag(GuitarDifficulty.Easy))
     {
         ret.AddRange(EasyData1Strings);
     }
     if (diff.HasFlag(GuitarDifficulty.Medium))
     {
         ret.AddRange(MediumData1Strings);
     }
     if (diff.HasFlag(GuitarDifficulty.Hard))
     {
         ret.AddRange(HardData1Strings);
     }
     if (diff.HasFlag(GuitarDifficulty.Expert))
     {
         ret.AddRange(ExpertData1Strings);
     }
     return ret;
 }
        public void CreateChordNameEvents(GuitarDifficulty difficulty,
            int[] GuitarTuning, int[] BassTuning, Track ownerTrack)
        {
            var x108 = Generate108().Where(x => x.Chord != null).ToList();

            foreach (var item in x108)
            {
                if (item.Chord.Notes.Count() > 1)
                {
                    ChordNameMeta name = null;
                    if (ownerTrack.Name.IsBassTrackName())
                    {
                        name = item.Chord.GetTunedChordName(BassTuning);
                    }
                    else
                    {
                        name = item.Chord.GetTunedChordName(GuitarTuning);
                    }

                    int data1 = -1;
                    var useUserChordName = false;
                    var chordName = string.Empty;
                    var hideChordName = false;

                    item.Chord.RootNoteConfig.IfNotNull(x => useUserChordName = x.UseUserChordName);
                    item.Chord.RootNoteConfig.IfNotNull(x => chordName = x.UserChordName);
                    item.Chord.RootNoteConfig.IfNotNull(x => data1 = x.RootNoteData1);
                    item.Chord.RootNoteConfig.IfNotNull(x => hideChordName = x.HideNoteName);

                    if (difficulty == GuitarDifficulty.Expert)
                    {
                        if (hideChordName || (data1 == -1 && (name == null || (name != null && name.ToneName.ToToneNameData1() == ToneNameData1.NotSet))))
                        {
                            ownerTrack.Insert(item.Ticks.Down, new ChannelMessage(ChannelCommand.NoteOn, Utility.ChordNameHiddenData1, 100 + item.Fret));
                            ownerTrack.Insert(item.Ticks.Up, new ChannelMessage(ChannelCommand.NoteOff, Utility.ChordNameHiddenData1, 0));
                        }
                        else
                        {
                            if (data1 == -1)
                            {
                                data1 = name.ToneName.ToToneNameData1().ToInt();
                            }
                            ownerTrack.Insert(item.Ticks.Down, new ChannelMessage(ChannelCommand.NoteOn, data1, 100 + item.Fret));
                            ownerTrack.Insert(item.Ticks.Up, new ChannelMessage(ChannelCommand.NoteOff, data1, 0));
                        }
                    }

                    var chordNameText = Utility.CreateChordNameText(item.Chord.Difficulty, useUserChordName ? chordName : name.ToStringEx());

                    if (chordNameText.IsNotEmpty())
                    {
                        ownerTrack.Insert(item.Chord.AbsoluteTicks, new MetaMessage(MetaType.Text, chordNameText));
                    }
                }
            }
        }
        public GuitarTrack SetTrack(Track selectedTrack, GuitarDifficulty diff)
        {
            if (selectedTrack == null || midiTrack == null)
            {
                midiTrack = null;
                dirtyItems |= DirtyItem.Track;
            }
            if (selectedTrack != null)
            {
                if (midiTrack == selectedTrack && !midiTrack.Dirty && currentDifficulty == diff && dirtyItems == DirtyItem.None)
                {
                }
                else
                {
                    midiTrack = selectedTrack;
                    currentDifficulty = diff;

                    if (midiTrack == null || midiTrack.Sequence == null)
                    {
                        this.SequenceDivision = 480;
                    }
                    else
                    {
                        this.SequenceDivision = midiTrack.Sequence.Division;
                    }

                    RebuildEvents();

                    this.dirtyItems = DirtyItem.None;
                    selectedTrack.Dirty = false;
                }
            }
            return this;
        }
 public GuitarArpeggio(GuitarMessageList owner, TickPair ticks, GuitarDifficulty difficulty)
     : base(owner, ticks, GuitarModifierType.Arpeggio, GuitarMessageType.GuitarArpeggio)
 {
     Data1 = Utility.GetArpeggioData1(difficulty);
 }
 public IEnumerable<GuitarChord> GetChordsByDifficulty(
     GuitarDifficulty singleDifficulty)
 {
     CurrentDifficulty = singleDifficulty;
     return Messages.Chords.ToList();
 }
 public TrackDifficulty(string track, GuitarDifficulty difficulty)
 {
     this.Track = track;
     this.Difficulty = difficulty;
 }
        public void GetMessages(GuitarDifficulty difficulty, bool includeDifficultyAll = true)
        {
            if (difficulty.IsAll())
                difficulty = difficulty ^ GuitarDifficulty.All;

            var validData1List = Utility.GetKnownData1ForDifficulty(IsPro,
                includeDifficultyAll ? GuitarDifficulty.All | difficulty : difficulty).ToList();

            Messages = new GuitarMessageList(owner);
            var events = checkForInvalidNotes(Messages, midiTrack, validData1List);

            var ret = Messages;
            var tempoTrack = GetTempoTrack();
            ret.AddRange(GetTempoMessages(ret, tempoTrack));
            ret.AddRange(GetTimeSigMessages(ret, tempoTrack));
            try
            {

                if (IsPro)
                {

                    events.GetEventPairs(Utility.AllArpeggioData1)
                        .Select(x => new GuitarArpeggio(x)).ToList().ForEach(x => x.AddToList());

                    events.GetEventPairs(Utility.SoloData1.MakeEnumerable()).Select(x => new GuitarSolo(x)).ToList().ForEach(x => x.AddToList());
                    events.GetEventPairs(Utility.PowerupData1.MakeEnumerable()).Select(x => new GuitarPowerup(x)).ToList().ForEach(x => x.AddToList());
                    events.GetEventPairs(Utility.MultiStringTremeloData1.MakeEnumerable()).Select(x => new GuitarMultiStringTremelo(x)).ToList().ForEach(x => x.AddToList());
                    events.GetEventPairs(Utility.SingleStringTremeloData1.MakeEnumerable()).Select(x => new GuitarSingleStringTremelo(x)).ToList().ForEach(x => x.AddToList());

                    GetBigRockEnding(ret, events);

                    events.GetEventPairs(Utility.AllSlideData1).Select(x => new GuitarSlide(x)).ToList().ForEach(x => x.AddToList());
                    events.GetEventPairs(Utility.AllHammeronData1).Select(x => new GuitarHammeron(x)).ToList().ForEach(x => x.AddToList());
                    events.GetEventPairs(Utility.AllStrumData1).Select(x => new GuitarChordStrum(x)).ToList().ForEach(x => x.AddToList());

                    events.GetEventPairs(Utility.ChordNameEvents).ToList().
                        Select(x => new GuitarChordName(x)).ToList().ForEach(x => x.AddToList());

                    var notes = events.GetEventPairs(Utility.GetStringsForDifficulty6(difficulty)).Select(x => new GuitarNote(x)).ToList();
                    notes.ForEach(x => x.AddToList());
                    if (notes.Any())
                    {
                        var closeNotes = notes.GroupBy(x => x.DownTick).ToList();
                        var chordNotes = closeNotes.Select(n => GuitarChord.GetChord(ret, difficulty, n, true)).ToList().Where(x => x != null).ToList();
                        chordNotes.ForEach(x => x.AddToList());
                    }

                    var textEvents = midiTrack.Meta.Where(x => x.IsTextEvent()).Select(x => new GuitarTextEvent(ret, x)).ToList();
                    textEvents.ForEach(x => x.AddToList());

                    LoadTrainers(ret, ret.TextEvents).ToList().ForEach(x => x.AddToList());

                    events.GetEventPairs(Utility.HandPositionData1.MakeEnumerable()).ToList().Select(x => new GuitarHandPosition(x)).ToList().ForEach(x => x.AddToList());

                }
                else
                {
                    events.GetEventPairs(new[] { Utility.ExpertSoloData1_G5, Utility.SoloData1 }).ToList().Select(x => new GuitarSolo(x)).ForEach(x => x.AddToList());
                    events.GetEventPairs(Utility.PowerupData1.MakeEnumerable()).Select(x => new GuitarPowerup(x)).ForEach(x => x.AddToList());

                    var notes = events.GetEventPairs(Utility.GetStringsForDifficulty5(difficulty)).Select(x => new GuitarNote(x)).ToList();
                    notes.ForEach(x => x.AddToList());

                    if (notes.Any())
                    {
                        var chans = notes.GroupBy(x => x.Channel);
                        var chords = new List<GuitarChord>();
                        foreach (var channelNotes in chans.Where(x => x.Key == 0))
                        {
                            var closeNotes = channelNotes.GroupByCloseTick().ToList();

                            chords.AddRange(closeNotes.Select(x => GuitarChord.GetChord(ret, difficulty, x, false)).Where(x => x != null).ToList());
                        }
                        foreach (var channelNotes in chans.Where(x => x.Key != 0))
                        {
                            var closeNotes = channelNotes.GroupByCloseTick().ToList();
                            var chords1 = closeNotes.Select(x => GuitarChord.GetChord(ret, difficulty, x, false)).Where(x => x != null).ToList();
                            foreach (var chord in chords1)
                            {
                                if (!chords.AnyBetweenTick(chord.TickPair))
                                {
                                    chords.Add(chord);
                                }
                            }
                        }
                        chords.OrderBy(x => x.DownTick).ToList().ForEach(x => x.AddToList());
                    }

                    var textEvents = midiTrack.Meta.Where(x => x.IsTextEvent()).ToList().Select(x => new GuitarTextEvent(ret, x)).ToList();
                    textEvents.ForEach(x => x.AddToList());

                    GetBigRockEnding(ret, events);
                }

            }
            catch { }
        }