Esempio n. 1
0
        /// <summary>
        /// IMPR: Combine with method above.
        /// </summary>
        /// <param name="patchToPaste"></param>
        /// <param name="patch"></param>
        public override void CopyPatch(IPatch patchToPaste, IPatch patch)
        {
            // Copy PRG1 content.
            base.CopyPatch(patchToPaste, patch);

            if (Model.OsVersion == Models.EOsVersion.Kronos15_16)
            {
                if (patch is KronosProgram)
                {
                    // Copy PRG2 content.
                    ClipBoardProgram programToPaste = (ClipBoardProgram)patchToPaste;
                    for (int parameter = 0; parameter < programToPaste.KronosOs1516Content.Length; parameter++)
                    {
                        int patchParameterOffset =
                            ((KronosProgramBank)(patch.Parent)).GetParameterOffsetInPbk2(patch.Index, parameter);
                        Debug.Assert(patchParameterOffset >= 4); // Don't overwrite KORG header
                        Root.Content[patchParameterOffset] = programToPaste.KronosOs1516Content[parameter];
                    }
                }
                else if (patch is KronosCombi)
                {
                    // Copy CBK2 content.
                    ClipBoardCombi combiToPaste = (ClipBoardCombi)patchToPaste;

                    for (int parameter = 0; parameter < KronosCombiBanks.ParametersInCbk2Chunk; parameter++)
                    {
                        for (int timbre = 0; timbre < KronosTimbres.TimbresPerCombiConstant; timbre++)
                        {
                            int patchParameterOffset = ((KronosCombiBank)(patch.Parent)).GetParameterOffsetInCbk2(
                                patch.Index, timbre, parameter);
                            Debug.Assert(patchParameterOffset >= 4); // Don't overwrite KORG header
                            Root.Content[patchParameterOffset] = combiToPaste.KronosOs1516Content[
                                parameter + (timbre * KronosCombiBanks.ParametersInCbk2Chunk)];
                        }
                    }
                }
                else
                {
                    KronosSetListSlot slot = patch as KronosSetListSlot;
                    if (slot != null)
                    {
                        Util.SetInt(this, Content, slot.Stl2BankOffset, 1,
                                    ((ClipBoardSetListSlot)patchToPaste).KronosOs1516Bank);
                        Util.SetInt(this, Content, slot.Stl2PatchOffset, 1,
                                    ((ClipBoardSetListSlot)patchToPaste).KronosOs1516Patch);
                    }
                }

                patch.RaisePropertyChanged(string.Empty, false);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="otherPatch"></param>
        /// <param name="includingName"></param>
        /// <param name="maxDiffs"></param>
        /// <returns></returns>
        public override int CalcByteDifferences(IClipBoardPatch otherPatch, bool includingName, int maxDiffs)
        {
            ClipBoardCombi otherCombi = otherPatch as ClipBoardCombi;

            Debug.Assert(otherCombi != null);

            int diffs = base.CalcByteDifferences(otherPatch, includingName, maxDiffs);

            // Take CBK2 differences into account.
            if (((KronosCombiBank)(Parent)).Cbk2PcgOffset != 0)
            {
                for (int parameterIndex = 0; parameterIndex < KronosCombiBanks.ParametersInCbk2Chunk; parameterIndex++)
                {
                    for (int timbre = 0; timbre < Timbres.TimbresCollection.Count; timbre++)
                    {
                        int patchIndex = ((KronosCombiBank)Parent).GetParameterOffsetInCbk2(Index, timbre, parameterIndex);
                        diffs += (Util.GetInt(PcgRoot.Content, patchIndex, 1) != otherCombi.KronosOs1516Content[parameterIndex]) ? 1 : 0;
                    }
                }
            }
            return(diffs);
        }