Пример #1
0
 public PatternNote Clone()
 {
     PatternNote ret = new PatternNote();
     ret.ID = ID;
     ret.Note = Note;
     ret.To = To;
     ret.From = From;
     ret.Velocity = Velocity;
     return ret;
 }
Пример #2
0
        public bool LoadFromXML(XmlNode node)
        {
            if (node.Attributes["id"] != null)
                ID = node.Attributes["id"].Value;

            if (node.Attributes["name"] != null)
                Name = node.Attributes["name"].Value;

            if (node.Attributes["instrument"] != null)
                InstrumentID = node.Attributes["instrument"].Value;

            if (node.Attributes["duration"] != null)
            {
                int i = 0;
                int.TryParse(node.Attributes["duration"].Value, out i);
                Duration = i;
            }

            XmlNodeList nl = node.SelectNodes("notes/note");
            for (int j = 0; j < nl.Count; j++)
            {
                PatternNote pn = new PatternNote();
                if (pn.LoadFromXML(nl[j]))
                    Notes.Add(pn);
            }

            nl = node.SelectNodes("automations/automation");
            for (int j = 0; j < nl.Count; j++)
            {
                PatternAutomation pa = new PatternAutomation();
                if (pa.LoadFromXML(nl[j]))
                    Automations.Add(pa);
            }

            return true;
        }