Esempio n. 1
0
 /// <inheritdoc />
 public void CopyFrom(IPatch patch)
 {
     if (patch is Patch p)
     {
         Effect1.CopyFrom(p.Effect1);
         Effect2.CopyFrom(p.Effect2);
         Delay.CopyFrom(p.Delay);
         Reverb.CopyFrom(p.Reverb);
     }
     else
     {
         throw new NotSupportedException("Copying from that type is not supported");
     }
 }
Esempio n. 2
0
        /// <summary>
        ///     Copy data from sysex dumps
        /// </summary>
        public void CopyFrom(Dictionary <Effect, SysExMessage> effects)
        {
            // Skipping 12 bytes from front because it's header and address offset
            // Skipping 2 bytes from end because it's checksum and sysex footer

            var effect1Bytes = effects[Effect.Effect1].GetBytes().Skip(12).ToArray();
            var effect2Bytes = effects[Effect.Effect2].GetBytes().Skip(12).ToArray();
            var delayBytes   = effects[Effect.Delay].GetBytes().Skip(12).ToArray();
            var reverbBytes  = effects[Effect.Reverb].GetBytes().Skip(12).ToArray();

            Effect1.CopyFrom(effect1Bytes.Take(effect1Bytes.Length - 2).ToArray());
            Effect2.CopyFrom(effect2Bytes.Take(effect2Bytes.Length - 2).ToArray());
            Delay.CopyFrom(delayBytes.Take(delayBytes.Length - 2).ToArray());
            Reverb.CopyFrom(reverbBytes.Take(reverbBytes.Length - 2).ToArray());
        }