Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="drumPattern"></param>
        /// <param name="clipBoardProgram"></param>
        public void CopyDrumPatternOfProgramToClipBoard(IDrumPattern drumPattern, IClipBoardProgram clipBoardProgram)
        {
            IClipBoardDrumPattern clipBoardDrumPatternToAdd = FindDrumPattern(drumPattern) ??
                                                              CopyDrumPatternToClipBoard(drumPattern, false);

            //clipBoardProgram.ReferencedDrumPatterns.CopiedPatches.Add(clipBoardDrumPatternToAdd);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="drumKit"></param>
        /// <param name="clipBoardProgram"></param>
        public void CopyDrumKitOfProgramToClipBoard(IDrumKit drumKit, IClipBoardProgram clipBoardProgram)
        {
            IClipBoardDrumKit clipBoardDrumKitToAdd = FindDrumKit(drumKit) ??
                                                      CopyDrumKitToClipBoard(drumKit, false);

            clipBoardProgram.ReferencedDrumKits.CopiedPatches.Add(clipBoardDrumKitToAdd);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="timbre"></param>
        /// <param name="clipBoardCombi"></param>
        private void CopyTimbreOfCombiToClipboard(ITimbre timbre, IClipBoardCombi clipBoardCombi)
        {
            IClipBoardProgram clipBoardProgramToAdd = null;
            var usedProgramBank = timbre.UsedProgramBank;
            var usedProgram     = (usedProgramBank == null) ? null : timbre.UsedProgram;

            if (ShouldTimbreBeCopied(timbre, usedProgramBank, usedProgram))
            {
                clipBoardProgramToAdd = FindProgram(usedProgram) as IClipBoardProgram ??
                                        CopyProgramToClipBoard(usedProgram, false);
            }

            clipBoardCombi.References.CopiedPatches.Add(clipBoardProgramToAdd);
        }
        /// <summary>
        /// Fix drum kit references in programs (clipBoardPatches).
        /// </summary>
        /// <param name="drumKit"></param>
        private void FixPasteDrumKitReferencesInPrograms(IClipBoardPatch drumKit)
        {
            for (int index = 0; index < (int)ProgramBank.SynthesisType.Last; index++)
            {
                foreach (IClipBoardPatch clipBoardPatch in Programs[index].CopiedPatches)
                {
                    IClipBoardProgram program = (IClipBoardProgram)clipBoardPatch;
                    for (int drumKitIndex = 0; drumKitIndex < program.ReferencedDrumKits.CopiedPatches.Count;
                         drumKitIndex++)
                    {
                        IClipBoardPatch usedDrumKit = program.ReferencedDrumKits.CopiedPatches[drumKitIndex];
                        if (usedDrumKit != drumKit)
                        {
                            continue;
                        }

                        // DrumKit used by usedDrumKit in program.
                        if ((drumKit.PasteDestination != null) && (program.PasteDestination != null))
                        {
                            // When pasting to the same file, then it is not wanted to fix references,
                            // because a duplicate drumkit/program can exist before the original reference
                            // so it will be changed unnecessarily.
                            if (drumKit.OriginalLocation.Root != PastePcgMemory)
                            {
                                Dictionary <IDrumKit, IDrumKit> changes = new Dictionary <IDrumKit, IDrumKit>
                                {
                                    {
                                        ((IProgram)(program.PasteDestination)).UsedDrumKits[drumKitIndex],
                                        (IDrumKit)drumKit.PasteDestination
                                    }
                                };

                                ((IProgram)(program.PasteDestination)).ReplaceDrumKit(changes);
                            }
                            program.ReferencedDrumKits.CopiedPatches[drumKitIndex] = null; // Prevent fixing it again
                        }
                    }
                }
            }
        }