public GuitarMessage(GuitarMessageList owner, TickPair pair, GuitarMessageType type) { this.messageType = type; this.props = new MidiEventProps(owner, pair); this.SetTicks(pair); }
public GuitarModifier(GuitarMessageList owner, TickPair ticks, GuitarModifierType type, GuitarMessageType mt) : base(owner, ticks, mt) { Data2 = 100; Channel = 0; this.ModifierType = type; }
public static GuitarHandPosition CreateEvent(GuitarMessageList owner, TickPair ticks, int noteFret) { var ret = new GuitarHandPosition(owner, ticks, noteFret); ret.IsNew = true; ret.CreateEvents(); return ret; }
public GuitarNote(GuitarMessageList owner, TickPair ticks) : base(owner, ticks, GuitarMessageType.GuitarNote) { Data2 = Utility.Data2Default; Channel = Utility.ChannelDefault; SetTicks(ticks); }
public GuitarBigRockEnding(GuitarMessageList owner, TickPair ticks, IEnumerable<MidiEventPair> events) : this(owner, ticks) { Channel = 0; events.ToList().ForEach(ev => AddSubMessage(new GuitarBigRockEndingSubMessage(this, ev))); SetTicks(ticks); }
public static GuitarChordName CreateEvent(GuitarMessageList owner, TickPair ticks, ChordNameMeta meta, bool chordNameHidden) { var ret = new GuitarChordName(owner, ticks, meta, chordNameHidden); ret.IsNew = true; ret.CreateEvents(); return ret; }
public static GuitarTextEvent CreateTextEvent(GuitarMessageList owner, int absoluteTicks, string text) { var ret = new GuitarTextEvent(owner, absoluteTicks, text); ret.IsNew = true; ret.CreateEvents(); return ret; }
public GuitarPowerup(GuitarMessageList owner, TickPair pair) : base(owner, pair, GuitarModifierType.Powerup, GuitarMessageType.GuitarPowerup) { this.Data1 = Utility.PowerupData1; this.Data2 = 100; Channel = 0; this.SetTicks(pair); }
public GuitarMultiStringTremelo(GuitarMessageList owner, TickPair pair) : base(owner, pair, GuitarModifierType.MultiStringTremelo, GuitarMessageType.GuitarMultiStringTremelo) { this.Data1 = Utility.MultiStringTremeloData1; this.Data2 = 100; Channel = 0; this.SetTicks(pair); }
public static GuitarSolo CreateSolo(GuitarMessageList owner, TickPair ticks) { var ret = new GuitarSolo(owner, ticks); ret.IsNew = true; ret.CreateEvents(); return ret; }
public GuitarSolo(GuitarMessageList owner, TickPair ticks) : base(owner, ticks, GuitarModifierType.Solo, GuitarMessageType.GuitarSolo) { this.Data1 = Utility.SoloData1; this.Data2 = 100; Channel = 0; this.SetTicks(ticks); }
public GuitarChordName(GuitarMessageList owner, TickPair pair, ChordNameMeta meta, bool hidden) : base(owner, pair, GuitarMessageType.GuitarChordName) { this.Data1 = meta.ToneName.ToToneNameData1().ToInt(); this.Meta = meta; this.ChordNameHidden = hidden; Channel = 0; }
public GuitarHandPosition(GuitarMessageList owner, TickPair pair, int noteFret) : base(owner, pair, GuitarMessageType.GuitarHandPosition) { this.Data1 = Utility.HandPositionData1; NoteFretDown = noteFret; Channel = 0; this.SetTicks(pair); }
public static GuitarBigRockEnding CreateBigRockEnding(GuitarMessageList owner, TickPair ticks) { var ret = new GuitarBigRockEnding(owner, ticks); ret.IsNew = true; ret.CreateEvents(); return ret; }
public GuitarBigRockEnding(GuitarMessageList owner, TickPair ticks) : base(owner,ticks,GuitarModifierType.BigRockEnding, GuitarMessageType.GuitarBigRockEnding) { Channel = 0; foreach (var data1 in Utility.GetBigRockEndingData1(IsPro)) { childEvents.Add(new GuitarBigRockEndingSubMessage(this, ticks, data1)); } SetTicks(ticks); }
public GuitarTempo(GuitarMessageList owner, MidiEvent ev) : base(owner, ev, null, GuitarMessageType.GuitarTempo) { if (ev == null) { this.Tempo = Utility.DummyTempo; } else { var cb = new TempoChangeBuilder((MetaMessage)ev.Clone()); this.Tempo = cb.Tempo; } }
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 GuitarTrainer(GuitarMessageList owner, TickPair ticks, GuitarTrainerType type, GuitarTextEvent start, GuitarTextEvent end, GuitarTextEvent norm) : base(owner, ticks, GuitarMessageType.GuitarTrainer) { this.TrainerType = type; Start = start; End = end; Norm = norm; this.TrainerIndex = ParseTrainerIndex(); this.Loopable = norm != null; SetTicks(ticks); }
public static GuitarTimeSignature CreateTimeSignature( GuitarMessageList owner, int startTick = 0, int numerator = 4, int denominator = 4, int clocksPerMetronomeClick = 24, int thirtySecondNotesPerQuarterNote = 8) { var ret = GetTimeSignature(owner, startTick, numerator, denominator, clocksPerMetronomeClick, thirtySecondNotesPerQuarterNote); ret.IsNew = true; ret.CreateEvents(); return ret; }
public static GuitarTimeSignature GetTimeSignature(GuitarMessageList owner, int startTick = 0, int numerator = 4, int denominator = 4, int clocksPerMetronomeClick = 24, int thirtySecondNotesPerQuarterNote = 8) { var ret = new GuitarTimeSignature(owner, null); ret.Numerator = numerator; ret.Denominator = denominator; ret.ClocksPerMetronomeClick = clocksPerMetronomeClick; ret.ThirtySecondNotesPerQuarterNote = thirtySecondNotesPerQuarterNote; ret.SetDownTick(startTick); return ret; }
public GuitarTrainer(GuitarMessageList owner, TickPair ticks, GuitarTrainerType type, bool loopable, int index = Int32.MinValue) : base(owner, ticks, GuitarMessageType.GuitarTrainer) { this.TrainerType = type; this.TrainerIndex = index.IsNull() ? (owner.Trainers.Where(x => x.TrainerType == type).Count() + 1) : index; this.Loopable = loopable; Start = new GuitarTextEvent(owner, ticks.Down, GetStartText(TrainerType, TrainerIndex)); End = new GuitarTextEvent(owner, ticks.Up, GetEndText(TrainerType, TrainerIndex)); if (Loopable) { Norm = new GuitarTextEvent(owner, GetNormTick(ticks), GetNormText(TrainerType, TrainerIndex, Loopable)); } SetTicks(ticks); }
public GuitarTimeSignature(GuitarMessageList owner, MidiEvent ev) : base(owner, ev, null, GuitarMessageType.GuitarTimeSignature) { if (ev == null) { SetDownTick(0); } else { SetDownEvent(ev); var builder = new TimeSignatureBuilder((MetaMessage)ev.Clone()); Numerator = builder.Numerator; Denominator = builder.Denominator; ClocksPerMetronomeClick = builder.ClocksPerMetronomeClick; ThirtySecondNotesPerQuarterNote = builder.ThirtySecondNotesPerQuarterNote; } }
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 IEnumerable<GuitarTimeSignature> GetTimeSigMessages(GuitarMessageList owner, Track tempoTrack) { var ret = new List<GuitarTimeSignature>(); try { var timeSigs = GetTimeSignaturesFromTrack(owner, tempoTrack); int nextTick = 0; timeSigs.For((t, i) => { timeSigs.ElementAtOrDefault(i + 1).IfObjectNotNull(next => { nextTick = next.AbsoluteTicks; }, Else => { nextTick = Sequence.GetLength(); }); t.SetUpTick(nextTick); }); ret.AddRange(timeSigs.ToList()); } catch { } return ret; }
IEnumerable<GuitarTempo> internalGetTempo(GuitarMessageList owner, Track tempoTrack) { var ret = new List<GuitarTempo>(); if (tempoTrack != null && tempoTrack.Tempo.Any()) { ret.AddRange( tempoTrack.Tempo.Select(x => new GuitarTempo(owner, x))); } else { ret.Add(GuitarTempo.GetTempo(this, Utility.DummyTempo)); } return ret; }
IEnumerable<GuitarTimeSignature> GetTimeSignaturesFromTrack(GuitarMessageList owner, Track tempoTrack) { var ret = new List<GuitarTimeSignature>(); if (tempoTrack != null && tempoTrack.TimeSig.Any()) { ret.AddRange(tempoTrack.TimeSig.Select(t => new GuitarTimeSignature(owner, t))); } else { ret.Add(GuitarTimeSignature.GetDefaultTimeSignature(owner)); } return ret; }
GuitarBigRockEnding GetBigRockEnding(GuitarMessageList owner, IEnumerable<Data1ChannelEventList> events) { GuitarBigRockEnding ret = null; var data1List = Utility.GetBigRockEndingData1(owner.IsPro); var breEvents = events.GetEventPairs(data1List); if (breEvents != null && breEvents.Any()) { var ticks = breEvents.GetTickPair(); if (breEvents.Count() != data1List.Count()) { breEvents.ToList().ForEach(x => owner.Remove(x)); ret = GuitarBigRockEnding.CreateBigRockEnding(owner, ticks); } else { ret = new GuitarBigRockEnding(owner, ticks, breEvents); ret.AddToList(); } } return ret; }
IEnumerable<Data1ChannelEventList> checkForInvalidNotes(GuitarMessageList owner, Track track, IEnumerable<int> data1List) { var ret = new List<Data1ChannelEventList>(); try { var notesOnData2Zero = track.ChanMessages.Where(x => x.Data2 == 0 && x.Command == ChannelCommand.NoteOn).ToList(); if (notesOnData2Zero.Any()) { track.Remove(notesOnData2Zero); foreach (var x in notesOnData2Zero) { track.Insert(x.AbsoluteTicks, new ChannelMessage(ChannelCommand.NoteOff, x.Data1, 0, x.Channel)); } } if (track.Name.IsGuitarTrackName6()) { var bassTrainers = track.Meta.Where(x => x.Text.IsTrainerBass()).ToList(); var guitarTrainers = track.Meta.Where(x => x.Text.IsTrainerGuitar()).ToList(); if (bassTrainers.Any()) { bassTrainers.ForEach(x => track.Remove(x)); } } if (track.Name.IsBassTrackName6()) { var bassTrainers = track.Meta.Where(x => x.Text.IsTrainerBass()).ToList(); var guitarTrainers = track.Meta.Where(x => x.Text.IsTrainerGuitar()).ToList(); if (guitarTrainers.Any()) { guitarTrainers.ForEach(x => track.Remove(x)); } } ret.AddRange(track.GetCleanMessageList(data1List, owner)); } catch (Exception ex) { ex.Message.OutputDebug(); } return ret; }
public IEnumerable<GuitarTrainer> LoadTrainers(GuitarMessageList owner, IEnumerable<GuitarTextEvent> textEventList) { var ret = new List<GuitarTrainer>(); try { var trainerEvents = textEventList.Where(v => v.IsTrainerEvent).ToList(); var validTrainerEvents = trainerEvents.Where(x => x.Text.GetTrainerEventIndex().IsNotNull()); var invalidTrainerEvents = trainerEvents.Where(v => v.Text.GetTrainerEventIndex().IsNull()); invalidTrainerEvents.ToList().ForEach(x => x.DeleteAll()); var removeEvents = new List<GuitarMessage>(); var groups = validTrainerEvents.ToList().GroupBy(v => v.TrainerType.IsTrainerGuitar()); foreach (var group in groups) { var indexGroups = group.OrderBy(v => v.Text.GetTrainerEventIndex()).GroupBy(v => v.Text.GetTrainerEventIndex()); foreach (var trainer in indexGroups.ToList()) { var index = trainer.Key; var begin = trainer.Where(v => v.TrainerType.IsTrainerBegin()); var end = trainer.Where(v => v.TrainerType.IsTrainerEnd()); var norm = trainer.Where(v => v.TrainerType.IsTrainerNorm()); if (begin.Any() && end.Any()) { var trainerType = group.Key == true ? GuitarTrainerType.ProGuitar : GuitarTrainerType.ProBass; var startEv = begin.First(); var endEv = end.First(); var normEv = norm.FirstOrDefault(); var gt = new GuitarTrainer(owner, new TickPair(startEv.AbsoluteTicks, endEv.AbsoluteTicks), trainerType, startEv, endEv, normEv); ret.Add(gt); removeEvents.AddRange(begin.Skip(1).ToList()); removeEvents.AddRange(end.Skip(1).ToList()); if (norm.Any()) { removeEvents.AddRange(norm.Skip(1).ToList()); } } else { removeEvents.AddRange(trainer.ToList()); } } } removeEvents.ToList().ForEach(x => x.DeleteAll()); } catch { } return ret.Where(v => v.IsDeleted == false).ToList(); }
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 { } }