/// <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) { ClipBoardProgram otherProgram = otherPatch as ClipBoardProgram; Debug.Assert(otherProgram != null); int diffs = base.CalcByteDifferences(otherPatch, includingName, maxDiffs); return(diffs); }
/// <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); } }
/// <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) { ClipBoardProgram otherProgram = otherPatch as ClipBoardProgram; Debug.Assert(otherProgram != null); int diffs = base.CalcByteDifferences(otherPatch, includingName, maxDiffs); // Take PBK2 differences into account. if (((KronosProgramBank)(Parent)).Pbk2PcgOffset != 0) { for (int parameterIndex = 0; parameterIndex < KronosProgramBanks.ParametersInPbk2Chunk; parameterIndex++) { int patchIndex = ((KronosProgramBank)Parent).GetParameterOffsetInPbk2(Index, parameterIndex); diffs += (Util.GetInt(PcgRoot.Content, patchIndex, 1) != otherProgram.KronosOs1516Content[parameterIndex]) ? 1 : 0; } } return(diffs); }