public void SetDefaults()
        {
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgFileName);

            _generator = new ListGeneratorCombiContentList
            {
                PcgMemory                        = _pcgMemory,
                IgnoreFirstProgram               = false,
                IgnoreMutedOffTimbres            = true,
                IgnoreMutedOffFirstProgramTimbre = true,
                IgnoreInitCombis                 = true,
                SelectedProgramBanks             = new ObservableBankCollection <IProgramBank>(),
                SelectedCombiBanks               = new ObservableBankCollection <ICombiBank>(),
                ListOutputFormat                 = ListGenerator.OutputFormat.Text,
                OutputFileName                   = $"{Path.GetFileNameWithoutExtension(_pcgMemory.FileName)}_output.txt"
            };

            if (_pcgMemory != null)
            {
                foreach (var item in _pcgMemory.ProgramBanks.BankCollection)
                {
                    _generator.SelectedProgramBanks.Add((IProgramBank)item);
                }

                foreach (var item in _pcgMemory.CombiBanks.BankCollection)
                {
                    _generator.SelectedCombiBanks.Add((ICombiBank)item);
                }
            }

            _lines = null;
        }
        private void SetUp()
        {
            var korgFileReader = new KorgFileReader();

            _pcgOs2 = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\Kronos\all.PCG");
            _pcgOs3 = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\Kronos2\PRELOAD_V3_2016-10-01-20-23-33.PCG");

            // Set settings.
            Settings.Default.CopyPaste_AutoExtendedSinglePatchSelectionPaste = false;

            Settings.Default.CopyPaste_CopyIncompleteCombis       = false;
            Settings.Default.CopyPaste_CopyIncompleteSetListSlots = false;

            Settings.Default.CopyPaste_CopyPatchesFromMasterFile = false;

            Settings.Default.CopyPaste_OverwriteFilledCombis       = false;
            Settings.Default.CopyPaste_OverwriteFilledPrograms     = false;
            Settings.Default.CopyPaste_OverwriteFilledSetListSlots = false;

            Settings.Default.CopyPaste_PasteDuplicateCombis       = false;
            Settings.Default.CopyPaste_PasteDuplicatePrograms     = false;
            Settings.Default.CopyPaste_PasteDuplicateSetListSlots = false;

            Settings.Default.CopyPaste_PatchDuplicationName = (int)CopyPaste.PatchDuplication.DoNotUsePatchNames;
            Settings.Default.CopyPaste_IgnoreCharactersForPatchDuplication = "V2";
        }
        public void SetDefaults()
        {
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgFileName);
            _lines     = null;
        }
Exemple #4
0
        private static void Run(string fileName)
        {
            var korgFileReader = new KorgFileReader();
            var memory         = korgFileReader.Read(PcgDirectory + fileName);

            Assert.IsNotNull(memory);
        }
Exemple #5
0
        private static void Run(string fileName)
        {
            KorgFileReader korgFileReader = new KorgFileReader();

            PcgTools.Model.Common.Synth.MemoryAndFactory.IMemory memory = korgFileReader.Read(PcgDirectory + fileName);
            Assert.IsNotNull(memory);
        }
Exemple #6
0
        protected void TestAll(string path)
        {
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(DefaultDirectory + path);

            Debug.Assert(_pcgMemory != null);

            // Test set list generator.
            TestDefaultPatchList();
            TestProgramUsageList();
            TestDefaultCombiContentList();
            TestDefaultFileContentList();

            // Swap program (if there is more than one program).
            var programBanks = _pcgMemory.ProgramBanks;

            if (programBanks != null)
            {
                var programBank = (ProgramBank)programBanks[0];

                if (programBank.IsFilled && programBank.IsWritable && (programBank.CountPatches > 1))
                {
                    _pcgMemory.SwapPatch(programBank[0], programBank[1]);
                }
            }

            // Swap combi (if there is more than one combi).
            var combiBanks = _pcgMemory.CombiBanks;

            if (combiBanks != null)
            {
                var combiBank = (CombiBank)combiBanks[0];
                if (combiBank.IsFilled && combiBank.IsWritable && (combiBank.CountPatches > 1))
                {
                    _pcgMemory.SwapPatch(combiBank[0], combiBank[1]);
                }
            }

            // Swap set list slot.
            var setLists = _pcgMemory.SetLists;

            if (setLists != null)
            {
                var setList0 = (SetList)setLists[0];
                if (setList0.IsFilled && setList0.IsWritable)
                {
                    _pcgMemory.SwapPatch((SetListSlot)(setList0[0]), (SetListSlot)(setList0[1]));
                }
            }

            // Test save.
            _pcgMemory.FileName = "C:\\test.pcg";
            _pcgMemory.SaveFile(false, false);
        }
        public void SetDefaults()
        {
            KorgFileReader korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgFileName);

            _generator = new ListGeneratorPatchList
            {
                PcgMemory                    = _pcgMemory,
                FilterOnText                 = false,
                FilterText                   = string.Empty,
                FilterCaseSensitive          = false,
                FilterProgramNames           = true,
                FilterCombiNames             = true,
                FilterSetListSlotNames       = true,
                FilterSetListSlotDescription = true,
                FilterWaveSequenceNames      = true,
                FilterDrumKitNames           = true,
                FilterDrumPatternNames       = true,
                IgnoreInitPrograms           = true,
                IgnoreInitCombis             = true,
                SetListsEnabled              = true,
                IgnoreInitSetListSlots       = true,
                SetListsRangeFrom            = 0,
                SetListsRangeTo              = 0,
                DrumKitsEnabled              = true,
                IgnoreInitDrumKits           = true,
                DrumPatternsEnabled          = true,
                IgnoreInitDrumPatterns       = true,
                WaveSequencesEnabled         = true,
                IgnoreInitWaveSequences      = true,
                SortMethod                   = ListGenerator.Sort.Alphabetical,
                ListOutputFormat             = ListGenerator.OutputFormat.Text,
                SelectedProgramBanks         = new ObservableBankCollection <IProgramBank>(),
                SelectedCombiBanks           = new ObservableBankCollection <ICombiBank>(),
                OutputFileName               = $"{Path.GetFileNameWithoutExtension(_pcgMemory.FileName)}_output.txt"
            };

            if (_pcgMemory != null)
            {
                foreach (IBank item in _pcgMemory.ProgramBanks.BankCollection)
                {
                    _generator.SelectedProgramBanks.Add((IProgramBank)item);
                }

                foreach (IBank item in _pcgMemory.CombiBanks.BankCollection)
                {
                    _generator.SelectedCombiBanks.Add((ICombiBank)item);
                }
            }


            _lines = null;
        }
