internal static SongChordTemplate2014[] Parse(List <DLCPackage.Manifest.ChordTemplate> cteamplateList) { var chordTemplates = new SongChordTemplate2014[cteamplateList.Count]; for (int i = 0; i < cteamplateList.Count; i++) { var sct2014 = new SongChordTemplate2014(); sct2014.ChordName = sct2014.DisplayName = cteamplateList[i].ChordName; sct2014.Finger0 = (sbyte)cteamplateList[i].Fingers[0]; sct2014.Finger1 = (sbyte)cteamplateList[i].Fingers[1]; sct2014.Finger2 = (sbyte)cteamplateList[i].Fingers[2]; sct2014.Finger3 = (sbyte)cteamplateList[i].Fingers[3]; sct2014.Finger4 = (sbyte)cteamplateList[i].Fingers[4]; sct2014.Finger5 = (sbyte)cteamplateList[i].Fingers[5]; sct2014.Fret0 = (sbyte)cteamplateList[i].Frets[0]; sct2014.Fret1 = (sbyte)cteamplateList[i].Frets[1]; sct2014.Fret2 = (sbyte)cteamplateList[i].Frets[2]; sct2014.Fret3 = (sbyte)cteamplateList[i].Frets[3]; sct2014.Fret4 = (sbyte)cteamplateList[i].Frets[4]; sct2014.Fret5 = (sbyte)cteamplateList[i].Frets[5]; sct2014.ChordId = cteamplateList[i].ChordId; chordTemplates[i] = sct2014; } return(chordTemplates); }
internal static SongChordTemplate2014[] Parse(List <DLCPackage.Manifest.ChordTemplate> cteamplateList) { var chordTemplates = new SongChordTemplate2014[cteamplateList.Count]; for (int i = 0; i < cteamplateList.Count; i++) { chordTemplates[i] = new SongChordTemplate2014 { ChordName = cteamplateList[i].ChordName, // split getting funky RS1 -> RS2 results when combined DisplayName = cteamplateList[i].ChordName, Finger0 = (sbyte)cteamplateList[i].Fingers[0], Finger1 = (sbyte)cteamplateList[i].Fingers[1], Finger2 = (sbyte)cteamplateList[i].Fingers[2], Finger3 = (sbyte)cteamplateList[i].Fingers[3], Finger4 = (sbyte)cteamplateList[i].Fingers[4], Finger5 = (sbyte)cteamplateList[i].Fingers[5], Fret0 = (sbyte)cteamplateList[i].Frets[0], Fret1 = (sbyte)cteamplateList[i].Frets[1], Fret2 = (sbyte)cteamplateList[i].Frets[2], Fret3 = (sbyte)cteamplateList[i].Frets[3], Fret4 = (sbyte)cteamplateList[i].Frets[4], Fret5 = (sbyte)cteamplateList[i].Frets[5], ChordId = cteamplateList[i].ChordId }; } return(chordTemplates); }
internal static SongChordTemplate2014[] Parse(Sng2014HSL.ChordSection chordSection) { var chordTemplates = new SongChordTemplate2014[chordSection.Count]; for (int i = 0; i < chordSection.Count; i++) { var sct2014 = new SongChordTemplate2014(); sct2014.ChordName = sct2014.DisplayName = chordSection.Chords[i].Name.ToNullTerminatedAscii(); sct2014.Finger0 = (sbyte)chordSection.Chords[i].Fingers[0]; sct2014.Finger1 = (sbyte)chordSection.Chords[i].Fingers[1]; sct2014.Finger2 = (sbyte)chordSection.Chords[i].Fingers[2]; sct2014.Finger3 = (sbyte)chordSection.Chords[i].Fingers[3]; sct2014.Finger4 = (sbyte)chordSection.Chords[i].Fingers[4]; sct2014.Finger5 = (sbyte)chordSection.Chords[i].Fingers[5]; sct2014.Fret0 = (sbyte)chordSection.Chords[i].Frets[0]; sct2014.Fret1 = (sbyte)chordSection.Chords[i].Frets[1]; sct2014.Fret2 = (sbyte)chordSection.Chords[i].Frets[2]; sct2014.Fret3 = (sbyte)chordSection.Chords[i].Frets[3]; sct2014.Fret4 = (sbyte)chordSection.Chords[i].Frets[4]; sct2014.Fret5 = (sbyte)chordSection.Chords[i].Frets[5]; sct2014.ChordId = null; // Parse chord mask var mask = chordSection.Chords[i].Mask; if ((mask & CON.CHORD_MASK_ARPEGGIO) != 0) { mask &= ~CON.CHORD_MASK_ARPEGGIO; sct2014.DisplayName += "-arp"; } else if ((mask & CON.CHORD_MASK_NOP) != 0) { mask &= ~CON.CHORD_MASK_NOP; sct2014.DisplayName += "-nop"; } chordTemplates[i] = sct2014; } return(chordTemplates); }
/// <summary> /// Showlights only. /// </summary> /// <param name="tuning"></param> /// <param name="crd"></param> /// <param name = "handShape"></param> /// <param name="bass"></param> /// <param name = "capo"></param> /// <returns></returns> public static Int32 getChordNote(Int16[] tuning, SongChord2014 crd, SongChordTemplate2014[] handShape, bool bass, int capo) { if (handShape[crd.ChordId] != null) { List<int> cNote = new List<int>(); cNote.AddRange(new int[]{ GetMidiNote(tuning, (Byte)0, (Byte)handShape[crd.ChordId].Fret0, bass, capo), GetMidiNote(tuning, (Byte)1, (Byte)handShape[crd.ChordId].Fret1, bass, capo), GetMidiNote(tuning, (Byte)2, (Byte)handShape[crd.ChordId].Fret2, bass, capo), GetMidiNote(tuning, (Byte)3, (Byte)handShape[crd.ChordId].Fret3, bass, capo), GetMidiNote(tuning, (Byte)4, (Byte)handShape[crd.ChordId].Fret4, bass, capo), GetMidiNote(tuning, (Byte)5, (Byte)handShape[crd.ChordId].Fret5, bass, capo) }); //Cleanup for -1 notes var cOut = cNote.Where(c => c > 0).ToList(); if (cOut.Count < 1) return 35; //Return bass note for doublestops if (cOut.Count < 3 && cOut[0] > cOut[1]) return cOut[1]; //Return most used note return cOut.Count > 3 ? cOut.FirstOrDefault(n => cOut.Any(t => t > n)) : cOut[0]; } return 35; }
public Song2014(Sng2014HSL.Sng sngData, Attributes2014 attr = null) { Version = "7"; CrowdSpeed = "1"; if (attr != null) { // If manifest is passed, fill general song information Title = attr.SongName; Arrangement = ((ArrangementName)attr.ArrangementType).ToString(); Part = (short)attr.SongPartition; Offset = (float)attr.SongOffset; CentOffset = Convert.ToString(attr.CentOffset); SongLength = (float)attr.SongLength; SongNameSort = attr.SongNameSort; AverageTempo = attr.SongAverageTempo; Tuning = attr.Tuning; Capo = Convert.ToByte(attr.CapoFret); ArtistName = attr.ArtistName; ArtistNameSort = attr.ArtistNameSort; AlbumName = attr.AlbumName; AlbumNameSort = attr.AlbumNameSort; AlbumYear = Convert.ToString(attr.SongYear) ?? ""; AlbumArt = attr.AlbumArt; ArrangementProperties = attr.ArrangementProperties; LastConversionDateTime = attr.LastConversionDateTime; ToneBase = attr.Tone_Base; ToneA = attr.Tone_A; ToneB = attr.Tone_B; ToneC = attr.Tone_C; ToneD = attr.Tone_D; } else { Part = sngData.Metadata.Part; SongLength = sngData.Metadata.SongLength; Tuning = new TuningStrings(sngData.Metadata.Tuning); Capo = (byte)((sngData.Metadata.CapoFretId == 0xFF) ? 0x00 : sngData.Metadata.CapoFretId); LastConversionDateTime = sngData.Metadata.LastConversionDateTime.ToNullTerminatedAscii(); } Tones = SongTone2014.Parse(sngData.Tones, attr); if (attr == null) { // Fix tones slots for fake tone names if manifest was not entered foreach (var tone in Tones) { if (tone.Name.EndsWith("_0")) { ToneBase = tone.Name; } if (tone.Name.EndsWith("_1")) { ToneA = ToneBase; ToneB = tone.Name; } if (tone.Name.EndsWith("_2")) { ToneC = tone.Name; } if (tone.Name.EndsWith("_3")) { ToneD = tone.Name; } } } //Sections can be obtained from manifest or sng file (manifest preferred) Sections = (attr != null) ? SongSection.Parse(attr.Sections) : SongSection.Parse(sngData.Sections); //Can be obtained from manifest or sng file (sng preferred) Phrases = SongPhrase.Parse(sngData.Phrases); PhraseIterations = SongPhraseIteration2014.Parse(sngData.PhraseIterations); //Can be obtained from manifest or sng file (combined preferred) ChordTemplates = SongChordTemplate2014.Parse(sngData.Chords); // Only SNG have all ChordTemplates, manifest have only chord templates with name if (attr != null) { SongChordTemplate2014.AddChordIds(ChordTemplates, attr.ChordTemplates); // Only manifest has chordIds } //Only in SNG Ebeats = SongEbeat.Parse(sngData.BPMs); StartBeat = sngData.BPMs.BPMs[0].Time; Events = SongEvent.Parse(sngData.Events); Levels = SongLevel2014.Parse(sngData); //Not used in RS2014 customs at this time. Need to check official files NewLinkedDiff = SongNewLinkedDiff.Parse(sngData.NLD); PhraseProperties = SongPhraseProperty.Parse(sngData.PhraseExtraInfo); LinkedDiffs = new SongLinkedDiff[0]; FretHandMuteTemplates = new SongFretHandMuteTemplate[0]; //ddc TranscriptionTrack = TranscriptionTrack2014.GetDefault(); }
internal static SongChordTemplate2014[] Parse(Sng2014HSL.ChordSection chordSection) { var chordTemplates = new SongChordTemplate2014[chordSection.Count]; for (int i = 0; i < chordSection.Count; i++) { var sct2014 = new SongChordTemplate2014(); sct2014.ChordName = sct2014.DisplayName = chordSection.Chords[i].Name.ToNullTerminatedAscii(); sct2014.Finger0 = (sbyte)chordSection.Chords[i].Fingers[0]; sct2014.Finger1 = (sbyte)chordSection.Chords[i].Fingers[1]; sct2014.Finger2 = (sbyte)chordSection.Chords[i].Fingers[2]; sct2014.Finger3 = (sbyte)chordSection.Chords[i].Fingers[3]; sct2014.Finger4 = (sbyte)chordSection.Chords[i].Fingers[4]; sct2014.Finger5 = (sbyte)chordSection.Chords[i].Fingers[5]; sct2014.Fret0 = (sbyte)chordSection.Chords[i].Frets[0]; sct2014.Fret1 = (sbyte)chordSection.Chords[i].Frets[1]; sct2014.Fret2 = (sbyte)chordSection.Chords[i].Frets[2]; sct2014.Fret3 = (sbyte)chordSection.Chords[i].Frets[3]; sct2014.Fret4 = (sbyte)chordSection.Chords[i].Frets[4]; sct2014.Fret5 = (sbyte)chordSection.Chords[i].Frets[5]; sct2014.ChordId = null; // Parse chord mask var mask = chordSection.Chords[i].Mask; if ((mask & Sng2014HSL.Sng2014FileWriter.CHORD_MASK_ARPEGGIO) != 0) { mask &= ~Sng2014HSL.Sng2014FileWriter.CHORD_MASK_ARPEGGIO; sct2014.DisplayName += "-arp"; } else if ((mask & Sng2014HSL.Sng2014FileWriter.CHORD_MASK_NOP) != 0) { mask &= ~Sng2014HSL.Sng2014FileWriter.CHORD_MASK_NOP; sct2014.DisplayName += "-nop"; } chordTemplates[i] = sct2014; } return chordTemplates; }
internal static SongChordTemplate2014[] Parse(List<DLCPackage.Manifest.ChordTemplate> cteamplateList) { var chordTemplates = new SongChordTemplate2014[cteamplateList.Count]; for (int i = 0; i < cteamplateList.Count; i++) { var sct2014 = new SongChordTemplate2014(); sct2014.ChordName = sct2014.DisplayName = cteamplateList[i].ChordName; sct2014.Finger0 = (sbyte)cteamplateList[i].Fingers[0]; sct2014.Finger1 = (sbyte)cteamplateList[i].Fingers[1]; sct2014.Finger2 = (sbyte)cteamplateList[i].Fingers[2]; sct2014.Finger3 = (sbyte)cteamplateList[i].Fingers[3]; sct2014.Finger4 = (sbyte)cteamplateList[i].Fingers[4]; sct2014.Finger5 = (sbyte)cteamplateList[i].Fingers[5]; sct2014.Fret0 = (sbyte)cteamplateList[i].Frets[0]; sct2014.Fret1 = (sbyte)cteamplateList[i].Frets[1]; sct2014.Fret2 = (sbyte)cteamplateList[i].Frets[2]; sct2014.Fret3 = (sbyte)cteamplateList[i].Frets[3]; sct2014.Fret4 = (sbyte)cteamplateList[i].Frets[4]; sct2014.Fret5 = (sbyte)cteamplateList[i].Frets[5]; sct2014.ChordId = cteamplateList[i].ChordId; chordTemplates[i] = sct2014; } return chordTemplates; }
internal static SongChordTemplate2014[] AddChordIds(SongChordTemplate2014[] chordTemplates, List<DLCPackage.Manifest.ChordTemplate> ctemplateList) { for (int i = 0; i < ctemplateList.Count; i++) { var ct = ctemplateList[i]; var matchingChord = chordTemplates.First(sct => sct.Fret0 == ct.Frets[0] && sct.Fret1 == ct.Frets[1] && sct.Fret2 == ct.Frets[2] && sct.Fret3 == ct.Frets[3] && sct.Fret4 == ct.Frets[4] && sct.Fret5 == ct.Frets[5]); matchingChord.ChordId = ct.ChordId; } return chordTemplates; }
internal static SongChordTemplate2014[] Parse(List<DLCPackage.Manifest.ChordTemplate> cteamplateList) { var chordTemplates = new SongChordTemplate2014[cteamplateList.Count]; for (int i = 0; i < cteamplateList.Count; i++) { chordTemplates[i] = new SongChordTemplate2014 { ChordName = cteamplateList[i].ChordName, // split getting funky RS1 -> RS2 results when combined DisplayName = cteamplateList[i].ChordName, Finger0 = (sbyte) cteamplateList[i].Fingers[0], Finger1 = (sbyte) cteamplateList[i].Fingers[1], Finger2 = (sbyte) cteamplateList[i].Fingers[2], Finger3 = (sbyte) cteamplateList[i].Fingers[3], Finger4 = (sbyte) cteamplateList[i].Fingers[4], Finger5 = (sbyte) cteamplateList[i].Fingers[5], Fret0 = (sbyte) cteamplateList[i].Frets[0], Fret1 = (sbyte) cteamplateList[i].Frets[1], Fret2 = (sbyte) cteamplateList[i].Frets[2], Fret3 = (sbyte) cteamplateList[i].Frets[3], Fret4 = (sbyte) cteamplateList[i].Frets[4], Fret5 = (sbyte) cteamplateList[i].Frets[5], ChordId = cteamplateList[i].ChordId }; } return chordTemplates; }
private static Tuple<int, SongChordTemplate2014> GetChordTemplate(ZpeChord zChord, Dictionary<string, Tuple<int, SongChordTemplate2014>> chordTemps) { Tuple<int, SongChordTemplate2014> val; if (!chordTemps.TryGetValue(HashChord(zChord), out val)) { SongChordTemplate2014 templ = new SongChordTemplate2014() { ChordName = "", DisplayName = "" }; val = new Tuple<int, SongChordTemplate2014>(chordTemps.Count == 0 ? 0 : chordTemps.Values.Select(v => v.Item1).Max() + 1, templ); templ.Finger0 = templ.Finger1 = templ.Finger2 = templ.Finger3 = templ.Finger4 = templ.Finger5 = -1; templ.Fret0 = templ.Fret1 = templ.Fret2 = templ.Fret3 = templ.Fret4 = templ.Fret5 = -1; zChord.Notes.Where(n => n.StringNo == 0).ToList().ForEach(note => templ.Fret0 = (sbyte)note.Fret); zChord.Notes.Where(n => n.StringNo == 1).ToList().ForEach(note => templ.Fret1 = (sbyte)note.Fret); zChord.Notes.Where(n => n.StringNo == 2).ToList().ForEach(note => templ.Fret2 = (sbyte)note.Fret); zChord.Notes.Where(n => n.StringNo == 3).ToList().ForEach(note => templ.Fret3 = (sbyte)note.Fret); zChord.Notes.Where(n => n.StringNo == 4).ToList().ForEach(note => templ.Fret4 = (sbyte)note.Fret); zChord.Notes.Where(n => n.StringNo == 5).ToList().ForEach(note => templ.Fret5 = (sbyte)note.Fret); chordTemps[HashChord(zChord)] = val; } return val; }