//you know what, Maybe I'll just not do these, you can still use attributes.Get.
        ///// <summary>
        ///// This field is deprecated, we did not bother to find out what it means.
        ///// </summary>
        //public int PBType;
        //
        ///// <summary>
        ///// This is for mode 1. (that means you may ignore it) (that means please do ignore it)
        ///// </summary>
        //public List<int> Pitches;

        /// <summary>
        ///     Create the note from raw text in format of ust files.
        /// </summary>
        /// <param name="list"></param>
        public USTNote(IEnumerable <string> list)
        {
            //this.TextRaw = list;
            _attributes = new DictionaryDataObject(list.Select(x => x.Split(new[] { '=' }, 2))
                                                   .ToDictionary(x => x[0], x => x[1]));

            Envelope = _attributes.ContainsKey(KeyEnvelope) ? new Envelope(_attributes[KeyEnvelope]) : new Envelope();
            _attributes.Remove(KeyEnvelope);

            if (!_attributes.ContainsKey(KeyPbw))
            {
                Portamento = null;
            }
            else
            {
                var pbw = _attributes[KeyPbw];
                var pbs = _attributes.ContainsKey(KeyPbs) ? _attributes[KeyPbs] : "0;"; //0 and invalid.
                var pby = _attributes.ContainsKey(KeyPby)
                    ? _attributes[KeyPby]
                    : ""; //pby and pbm will be fixed by Portamento upon construction.
                var pbm = _attributes.ContainsKey(KeyPbm) ? _attributes[KeyPbm] : "";
                Portamento = new Portamento(pbw, pbs, pby, pbm);
            }

            Vibrato = _attributes.ContainsKey(KeyVbr) ? new Vibrato(_attributes[KeyVbr]) : null;
            _attributes.Remove(KeyVbr);
        }
Пример #2
0
        //you know what, Maybe I'll just not do these, you can still use attributes.Get.
        ///// <summary>
        ///// This field is deprecated, we did not bother to find out what it means.
        ///// </summary>
        //public int PBType;
        //
        ///// <summary>
        ///// This is for mode 1. (that means you may ignore it) (that means please do ignore it)
        ///// </summary>
        //public List<int> Pitches;

        /// <summary>
        /// Create the note from raw text in format of ust files.
        /// </summary>
        /// <param name="list"></param>
        public USTNote(List <string> list)
        {
            //this.TextRaw = list;
            this.attributes = new DictionaryDataObject(zusp.ListToDictionary(list, "="));

            this.Envelope = attributes.ContainsKey(KEY_ENVELOPE) ? new Envelope(attributes[KEY_ENVELOPE]):new Envelope();
            attributes.Remove(KEY_ENVELOPE);

            if (!attributes.ContainsKey(KEY_PBW))
            {
                this.Portamento = null;
            }
            else
            {
                string pbw = attributes[KEY_PBW];
                string pbs = attributes.ContainsKey(KEY_PBS) ? attributes[KEY_PBS] : "0;"; //0 and invalid.
                string pby = attributes.ContainsKey(KEY_PBY) ? attributes[KEY_PBY] : "";   //pby and pbm will be fixed by Portamento upon construction.
                string pbm = attributes.ContainsKey(KEY_PBM) ? attributes[KEY_PBM] : "";
                this.Portamento = new Portamento(pbw, pbs, pby, pbm);
            }

            this.Vibrato = attributes.ContainsKey(KEY_VBR) ?  new Vibrato(attributes[KEY_VBR]): null;
            attributes.Remove(KEY_VBR);
        }
 /// <summary>
 /// (Deep) copy constructor.
 /// </summary>
 /// <param name="that"></param>
 public Portamento(Portamento that)
     : this(that.PBWText, that.PBSText, that.PBYText, that.PBMText)
 {
 }
Пример #4
0
 /// <summary>
 ///     (Deep) copy constructor.
 /// </summary>
 /// <param name="that"></param>
 public Portamento(Portamento that)
     : this(that.PbwText, that.PbsText, that.PbyText, that.PbmText)
 {
 }