/// <summary> /// /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { Index = 0x60; var programBank = (ProgramBank)CurrentPcgMemory.ProgramBanks[0]; const int numberOfProgramsInBank = 64; for (var bankIndex = 0; bankIndex < CurrentPcgMemory.ProgramBanks.BankCollection.Count; bankIndex++) { var bank = (ProgramBank)(CurrentPcgMemory.ProgramBanks[bankIndex]); bank.ByteOffset = Index; bank.BankSynthesisType = ProgramBank.SynthesisType.Mmt; bank.PatchSize = 496; bank.IsWritable = true; bank.IsLoaded = true; for (var index = 0; index < numberOfProgramsInBank; index++) { // Place in PcgMemory. var program = (Program)bank[index]; program.ByteOffset = Index; program.ByteLength = programBank.PatchSize; program.IsLoaded = true; // Skip to next. Index += 0x210; } } }
/// <summary> /// /// </summary> /// <param name="fileType"></param> /// <param name="contentType"></param> /// <param name="sysExStartOffset"></param> /// <param name="sysExEndOffset"></param> public M1Factory(Memory.FileType fileType, PcgMemory.ContentType contentType, int sysExStartOffset, int sysExEndOffset) { _fileType = fileType; _contentType = contentType; _sysExStartOffset = sysExStartOffset; _sysExEndOffset = sysExEndOffset; }
/// <summary> /// /// </summary> /// <param name="fileType"></param> /// <param name="contentType"></param> /// <param name="sysExStartOffset"></param> /// <param name="sysExEndOffset"></param> public ZeroSeriesFactory(Memory.FileType fileType, PcgMemory.ContentType contentType, int sysExStartOffset, int sysExEndOffset) { FileType = fileType; ContentType = contentType; SysExStartOffset = sysExStartOffset; SysExEndOffset = sysExEndOffset; }
/// <summary> /// /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { var memory = SkipModeChange(filetype); Index = SysExStartOffset; // Continue parsing. switch (filetype) { case Memory.FileType.Syx: // Fall through case Memory.FileType.Mid: memory.Convert7To8Bits(); switch (ContentType) { case PcgMemory.ContentType.CurrentProgram: ReadSingleProgram(SysExStartOffset); memory.SynchronizeProgramName(); break; case PcgMemory.ContentType.CurrentCombi: ReadSingleCombi(SysExStartOffset); memory.SynchronizeCombiName(); break; case PcgMemory.ContentType.All: ReadAllData(); break; case PcgMemory.ContentType.AllCombis: // Not used. break; case PcgMemory.ContentType.AllPrograms: ReadPrograms(memory); break; case PcgMemory.ContentType.Global: case PcgMemory.ContentType.AllSequence: // Do not read anything. break; // default: Do nothing, should result in: No Patch data in file } break; default: throw new NotSupportedException("Unsupported file type"); } }
/// <summary> /// Trinity does not use chunks. /// </summary> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { _index = 0x20; // Start of PCG usage. int programBanks; int programsInProgramBank; ReadBanksUsage(out programBanks, out programsInProgramBank, SampledProgramSize); int sProgramBanks; int sProgramsInProgramBank; ReadBanksUsage(out sProgramBanks, out sProgramsInProgramBank, ModeledProgramSize); int combiBanks; int combisInCombiBank; ReadBanksUsage(out combiBanks, out combisInCombiBank, CombiSize); Debug.Assert(combisInCombiBank % 128 == 0); int drumKits; int drumKitsInDrumKitBank; ReadBanksUsage(out drumKits, out drumKitsInDrumKitBank, DrumKitSize, false); int global; int globalBanks; ReadBanksUsage(out global, out globalBanks, GlobalSize, false); int mProgramBanks; int mProgramsInProgramBank; ReadBanksUsage(out mProgramBanks, out mProgramsInProgramBank, ModeledProgramSize); if (mProgramBanks > 0) { // Only V3 have M (Moss) bank(s). CurrentPcgMemory.Model = Models.Find(Models.EOsVersion.TrinityV3); } ReadProgramBanks(programBanks, programsInProgramBank); ReadSProgramBanks(sProgramBanks, sProgramsInProgramBank); ReadCombiBanks(combiBanks); ReadDrumKitBanks(drumKits); ReadGlobal(globalBanks == 1); ReadMProgramBanks(mProgramBanks, mProgramsInProgramBank); SetNotifications(); }
/// <summary> /// /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { ProgramBank bank = (ProgramBank)CurrentPcgMemory.ProgramBanks[0]; bank.ByteOffset = Index; bank.BankSynthesisType = ProgramBank.SynthesisType.Mmt; bank.PatchSize = 496; bank.IsWritable = true; bank.IsLoaded = true; // Place in PcgMemory. Program program = (Program)bank[0]; program.ByteOffset = 32; // Fixed program.ByteLength = bank.PatchSize; program.IsLoaded = true; }
/// <summary> /// Reads content of a PCG file. /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { Index = Div1Offset; while (Index < CurrentPcgMemory.Content.Length) { var chunkName = Util.GetChars(CurrentPcgMemory.Content, Index, 4); var chunkSize = Util.GetInt(CurrentPcgMemory.Content, Index + 4, 4); // ReSharper disable LocalizableElement Console.WriteLine("index = " + Index.ToString("X08") + ", Chunk name: " + chunkName + ", size of chunk: " + chunkSize.ToString("X08")); // ReSharper enable LocalizableElement CurrentPcgMemory.Chunks.Collection.Add(new Chunk(chunkName, Index, chunkSize)); ReadChunk(chunkName, chunkSize); } SetNotifications(); }
/// <summary> /// /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { switch (filetype) { case Memory.FileType.Lib: ReadLibData(); break; case Memory.FileType.MkP0: ReadMkP0Data(); break; case Memory.FileType.Bnk: // Fall through case Memory.FileType.Exl: // Fall through case Memory.FileType.Syx: // Fall through case Memory.FileType.Mid: var memory = (SysExMemory)CurrentPcgMemory; memory.Convert7To8Bits(); switch (ContentType) { case PcgMemory.ContentType.CurrentProgram: ReadSingleProgram(SysExStartOffset); memory.SynchronizeProgramName(); break; case PcgMemory.ContentType.All: ReadAllData(); break; case PcgMemory.ContentType.AllPrograms: ReadAllData(); break; default: throw new NotSupportedException("Unsupported SysEx function"); } break; default: throw new NotSupportedException("Unsupported file type"); } }
/// <summary> /// /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { SysExMemory memory = SkipSysexModeChange(filetype); // Continue parsing. switch (filetype) { case Memory.FileType.Syx: // Fall through case Memory.FileType.Mid: memory.Convert7To8Bits(); switch (ContentType) { case PcgMemory.ContentType.CurrentProgram: ReadSingleProgram(SysExStartOffset); memory.SynchronizeProgramName(); break; case PcgMemory.ContentType.CurrentCombi: ReadSingleCombi(SysExStartOffset); memory.SynchronizeCombiName(); break; case PcgMemory.ContentType.All: case PcgMemory.ContentType.AllCombis: case PcgMemory.ContentType.AllPrograms: ReadAllData(); break; case PcgMemory.ContentType.Global: case PcgMemory.ContentType.AllSequence: // Do not read anything. break; default: throw new NotSupportedException("Unsupported SysEx function"); } break; default: throw new NotSupportedException("Unsupported file type"); } }
/// <summary> /// /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) { var memory = SkipModeChange(filetype); // Continue parsing. switch (filetype) { case Memory.FileType.Syx: // Fall through case Memory.FileType.Mid: ReadSyxMidContent(memory); break; case Memory.FileType.Raw: ReadRawDiskImage(); break; default: throw new NotSupportedException("Unsupported file type"); } }
/// <summary> /// Skip Mode Change (not for Sysex Manager file and OrigKorg file). /// </summary> /// <param name="filetype"></param> /// <returns></returns> private ISysExMemory SkipModeChange(Memory.FileType filetype) { var memory = (ISysExMemory)CurrentPcgMemory; switch (filetype) { case Memory.FileType.Syx: if ((Util.GetChars(memory.Content, 0, 14) != "Sysex Manager-") && (Util.GetChars(memory.Content, 2, 8) != "OrigKorg")) { var offset = SkipModeChanges(); SysExStartOffset += offset; ContentType = (PcgMemory.ContentType)memory.Content[offset + 4]; memory.ContentTypeType = ContentType; } break; // case Memory.FileType.Mid: Do nothing //default: Do nothing } return(memory); }
/// <summary> /// /// </summary> /// <param name="fileType"></param> /// <param name="contentType"></param> /// <param name="sysExStartOffset"></param> /// <param name="sysExEndOffset"></param> public Zero3RwFactory(Memory.FileType fileType, PcgMemory.ContentType contentType, int sysExStartOffset, int sysExEndOffset) : base(fileType, contentType, sysExStartOffset, sysExEndOffset) { }
/// <summary> /// /// </summary> /// <param name="fileType"></param> /// <param name="modelType"></param> public void ReadContent(Memory.FileType fileType, Models.EModelType modelType) { throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="filetype"></param> /// <param name="modelType"></param> public override void ReadContent(Memory.FileType filetype, Models.EModelType modelType) // Continue parsing. { KrossPcgMemory memory = (KrossPcgMemory)CurrentPcgMemory; const int headerSize = 32; // bytes switch (_contentType) { case PcgMemory.ContentType.All: { ReadAllCombis(memory, 0x20); ReadAllPrograms(memory, 0xf7a20); ReadAllDrumKits(memory, 0x246020); } break; case PcgMemory.ContentType.CurrentProgram: ReadSingleProgram(headerSize); // Is starting index memory.SynchronizeProgramName(); break; case PcgMemory.ContentType.ProgramBank: { ProgramBank firstBank = (ProgramBank)(memory.ProgramBanks[0]); int offset = headerSize; foreach (IPatch program in firstBank.Patches) { ReadSingleProgram(offset); offset += firstBank.PatchSize; } } break; case PcgMemory.ContentType.AllPrograms: ReadAllPrograms(memory, headerSize); break; case PcgMemory.ContentType.CurrentCombi: ReadSingleCombi(headerSize); // Is starting index memory.SynchronizeCombiName(); break; case PcgMemory.ContentType.CombiBank: { IBank firstBank = memory.CombiBanks[0]; int offset = headerSize; foreach (IPatch combi in firstBank.Patches) { ReadSingleCombi(offset); offset += firstBank.ByteLength; } } break; case PcgMemory.ContentType.AllCombis: ReadAllCombis(memory, headerSize); break; case PcgMemory.ContentType.AllDrumSound: case PcgMemory.ContentType.Drums: case PcgMemory.ContentType.ArpeggioPattern: case PcgMemory.ContentType.CurrentArpeggioPattern: case PcgMemory.ContentType.MultiSound: case PcgMemory.ContentType.Global: case PcgMemory.ContentType.AllSequence: case PcgMemory.ContentType.CurrentSequence: // Do not read anything. break; default: throw new NotSupportedException("Unsupported SysEx function"); } // Read global. if (_contentType == PcgMemory.ContentType.All) { memory.Global.ByteOffset = 0x338680 - 334; // 334 bytes before categories start. } else { memory.Global = null; } }
/// <summary> /// /// </summary> /// <param name="fileType"></param> /// <param name="modelType"></param> public abstract void ReadContent(Memory.FileType fileType, Models.EModelType modelType);
/// <summary> /// /// </summary> /// <param name="fileType"></param> public MicroKorgXlPlusFactory(Memory.FileType fileType) : base() { _fileType = fileType; }