/// <summary> /// /// </summary> /// <param name="fileName"></param> /// <returns></returns> public override IPcgMemory CreatePcgMemory(string fileName) { PcgMemory pcgMemory = null; switch (_fileType) { case Memory.FileType.Lib: // Fall Through case Memory.FileType.MkP0: pcgMemory = new Ms2000MkP0Memory(fileName); break; case Memory.FileType.Bnk: // Fall through case Memory.FileType.Exl: // Fall through case Memory.FileType.Syx: // Fall through case Memory.FileType.Mid: pcgMemory = new Ms2000SysExMemory( fileName, _contentType, _sysExStartOffset, _sysExEndOffset); break; default: throw new NotSupportedException("Unsupported file type"); } Debug.Assert(pcgMemory != null); pcgMemory.Fill(); return(pcgMemory); }
public void SetDefaults() { var korgFileReader = new KorgFileReader(); _pcgMemory = (PcgMemory)korgFileReader.Read(PcgFileName); _lines = null; }
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"; }
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); }
/// <summary> /// /// </summary> public virtual void Clear() { PcgMemory memory = (PcgMemory)Root; if (memory.AssignedClearProgram == null) { UsedProgram = (Program)(((ProgramBank)(PcgRoot.ProgramBanks[0]))[0]); } else { UsedProgram = memory.AssignedClearProgram; } GetParam(ParameterNames.TimbreParameterName.Status).Value = "Off"; if (GetParam(ParameterNames.TimbreParameterName.Mute) != null) { GetParam(ParameterNames.TimbreParameterName.Mute).Value = true; } GetParam(ParameterNames.TimbreParameterName.Volume).Value = 0; GetParam(ParameterNames.TimbreParameterName.MidiChannel).Value = 15; GetParam(ParameterNames.TimbreParameterName.BottomKey).Value = 0; GetParam(ParameterNames.TimbreParameterName.TopKey).Value = 0; GetParam(ParameterNames.TimbreParameterName.BottomVelocity).Value = 0; GetParam(ParameterNames.TimbreParameterName.TopVelocity).Value = 0; IParameter parameter = GetParam(ParameterNames.TimbreParameterName.OscMode); if (parameter != null) { parameter.Value = "Mono"; } parameter = GetParam(ParameterNames.TimbreParameterName.OscSelect); if (parameter != null) { parameter.Value = "Osc2"; } GetParam(ParameterNames.TimbreParameterName.Transpose).Value = 0; GetParam(ParameterNames.TimbreParameterName.Detune).Value = 0; parameter = GetParam(ParameterNames.TimbreParameterName.Portamento); if (parameter != null) { parameter.Value = 0; } parameter = GetParam(ParameterNames.TimbreParameterName.BendRange); if (parameter != null) { parameter.Value = 0; } RefillColumns(); }
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; }
/// <summary> /// /// </summary> /// <param name="drumKit"></param> public ClipBoardDrumKit(IDrumKit drumKit) : base(drumKit.PcgRoot.Content, drumKit.ByteOffset, drumKit.ByteLength) { OriginalLocation = drumKit; PcgMemory memory = drumKit.Root as PcgMemory; if ((memory != null) && (memory.PcgRoot.Model.OsVersion == Models.EOsVersion.Kronos15_16)) { KronosOs1516Bank = Util.GetInt(memory.Content, ((KronosDrumKit)drumKit).Drk2BankOffset, 1); KronosOs1516Patch = Util.GetInt(memory.Content, ((KronosDrumKit)drumKit).Drk2PatchOffset, 1); } }
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); }
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); }
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); }
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 TestDefaultCombiContentList() { // Run. var korgFileReader = new KorgFileReader(); _pcgMemory = (PcgMemory)korgFileReader.Read(PcgDirectory + @"\NEWFILE.PCG"); _generator = new ListGeneratorCombiContentList(); SetDefaults(); Run(); // Length. Assert.AreEqual(1485, _lines.Length); }
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 }
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); }
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 }
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); }
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 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 }
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); }
/// <summary> /// /// </summary> /// <param name="pcgMemory"></param> /// <param name="sourceOffset"></param> /// <param name="destination"></param> /// <param name="destinationOffset"></param> /// <param name="size"></param> public static void CopyBytes(PcgMemory pcgMemory, int sourceOffset, byte[] destination, int destinationOffset, int size) { Debug.Assert(pcgMemory != null); var dirty = false; Debug.Assert(destinationOffset >= 4); // Korg header for (var index = 0; index < size; index++) { dirty |= (destination[sourceOffset + index] != (destination[destinationOffset + index])); //Console.WriteLine(String.Format("CopyBytes: Write {0} to {1}", source[index], offset + index)); destination[destinationOffset + index] = destination[sourceOffset + index]; } pcgMemory.IsDirty |= dirty; }
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; }
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); }
/// <summary> /// Copy bytes internally. /// </summary> /// <param name="pcgMemory"></param> /// <param name="from"></param> /// <param name="to"></param> /// <param name="size"></param> public static void CopyBytes(PcgMemory pcgMemory, int from, int to, int size) { Debug.Assert(pcgMemory != null); var content = pcgMemory.Content; Debug.Assert(from + size < content.Length); Debug.Assert(to + size < content.Length); var dirty = false; for (var index = 0; index < size; index++) { dirty |= (content[from + index] != (content[to + index])); content[to + index] = content[from + index]; } pcgMemory.IsDirty |= dirty; }
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); }
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); }
private static void Run(CommandLineArguments args) { KorgFileReader korgFileReader = new KorgFileReader(); IMemory memory = korgFileReader.Read(args.PcgFileName); if (memory is PcgMemory) { PcgMemory 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(); } }
/// <summary> /// /// </summary> /// <param name="pcgMemory"></param> protected MDrumKitBanks(PcgMemory pcgMemory) : base(pcgMemory) { }
/// <summary> /// /// </summary> /// <param name="pcgMemory"></param> public KrossProgramBanks(PcgMemory pcgMemory) : base(pcgMemory) { }
/// <summary> /// /// </summary> /// <param name="pcgMemory"></param> public M3RProgramBanks(PcgMemory pcgMemory) : base(pcgMemory) { }