Пример #1
0
 public void read(BinaryReader r)
 {
     this.Count      = r.ReadInt32();
     this.ChordNotes = new ChordNotes[this.Count]; for (int i = 0; i < this.Count; i++)
     {
         ChordNotes obj = new ChordNotes(); obj.read(r); this.ChordNotes[i] = obj;
     }
 }
Пример #2
0
 public void read(EndianBinaryReader r)
 {
     Count      = r.ReadInt32();
     ChordNotes = new ChordNotes[Count]; for (int i = 0; i < Count; i++)
     {
         var obj = new ChordNotes(); obj.read(r); ChordNotes[i] = obj;
     }
 }
        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];
        }
 public void read(EndianBinaryReader r)
 {
     if (r.BaseStream.Length > 0)
     {
         Count = r.ReadInt32();
         ChordNotes = new ChordNotes[Count]; for (int i = 0; i < Count; i++) { var obj = new ChordNotes(); obj.read(r); ChordNotes[i] = obj; }
     }
 }
 public void read(BinaryReader r)
 {
     this.Count = r.ReadInt32();
     this.ChordNotes = new ChordNotes[this.Count]; for (int i=0; i<this.Count; i++) { ChordNotes obj = new ChordNotes(); obj.read(r); this.ChordNotes[i] = obj; }
 }