private void parseChords(Song2014 xml, Sng2014File sng, Int16[] tuning, bool bass)
        {
            sng.Chords = new ChordSection();
            sng.Chords.Count = xml.ChordTemplates.Length;
            sng.Chords.Chords = new Chord[sng.Chords.Count];

            for (int i = 0; i < sng.Chords.Count; i++)
            {
                var chord = xml.ChordTemplates[i];
                var c = new Chord();
                // TODO: skip if DisplayName == null
                if (chord.DisplayName.EndsWith("arp"))
                    c.Mask |= CON.CHORD_MASK_ARPEGGIO;
                else if (chord.DisplayName.EndsWith("nop"))
                    c.Mask |= CON.CHORD_MASK_NOP;

                c.Frets[0] = (Byte)chord.Fret0;
                c.Frets[1] = (Byte)chord.Fret1;
                c.Frets[2] = (Byte)chord.Fret2;
                c.Frets[3] = (Byte)chord.Fret3;
                c.Frets[4] = (Byte)chord.Fret4;
                c.Frets[5] = (Byte)chord.Fret5;
                c.Fingers[0] = (Byte)chord.Finger0;
                c.Fingers[1] = (Byte)chord.Finger1;
                c.Fingers[2] = (Byte)chord.Finger2;
                c.Fingers[3] = (Byte)chord.Finger3;
                c.Fingers[4] = (Byte)chord.Finger4;
                c.Fingers[5] = (Byte)chord.Finger5;
                for (Byte s = 0; s < 6; s++)
                    c.Notes[s] = GetMidiNote(tuning, s, c.Frets[s], bass, xml.Capo, template: true);
                readString(chord.ChordName, c.Name);
                sng.Chords.Chords[i] = c;
            }
        }
 public void read(EndianBinaryReader r)
 {
     if (r.BaseStream.Length > 0)
     {
         Count = r.ReadInt32();
         Chords = new Chord[Count]; for (int i = 0; i < Count; i++) { var obj = new Chord(); obj.read(r); Chords[i] = obj; }
     }
 }
Esempio n. 3
0
        static Chord SplitChord(Chord chord, float startTime)
        {
            var newChord = new Chord()
            {
                ChordId = chord.ChordId,
                BrushDirection = chord.BrushDirection,
                Start = startTime,
                Popped = false,
                Slapped = false,
                Tremolo = chord.Tremolo
            };

            // copy over notes
            foreach (var kvp in chord.Notes)
            {
                var newNote = SplitNote(kvp.Value, startTime);
                newChord.Notes.Add(kvp.Key, newNote);
            }

            return newChord;
        }
Esempio n. 4
0
        static Chord CreateChord(SongChord2014 rsChord, Dictionary<int, ChordTemplate> chordTemplates, int capo)
        {
            var chord = new Chord();
            chord.Start = rsChord.Time;
            chord.ChordId = rsChord.ChordId;
            chord.Tremolo = false;
            if (rsChord.ChordNotes != null)
            {
                foreach (var note in rsChord.ChordNotes)
                {
                    chord.Notes.Add(note.String, CreateNote(note, capo));
                }
            }
            if (chordTemplates.ContainsKey(chord.ChordId))
            {
                // need to determine chords from the chord template
                var template = chordTemplates[chord.ChordId];
                for (int i = 0; i < 6; ++i)
                {
                    if (template.Frets[i] >= 0 && !chord.Notes.ContainsKey(i))
                    {
                        var note = new Note()
                        {
                            Fret = template.Frets[i],
                            String = i,
                            LeftFingering = template.Fingers[i],
                            RightFingering = -1,
                        };
                        chord.Notes.Add(i, note);
                    }
                }
            }
            if (chord.Notes.Count == 0)
            {
                Console.WriteLine("  Warning: Empty chord. Cannot find chord with chordId {0}.", chord.ChordId);
            }

            // some properties set on the chord in Rocksmith need to be passed down to the individual notes
            // and vice versa
            foreach (var kvp in chord.Notes)
            {
                if (rsChord.PalmMute != 0)
                    kvp.Value.PalmMuted = true;
                if (rsChord.FretHandMute != 0)
                    kvp.Value.Muted = true;
                if (rsChord.Accent != 0)
                    kvp.Value.Accent = true;
                if (kvp.Value.Tremolo)
                    chord.Tremolo = true;
                if (kvp.Value.Slapped)
                    chord.Slapped = true;
                if (kvp.Value.Popped)
                    chord.Popped = true;
            }

            // we will show a strum hint for all chords played with an up-stroke,
            // and a down-stroke hint for all chords with more than 3 notes (to exclude power-chords)
            //if (rsChord.Strum.ToLower() == "up")
            //    chord.BrushDirection = Chord.BrushType.Up;
            //else if (chord.Notes.Count > 3 && rsChord.Strum.ToLower() == "down")
            //    chord.BrushDirection = Chord.BrushType.Down;
            // disabled, since apparently the strum hints aren't really useful. I might have
            // misunderstood the parameter.

            return chord;
        }
Esempio n. 5
0
 static Chord CreateChord(SongNote2014 note, int capo)
 {
     var chord = new Chord();
     chord.Start = note.Time;
     var convertedNote = CreateNote(note, capo);
     chord.Notes.Add(note.String, convertedNote);
     chord.Tremolo = convertedNote.Tremolo;
     chord.Slapped = convertedNote.Slapped;
     chord.Popped = convertedNote.Popped;
     return chord;
 }
 public void read(BinaryReader r)
 {
     this.Count = r.ReadInt32();
     this.Chords = new Chord[this.Count]; for (int i=0; i<this.Count; i++) { Chord obj = new Chord(); obj.read(r); this.Chords[i] = obj; }
 }