Exemple #8
0
        public void TestDefaultPatchList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\OasysPRELOAD.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(1995, _lines.Length);
        }
        public void TestDefaultPatchList()
        {
            // Run.
            KorgFileReader korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\NEWFILE.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(3103, _lines.Length);
        }
Exemple #10
0
        public void TestJuanbE()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\JUANB_E.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(254, _lines.Length);
        }
Exemple #11
0
        public void TestArroba()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\[email protected]");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(1143, _lines.Length);
        }
Exemple #12
0
        public void TestProgramUsageList()
        {
            // Run.
            KorgFileReader korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\M3_ORGPCGV2.PCG");

            _generator = new ListGeneratorProgramUsageList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(707, _lines.Length);
        }
Exemple #13
0
        public void TestKnCp80ProgramUsageList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\CLS_EXB.pcg");

            _generator = new ListGeneratorProgramUsageList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(496, _lines.Length);
        }
Exemple #14
0
        public void TestDefaultCombiContentList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\NEWFILE.PCG");

            _generator = new ListGeneratorCombiContentList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(1485, _lines.Length);
        }
Exemple #15
0
        public void TestAllCombiBanksProgramUsageList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\ALLCOMBA.PCG");

            _generator = new ListGeneratorProgramUsageList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(1254, _lines.Length);
        }
Exemple #16
0
        public void TestGlobalProgramUsageList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\GLOBAL.PCG");

            _generator = new ListGeneratorProgramUsageList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(0, _lines.Length);   // Including GM
        }
Exemple #17
0
        public void Test1CombiBankPatchList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\1COMBANK.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(256, _lines.Length);   // Including GM
        }
Exemple #18
0
        public void TestDrumKitArpeggiosPatchList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\DRKITARP.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(128, _lines.Length);   // Including GM
        }
Exemple #19
0
        public void TestAllProgramBanksPatchList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\ALLPRGBA.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            Run();

            // Length.
            Assert.AreEqual(1618, _lines.Length);
        }
        public static void LoadFileAndMasterFile(IMainViewModel mainViewModel, string fileName, bool checkAutoLoadMasterFileSetting)
        {
            _mainViewModel = mainViewModel;

            // Load file.
            KorgFileReader korgFileReader = new KorgFileReader();
            IMemory        memory         = korgFileReader.Read(fileName); // Model type/file type only used when error

            if (memory == null)
            {
                _mainViewModel.ShowMessageBox(
                    string.Format(Strings.FileTypeNotSupportedForThisWorkstation,
                                  Memory.FileTypeAsString(korgFileReader.FileType),
                                  Model.Common.Synth.MemoryAndFactory.Model.ModelTypeAsString(korgFileReader.ModelType)),
                    Strings.PcgTools, WindowUtils.EMessageBoxButton.Ok, WindowUtils.EMessageBoxImage.Error,
                    WindowUtils.EMessageBoxResult.Ok);
                return;
            }

            _mainViewModel.SelectedMemory = memory;

            // Load master file if requested.
            LoadMasterFileIfRequested(checkAutoLoadMasterFileSetting, fileName);

            // Create child window.
            MdiChild mdiChild;

            if (memory is IPcgMemory)
            {
                int width  = Settings.Default.UI_PcgWindowWidth == 0 ? 700 : Settings.Default.UI_PcgWindowWidth;
                int height = Settings.Default.UI_PcgWindowHeight == 0 ? 500 : Settings.Default.UI_PcgWindowHeight;
                mdiChild = _mainViewModel.CreateMdiChildWindow(fileName, MainViewModel.ChildWindowType.Pcg, memory, width, height);
                ((PcgWindow)(mdiChild.Content)).ViewModel.SelectedMemory = memory;
                _mainViewModel.CurrentChildViewModel = ((PcgWindow)(mdiChild.Content)).ViewModel;
                ((IPcgMemory)memory).SelectFirstBanks();
            }
            else if (memory is ISongMemory)
            {
                int width  = Settings.Default.UI_SongWindowWidth == 0 ? 700 : Settings.Default.UI_SongWindowWidth;
                int height = Settings.Default.UI_SongWindowHeight == 0 ? 500 : Settings.Default.UI_SongWindowHeight;
                mdiChild = _mainViewModel.CreateMdiChildWindow(fileName, MainViewModel.ChildWindowType.Song, memory, width, height);
                _mainViewModel.CurrentChildViewModel = ((SongWindow)(mdiChild.Content)).ViewModel;
                ((SongWindow)(mdiChild.Content)).ViewModel.SelectedMemory = memory;
            }
            else
            {
                throw new ApplicationException("Unknown memory type");
            }
        }
