예제 #1
0
 public sequence()
 {
     notes = new sequence_note[32];
     for (int i = 0; i < 32; i++)
     {
         notes[i] = new sequence_note();
     }
 }
예제 #2
0
        static Hashtable fill_patterns(XmlNodeList patterns_root, Hashtable instruments)
        {
            Hashtable beats   = new Hashtable();
            XmlNode   current = patterns_root[0];

            while (current != null)
            {
                if (current.Name == "Beat")
                {
                    beat b = new beat();
                    foreach (XmlAttribute attr in current.Attributes)
                    {
                        string attribute_name = attr.Name.ToLower();
                        if (attribute_name == "name")
                        {
                            b.name = attr.Value;
                        }
                        else if (attribute_name == "img")
                        {
                            b.image_location = attr.Value;
                        }
                        else if (attribute_name == "followClave")
                        {
                            b.follows_clave = bool.Parse(attr.Value);
                        }
                        else if (attribute_name == "overlaps")
                        {
                            b.overlap = bool.Parse(attr.Value);
                        }
                    }
                    foreach (XmlNode sequence_node in current.ChildNodes)
                    {
                        sequence seq = new sequence();
                        foreach (XmlAttribute attr in sequence_node.Attributes)
                        {
                            string attribute_name = attr.Name.ToLower();
                            if (attribute_name == "name")
                            {
                                seq.name = attr.Value;
                            }
                        }
                        foreach (XmlNode sound_xml_in in sequence_node.ChildNodes)
                        {
                            sequence_note s     = new sequence_note();
                            string        instr = null;
                            string        note  = null;
                            foreach (XmlAttribute attr in sound_xml_in.Attributes)
                            {
                                string attribute_name = attr.Name.ToLower();

                                if (attribute_name == "time")
                                {
                                    s.time = (int.Parse(attr.Value));
                                }
                                else if (attribute_name == "instrument")
                                {
                                    instr = attr.Value;
                                }
                                else if (attribute_name == "note")
                                {
                                    note = attr.Value;
                                }
                                if (instr != null && note != null)
                                {
                                    s.note_ = ((note)((instrument)instruments[instr]).notes[note]);
                                }
                            }
                            seq.notes[s.time] = s;
                        }
                        b.sequence.Add(seq.name, seq);
                    }
                    beats.Add(b.name, b);
                }
                current = current.NextSibling;
            }
            return(beats);
        }