/// <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="patch"></param> /// <param name="otherPatch"></param> public virtual void SwapPatch(IPatch patch, IPatch otherPatch) { if (patch == otherPatch) { return; } // Swap PRG1 content. Util.SwapBytes(this, Content, patch.ByteOffset, Content, otherPatch.ByteOffset, patch.ByteLength); // Swap PRG2 content (only used for Kronos, OS1.5/1.6). if (patch.Root.Model.OsVersion == Models.EOsVersion.Kronos15_16) { if (patch is KronosProgram) { ((KronosProgramBanks)(PcgRoot.ProgramBanks)).SwapPbk2Content(patch, otherPatch); } else if (patch is KronosCombi) { ((KronosCombiBanks)(PcgRoot.CombiBanks)).SwapCbk2Content(patch, otherPatch); } else { KronosSetListSlot slot = patch as KronosSetListSlot; if (slot != null) { slot.SwapOs1516Data((KronosSetListSlot)otherPatch); } } } patch.RaisePropertyChanged(string.Empty, false); if (patch is Program) { (patch as Program).Update("All"); } otherPatch.RaisePropertyChanged(string.Empty, false); if (otherPatch is Program) { (otherPatch as Program).Update("All"); } }