Exemplo n.º 1
0
        /// <inheritdoc />
        public void CopyFrom(IPatchPart part)
        {
            if (part is Partial p)
            {
                Basic.CopyFrom(p.Basic);
                Assign.CopyFrom(p.Assign);
                Amplifier.CopyFrom(p.Amplifier);
                Output.CopyFrom(p.Output);
                Expression.CopyFrom(p.Expression);
                VelocityControl.CopyFrom(p.VelocityControl);

                for (var i = 0; i < p.Wmts.Length; i++)
                {
                    Wmts[i].CopyFrom(p.Wmts[i]);
                }

                Pitch.CopyFrom(p.Pitch);
                Tvf.CopyFrom(p.Tvf);
                Tva.CopyFrom(p.Tva);
                Other.CopyFrom(p.Other);
            }
            else
            {
                throw new NotSupportedException("Copying from that type is not supported");
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public Partial(DrumKey key)
        {
            Key = key;

            Basic           = new Basic();
            Assign          = new Assign();
            Amplifier       = new Amplifier();
            Output          = new Output();
            Expression      = new Expression();
            VelocityControl = new VelocityControl();
            Wmts            = new[] { new Wmt.Wmt(), new Wmt.Wmt(), new Wmt.Wmt(), new Wmt.Wmt() };
            Pitch           = new Pitch();
            Tvf             = new Tvf();
            Tva             = new Tva();
            Other           = new Other();

            Basic.PropertyChanged           += (sender, args) => NotifyOfPropertyChange(nameof(Basic));
            Assign.PropertyChanged          += (sender, args) => NotifyOfPropertyChange(nameof(Assign));
            Amplifier.PropertyChanged       += (sender, args) => NotifyOfPropertyChange(nameof(Amplifier));
            Output.PropertyChanged          += (sender, args) => NotifyOfPropertyChange(nameof(Output));
            Expression.PropertyChanged      += (sender, args) => NotifyOfPropertyChange(nameof(Expression));
            VelocityControl.PropertyChanged += (sender, args) => NotifyOfPropertyChange(nameof(VelocityControl));
            Wmt1.PropertyChanged            += (sender, args) => NotifyOfPropertyChange(nameof(Wmt1));
            Wmt2.PropertyChanged            += (sender, args) => NotifyOfPropertyChange(nameof(Wmt2));
            Wmt3.PropertyChanged            += (sender, args) => NotifyOfPropertyChange(nameof(Wmt3));
            Wmt4.PropertyChanged            += (sender, args) => NotifyOfPropertyChange(nameof(Wmt4));
            Pitch.PropertyChanged           += (sender, args) => NotifyOfPropertyChange(nameof(Pitch));
            Tvf.PropertyChanged             += (sender, args) => NotifyOfPropertyChange(nameof(Tvf));
            Tva.PropertyChanged             += (sender, args) => NotifyOfPropertyChange(nameof(Tva));
            Other.PropertyChanged           += (sender, args) => NotifyOfPropertyChange(nameof(Other));
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public void Reset()
        {
            Basic.Reset();
            Assign.Reset();
            Amplifier.Reset();
            Output.Reset();
            Expression.Reset();
            VelocityControl.Reset();

            foreach (var wmt in Wmts)
            {
                wmt.Reset();
            }

            Pitch.Reset();
            Tvf.Reset();
            Tva.Reset();
            Other.Reset();
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public byte[] GetBytes()
        {
            var bytes = new List <byte>();

            bytes.AddRange(Basic.GetBytes());               //  12 bytes
            bytes.AddRange(Assign.GetBytes());              //   2 bytes
            bytes.AddRange(Amplifier.GetBytes());           //   8 bytes
            bytes.AddRange(Output.GetBytes());              //   6 bytes
            bytes.AddRange(Expression.GetBytes());          //   4 bytes (3 + 1 reserve)
            bytes.AddRange(VelocityControl.GetBytes());     //   1 byte

            foreach (var wmt in Wmts)
            {
                bytes.AddRange(wmt.GetBytes());             // 116 bytes (29 bytes each)
            }
            bytes.AddRange(Pitch.GetBytes());               //  13 bytes
            bytes.AddRange(Tvf.GetBytes());                 //  20 bytes
            bytes.AddRange(Tva.GetBytes());                 //  11 bytes
            bytes.AddRange(Other.GetBytes());               //   2 bytes

            return(bytes.ToArray());
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public void CopyFrom(byte[] data)
        {
            if (data.Length != DumpLength)
            {
                throw new InvalidDumpSizeException(DumpLength, data.Length);
            }

            Basic.CopyFrom(data.Take(12).ToArray());
            Assign.CopyFrom(data.Skip(12).Take(2).ToArray());
            Amplifier.CopyFrom(data.Skip(14).Take(8).ToArray());
            Output.CopyFrom(data.Skip(22).Take(6).ToArray());
            Expression.CopyFrom(data.Skip(28).Take(4).ToArray());
            VelocityControl.CopyFrom(data.Skip(32).Take(1).ToArray());

            for (var i = 0; i < Wmts.Length; i++)
            {
                Wmts[i].CopyFrom(data.Skip(33 + i * 29).Take(29).ToArray());
            }

            Pitch.CopyFrom(data.Skip(149).Take(13).ToArray());
            Tvf.CopyFrom(data.Skip(162).Take(20).ToArray());
            Tva.CopyFrom(data.Skip(182).Take(11).ToArray());
            Other.CopyFrom(data.Skip(193).Take(2).ToArray());
        }