Esempio n. 1
0
        /// <summary>
        ///     Copy data from sysex dump
        /// </summary>
        public void CopyFrom(SysExMessage message)
        {
            /**
             * 12   -> SysEx header & address offset
             * 13   -> Tone Name(12) + Reserve(1)
             * 9    -> LFO
             * 10   -> Oscillator
             * 10   -> Filter
             * 7    -> Amplifier
             * 7    -> Common(6) + Reserve(1)
             * 8    -> LFO Mod Control(4) + Reserve(4)
             * 1    -> Checksum
             * 1    -> Footer (0xF7)
             */

            var data = message.GetBytes().Skip(12).ToArray();

            if (data.Length - 2 != DumpLength)
            {
                throw new InvalidDumpSizeException(DumpLength, data.Length);
            }

            Name = Encoding.ASCII.GetString(data.Take(12).ToArray());

            Lfo.CopyFrom(data.Skip(13).Take(9).ToArray());
            Oscillator.CopyFrom(data.Skip(22).Take(10).ToArray());
            Filter.CopyFrom(data.Skip(32).Take(10).ToArray());
            Amplifier.CopyFrom(data.Skip(42).Take(7).ToArray());
            Common.CopyFrom(data.Skip(49).Take(7).ToArray());
            LfoModControl.CopyFrom(data.Skip(56).Take(8).ToArray());
        }
        /// <summary>
        ///     Copy data from sysex dumps
        /// </summary>
        /// <param name="common">Common sysex message</param>
        /// <param name="vfx">VFX sysex message</param>
        public void CopyFrom(SysExMessage common, SysExMessage vfx)
        {
            // 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 commonBytes = common.GetBytes().Skip(12).ToArray();
            var vfxBytes    = vfx.GetBytes().Skip(12).ToArray();

            Common.CopyFrom(commonBytes.Take(commonBytes.Length - 2).ToArray());
            VocalEffect.CopyFrom(vfxBytes.Take(vfxBytes.Length - 2).ToArray());
        }
Esempio n. 3
0
        /// <summary>
        ///     Copy data from sysex dumps
        /// </summary>
        /// <param name="common"></param>
        /// <param name="partials"></param>
        public void CopyFrom(SysExMessage common, Dictionary <DrumKey, SysExMessage> partials)
        {
            // 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 commonBytes = common.GetBytes().Skip(12).ToArray();

            Common.CopyFrom(commonBytes.Take(commonBytes.Length - 2).ToArray());

            foreach (var partial in partials)
            {
                var bytes = partial.Value.GetBytes().Skip(12).ToArray();
                Partials[partial.Key].CopyFrom(bytes.Take(bytes.Length - 2).ToArray());
            }
        }
Esempio n. 4
0
        /// <summary>
        ///     Copy data from sysex dumps
        /// </summary>
        /// <param name="common">Common sysex message</param>
        /// <param name="partials">SysEx messages </param>
        /// <param name="modifiers"></param>
        public void CopyFrom(SysExMessage common, SysExMessage[] partials, SysExMessage modifiers)
        {
            // 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 commonBytes    = common.GetBytes().Skip(12).ToArray();
            var partialsBytes  = partials.Select(partial => partial.GetBytes().Skip(12).ToArray()).ToArray();
            var modifiersBytes = modifiers.GetBytes().Skip(12).ToArray();

            Common.CopyFrom(commonBytes.Take(commonBytes.Length - 2).ToArray());

            for (var i = 0; i < _partials.Length; i++)
            {
                _partials[i].CopyFrom(partialsBytes[i].Take(partialsBytes[i].Length - 2).ToArray());
            }

            Modifiers.CopyFrom(modifiersBytes.Take(modifiersBytes.Length - 2).ToArray());
        }