RocksmithToolkitLib.Sng2014HSL.Sng2014FileWriter.addChordNotes C# (CSharp) Method

addChordNotes() public method

public addChordNotes ( Sng2014File sng, SongChord2014 chord ) : Int32
sng Sng2014File
chord RocksmithToolkitLib.Xml.SongChord2014
return System.Int32
        public Int32 addChordNotes(Sng2014File sng, SongChord2014 chord)
        {
            var c = new ChordNotes();
            for (int i = 0; i < 6; i++)
            {
                SongNote2014 n = null;
                foreach (var cn in chord.ChordNotes)
                {
                    if (cn.String == i)
                    {
                        n = cn;
                        break;
                    }
                }
                // TODO: need to figure out which masks are not applied
                c.NoteMask[i] = parseNoteMask(n, false);
                c.BendData[i] = new BendData();
                c.BendData[i].BendData32 = parseBendData(n, false);
                if (n != null && n.BendValues != null)
                    c.BendData[i].UsedCount = n.BendValues.Length;
                if (n != null)
                {
                    c.SlideTo[i] = (Byte)n.SlideTo;
                    c.SlideUnpitchTo[i] = (Byte)n.SlideUnpitchTo;
                }
                else
                {
                    c.SlideTo[i] = unchecked((Byte)(-1));
                    c.SlideUnpitchTo[i] = unchecked((Byte)(-1));
                }
                if (n != null)
                    c.Vibrato[i] = n.Vibrato;
            }

            UInt32 crc = sng.HashStruct(c);
            if (cnsId.ContainsKey(crc))
                return cnsId[crc];

            // don't export chordnotes if there are no techniques
            bool noTechniques = c.NoteMask.All(m => m == 0);
            if (noTechniques)
                return -1;

            // add new ChordNotes instance
            Int32 id = cns.Count;
            cnsId[crc] = id;
            cns.Add(c);
            return cnsId[crc];
        }