Ejemplo n.º 1
0
        /// <inheritdoc />
        /// <summary>
        ///     Creates new instance of AnalogPatch
        /// </summary>
        public Patch()
        {
            Name          = "Init Tone";
            Lfo           = new Lfo();
            Oscillator    = new Oscillator();
            Filter        = new Filter();
            Amplifier     = new Amplifier();
            Common        = new Common();
            LfoModControl = new LfoModControl();

            Lfo.PropertyChanged           += (sender, args) => NotifyOfPropertyChange(nameof(Lfo));
            Oscillator.PropertyChanged    += (sender, args) => NotifyOfPropertyChange(nameof(Oscillator));
            Filter.PropertyChanged        += (sender, args) => NotifyOfPropertyChange(nameof(Filter));
            Amplifier.PropertyChanged     += (sender, args) => NotifyOfPropertyChange(nameof(Amplifier));
            Common.PropertyChanged        += (sender, args) => NotifyOfPropertyChange(nameof(Common));
            LfoModControl.PropertyChanged += (sender, args) => NotifyOfPropertyChange(nameof(LfoModControl));
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public void CopyFrom(IPatch patch)
 {
     if (patch is Patch p)
     {
         Name = p.Name;
         Lfo.CopyFrom(p.Lfo);
         Oscillator.CopyFrom(p.Oscillator);
         Filter.CopyFrom(p.Filter);
         Amplifier.CopyFrom(p.Amplifier);
         Common.CopyFrom(p.Common);
         LfoModControl.CopyFrom(p.LfoModControl);
     }
     else
     {
         throw new NotSupportedException("Copying from that type is not supported");
     }
 }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public byte[] GetBytes()
        {
            var bytes = new List <byte>();

            var nameBytes = Encoding.ASCII.GetBytes(Name.Length > 12 ? Name.Substring(0, 12) : Name);

            bytes.AddRange(nameBytes);
            bytes.AddRange(ByteUtils.RepeatReserve(12 - nameBytes.Length, 0x20));

            bytes.Add(0x00);

            bytes.AddRange(Lfo.GetBytes());
            bytes.AddRange(Oscillator.GetBytes());
            bytes.AddRange(Filter.GetBytes());
            bytes.AddRange(Amplifier.GetBytes());
            bytes.AddRange(Common.GetBytes());
            bytes.AddRange(LfoModControl.GetBytes());

            return(bytes.ToArray());
        }