/// <summary> /// /// </summary> /// <param name="drumKitBank"></param> /// <param name="index"></param> public KromeExDrumKit(DrumKitBank drumKitBank, int index) : base(drumKitBank, index) { // Override ID. int indexInId = index; if (drumKitBank.Type == Common.Synth.Meta.BankType.EType.User) { indexInId += PcgRoot.DrumKitBanks.BankCollection[0].NrOfPatches; } Id = $"{drumKitBank.Id}{indexInId.ToString("000")}"; }
/// <summary> /// /// </summary> /// <param name="offset"></param> private void ReadSingleDrumKit(int offset) { DrumKitBank bank = (DrumKitBank)(CurrentPcgMemory.DrumKitBanks[_bank]); bank.ByteOffset = 0; bank.PatchSize = 0x2218; bank.IsWritable = true; bank.IsLoaded = true; DrumKit drumKit = (DrumKit)bank[_patchIndex]; drumKit.ByteOffset = offset; drumKit.ByteLength = bank.PatchSize; drumKit.IsLoaded = true; IncreaseDrumKit(); }
/// <summary> /// /// </summary> private void ReadDbk1Chunk() { int chunkSize = Util.GetInt(CurrentPcgMemory.Content, Index + 4, 4); CurrentPcgMemory.Chunks.Collection.Add(new Chunk("DBK1", Index, chunkSize)); int startIndex = Index; Index += Dbk1NumberOfDrumKitsOffset; int numberOfDrumKitsInBank = Util.GetInt(CurrentPcgMemory.Content, Index, 4); Index += 4; int sizeOfADrumKit = Util.GetInt(CurrentPcgMemory.Content, Index, 4); // ReSharper disable RedundantStringFormatCall Console.WriteLine($" Size of a drumkit: {sizeOfADrumKit}"); // ReSharper restore RedundantStringFormatCall Index += 4; int bankId = Util.GetInt(CurrentPcgMemory.Content, Index, 4); int bankIndex = DrumKitBankId2DrumKitIndex(bankId); Index += 4; DrumKitBank drumKitBank = (DrumKitBank)CurrentPcgMemory.DrumKitBanks[bankIndex]; drumKitBank.ByteOffset = startIndex; drumKitBank.PatchSize = sizeOfADrumKit; drumKitBank.IsWritable = true; drumKitBank.IsLoaded = true; for (int index = 0; index < numberOfDrumKitsInBank; index++) { // Place in PcgMemory. DrumKit drumKit = (DrumKit)drumKitBank[index]; drumKit.ByteOffset = Index; drumKit.ByteLength = sizeOfADrumKit; drumKit.IsLoaded = true; Index += sizeOfADrumKit; } }
/// <summary> /// /// </summary> /// <param name="drumKitBank"></param> /// <param name="index"></param> public NautilusDrumKit(DrumKitBank drumKitBank, int index) : base(drumKitBank, index) { }
/// <summary> /// /// </summary> /// <param name="writer"></param> /// <param name="lines"></param> private void ParseItems(TextWriter writer, List <string> lines) { foreach (IBank bank in _list) { string bankType = string.Empty; string contentType = string.Empty; string bankId = string.Empty; int writablePatches = 0; int filledPatches = 0; int emptyPatches = 0; List <IPatch> filledPatchList = new List <IPatch>(); ProgramBank bank1 = bank as ProgramBank; if (bank1 != null) { ProgramBank programBank = bank1; bankType = "ProgramBank"; bankId = programBank.Id; contentType = $"{ProgramBank.SynthesisTypeAsString(programBank.BankSynthesisType)} {Strings.Programs}"; writablePatches = programBank.Patches.Count(program => programBank.IsWritable); filledPatches = programBank.CountFilledAndNonEmptyPatches; emptyPatches = writablePatches - filledPatches; filledPatchList.AddRange( programBank.Patches.Where(program => programBank.IsLoaded && !program.IsEmptyOrInit)); } else { CombiBank combiBank1 = bank as CombiBank; if (combiBank1 != null) { CombiBank combiBank = combiBank1; bankType = "CombiBank"; bankId = combiBank.Id; contentType = "Combis"; writablePatches = combiBank.Patches.Count(combi => combiBank.IsWritable); filledPatches = combiBank.CountFilledPatches; emptyPatches = writablePatches - filledPatches; IEnumerable <IPatch> filledCombis = combiBank.Patches.Where(combi => combiBank.IsLoaded && !combi.IsEmptyOrInit); filledPatchList.AddRange(filledCombis); } else { SetList list = bank as SetList; if (list != null) { SetList setList = list; bankType = "SetList"; bankId = setList.Id; contentType = "SetListSlots"; writablePatches = setList.Patches.Count(setListSlot => setList.IsWritable); filledPatches = setList.CountFilledPatches; emptyPatches = writablePatches - filledPatches; filledPatchList.AddRange(setList.Patches.Where( setListSlot => setList.IsLoaded && !setListSlot.IsEmptyOrInit)); } else { WaveSequenceBank seqBank = bank as WaveSequenceBank; if (seqBank != null) { WaveSequenceBank waveSeqBank = seqBank; bankType = "WaveSeqBank"; bankId = waveSeqBank.Id; contentType = "WaveSequences"; writablePatches = waveSeqBank.Patches.Count(waveSeq => waveSeqBank.IsWritable); filledPatches = waveSeqBank.CountFilledPatches; emptyPatches = writablePatches - filledPatches; filledPatchList.AddRange(waveSeqBank.Patches.Where( waveSeq => waveSeqBank.IsLoaded && !waveSeq.IsEmptyOrInit)); } else { DrumKitBank kitBank = bank as DrumKitBank; if (kitBank != null) { DrumKitBank drumKitBank = kitBank; bankType = "DrumKitBank"; bankId = drumKitBank.Id; contentType = "DrumKits"; writablePatches = drumKitBank.Patches.Count(drumKit => drumKitBank.IsWritable); filledPatches = drumKitBank.CountFilledPatches; emptyPatches = writablePatches - filledPatches; filledPatchList.AddRange(drumKitBank.Patches.Where( drumKit => drumKitBank.IsLoaded && !drumKit.IsEmptyOrInit)); } else { DrumPatternBank patternBank = bank as DrumPatternBank; if (patternBank != null) { DrumPatternBank drumPatternBank = patternBank; bankType = "DrumPatternBank"; bankId = drumPatternBank.Id; contentType = "DrumPatterns"; writablePatches = drumPatternBank.Patches.Count( drumPattern => drumPatternBank.IsWritable); filledPatches = drumPatternBank.CountFilledPatches; emptyPatches = writablePatches - filledPatches; filledPatchList.AddRange(drumPatternBank.Patches.Where( drumPattern => drumPatternBank.IsLoaded && !drumPattern.IsEmptyOrInit)); } else { Debug.Fail("Error in switch"); } } } } } } WriteItem(writer, lines, bankType, contentType, bankId, writablePatches, filledPatches, emptyPatches, filledPatchList); } }
/// <summary> /// /// </summary> /// <param name="drumKitBank"></param> /// <param name="index"></param> public KromeDrumKit(DrumKitBank drumKitBank, int index) : base(drumKitBank, index) { }