Exemple #21
0
        public void SetDefaults()
        {
            KorgFileReader korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgFileName);

            _generator = new ListGeneratorProgramUsageList
            {
                PcgMemory                        = _pcgMemory,
                IgnoreInitPrograms               = true,
                IgnoreFirstProgram               = false,
                IgnoreMutedOffTimbres            = true,
                IgnoreMutedOffFirstProgramTimbre = true,
                IgnoreInitCombis                 = true,
                SetListsEnabled                  = true,
                SetListsRangeFrom                = 0,
                SetListsRangeTo                  = 0,
                IgnoreInitSetListSlots           = true,
                SelectedProgramBanks             = new ObservableBankCollection <IProgramBank>(),
                SelectedCombiBanks               = new ObservableBankCollection <ICombiBank>(),
                DrumKitsEnabled                  = true,
                IgnoreInitDrumKits               = true,
                DrumPatternsEnabled              = true,
                IgnoreInitDrumPatterns           = true,
                WaveSequencesEnabled             = true,
                IgnoreInitWaveSequences          = true,
                ListOutputFormat                 = ListGenerator.OutputFormat.Text,
                OutputFileName                   = $"{Path.GetFileNameWithoutExtension(_pcgMemory.FileName)}_output.txt"
            };
            if (_pcgMemory != null)
            {
                foreach (IBank item in _pcgMemory.ProgramBanks.BankCollection)
                {
                    _generator.SelectedProgramBanks.Add((IProgramBank)item);
                }

                foreach (IBank item in _pcgMemory.CombiBanks.BankCollection)
                {
                    _generator.SelectedCombiBanks.Add((ICombiBank)item);
                }
            }

            _lines = null;
        }
Exemple #22
0
        public void TestCombi5()
        {
            // Run.
            KorgFileReader korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\ALEXSCM1.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();
            if (_pcgMemory != null)
            {
                _generator.SelectedProgramBanks.RemoveAt(_pcgMemory.ProgramBanks.BankCollection.Count - 1); // Last bank is GM bank
            }

            Run();

            // Length.
            Assert.AreEqual(3, _lines.Length);
        }
Exemple #23
0
        public void TestKNMod7()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\..\Kronos\\KNAL1_3.PCG");

            _generator = new ListGeneratorPatchList();
            SetDefaults();

            if (_pcgMemory != null)
            {
                _generator.SelectedProgramBanks.RemoveAt(_pcgMemory.ProgramBanks.BankCollection.Count - 1); // Last bank is GM bank
            }

            Run();

            // Length.
            Assert.AreEqual(107, _lines.Length);
        }
Exemple #24
0
        public void TestAkSonsProgramUsageList()
        {
            // Run.
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\AK_SONS.PCG");

            _generator = new ListGeneratorProgramUsageList();
            SetDefaults();

            if (_pcgMemory != null)
            {
                _generator.SelectedProgramBanks.RemoveAt(_pcgMemory.ProgramBanks.BankCollection.Count - 1); // Last bank is GM bank
            }

            Run();

            // Length.
            Assert.AreEqual(683, _lines.Length);
        }
Exemple #25
0
        static void Run(CommandLineArguments args)
        {
            var korgFileReader = new KorgFileReader();
            var memory         = korgFileReader.Read(args.PcgFileName);

            if (memory is PcgMemory)
            {
                var pcgMemory = memory as PcgMemory;
                args.ListGenerator.PcgMemory = pcgMemory;

                foreach (IProgramBank item in pcgMemory.ProgramBanks.BankCollection)
                {
                    args.ListGenerator.SelectedProgramBanks.Add(item);
                }

                foreach (ICombiBank item in pcgMemory.CombiBanks.BankCollection)
                {
                    args.ListGenerator.SelectedCombiBanks.Add(item);
                }

                args.ListGenerator.Run();
            }
        }