Esempio n. 1
0
        void parseKeyTrack(LiveProject.MidiClip midiClip)
        {
            var keyTrack = new LiveProject.KeyTrack();

            while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement && reader.Name == "KeyTrack"))
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "MidiNoteEvent":
                        var note = new LiveProject.Note();
                        note.Time      = getDoubleAttrib("Time");
                        note.Duration  = getDoubleAttrib("Duration");
                        note.Velocity  = (int)getDoubleAttrib("Velocity");
                        note.IsEnabled = getBoolAttrib("IsEnabled");
                        keyTrack.Notes.Add(note);
                        break;

                    case "MidiKey":
                        keyTrack.MidiKey = getIntValueAttrib();
                        break;
                    }
                }
            }
            midiClip.KeyTracks.Add(keyTrack);
        }
Esempio n. 2
0
 void parseKeyTracks(LiveProject.MidiClip midiClip)
 {
     while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement && reader.Name == "KeyTracks"))
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             switch (reader.Name)
             {
             case "KeyTrack":
                 if (!reader.IsEmptyElement)
                 {
                     parseKeyTrack(midiClip);
                 }
                 break;
             }
         }
     }
 }
Esempio n. 3
0
        void parseMidiClip(LiveProject.Track track)
        {
            var midiClip = new LiveProject.MidiClip();

            while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement && reader.Name == "MidiClip"))
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "CurrentStart":
                        midiClip.CurrentStart = getDoubleValueAttrib();
                        break;

                    case "CurrentEnd":
                        midiClip.CurrentEnd = getDoubleValueAttrib();
                        break;

                    case "Loop":
                        if (!reader.IsEmptyElement)
                        {
                            parseMidiClipLoop(midiClip);
                        }
                        break;

                    case "Disabled":
                        midiClip.IsDisabled = getBoolValueAttrib();
                        break;

                    case "KeyTracks":
                        if (!reader.IsEmptyElement)
                        {
                            parseKeyTracks(midiClip);
                        }
                        break;
                    }
                }
            }
            track.MidiClips.Add(midiClip);
        }
Esempio n. 4
0
        void parseMidiClipLoop(LiveProject.MidiClip midiClip)
        {
            while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement && reader.Name == "Loop"))
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "LoopStart":
                        midiClip.LoopStart = getDoubleValueAttrib();
                        break;

                    case "LoopEnd":
                        midiClip.LoopEnd = getDoubleValueAttrib();
                        break;

                    case "StartRelative":
                        midiClip.LoopStartRelative = getDoubleValueAttrib();
                        break;
                    }
                }
            }
        }