public ExtractedSoundPitchRange(int index, string name, SoundPitchRangeParameter param, bool hasData, int requiredCount, List <ExtractedSoundPermutation> perms) { OriginalIndex = index; Name = name; Parameter = param; HasEncodedData = hasData; RequiredPermutationCount = requiredCount; Permutations = perms; }
private static ExtractedSoundPitchRange ReadSoundPitchRange(IReader reader, byte version) { if (version > 1) { throw new InvalidOperationException("Unrecognized \"snpr\" block version"); } int originalIndex = reader.ReadInt32(); string name = reader.ReadAscii(); SoundPitchRangeParameter param = null; if (reader.ReadByte() == 1) { param = new SoundPitchRangeParameter(); param.NaturalPitch = reader.ReadInt32(); param.BendMin = reader.ReadInt32(); param.BendMax = reader.ReadInt32(); param.MaxGainPitchMin = reader.ReadInt32(); param.MaxGainPitchMax = reader.ReadInt32(); param.PlaybackPitchMin = reader.ReadInt32(); param.PlaybackPitchMax = reader.ReadInt32(); if (reader.ReadByte() == 1) { SoundPitchRangeDistance dist = new SoundPitchRangeDistance(); dist.DontPlayDistance = reader.ReadFloat(); dist.AttackDistance = reader.ReadFloat(); dist.MinDistance = reader.ReadFloat(); dist.MaxDistance = reader.ReadFloat(); param.Distance = dist; } } bool hasdata = (reader.ReadByte() == 1); int reqcount = reader.ReadInt32(); System.Collections.Generic.List <ExtractedSoundPermutation> perms = new System.Collections.Generic.List <ExtractedSoundPermutation>(); int permcount = reader.ReadInt32(); for (int p = 0; p < permcount; p++) { ExtractedSoundPermutation perm = new ExtractedSoundPermutation(); perm.Name = reader.ReadAscii(); perm.EncodedSkipFraction = reader.ReadInt32(); perm.SampleSize = reader.ReadInt32(); perm.EncodedGain = reader.ReadInt32(); perm.EncodedPermutationInfoIndex = reader.ReadInt32(); perm.FSBInfo = reader.ReadInt32(); int chunkcount = reader.ReadInt32(); perm.Chunks = new System.Collections.Generic.List <ExtractedSoundChunk>(); for (int c = 0; c < chunkcount; c++) { SoundChunk chunk = new SoundChunk(); chunk.FileOffset = reader.ReadInt32(); chunk.EncodedSizeAndFlags = reader.ReadInt32(); chunk.CacheIndex = reader.ReadInt32(); chunk.XMA2BufferStart = reader.ReadInt32(); chunk.XMA2BufferEnd = reader.ReadInt32(); chunk.Unknown = reader.ReadInt32(); chunk.Unknown1 = reader.ReadInt32(); string bankSuffix = null; if (version >= 1) { bankSuffix = reader.ReadAscii(); } perm.Chunks.Add(new ExtractedSoundChunk(chunk, bankSuffix)); } int langcount = reader.ReadInt32(); perm.Languages = new System.Collections.Generic.List <ExtractedSoundLanguagePermutation>(); for (int l = 0; l < langcount; l++) { ExtractedSoundLanguagePermutation lang = new ExtractedSoundLanguagePermutation(); lang.LanguageIndex = reader.ReadInt32(); lang.SampleSize = reader.ReadInt32(); int lchunkcount = reader.ReadInt32(); lang.Chunks = new System.Collections.Generic.List <ExtractedSoundChunk>(); for (int c = 0; c < lchunkcount; c++) { SoundChunk chunk = new SoundChunk(); chunk.FileOffset = reader.ReadInt32(); chunk.EncodedSizeAndFlags = reader.ReadInt32(); chunk.CacheIndex = reader.ReadInt32(); chunk.XMA2BufferStart = reader.ReadInt32(); chunk.XMA2BufferEnd = reader.ReadInt32(); chunk.Unknown = reader.ReadInt32(); chunk.Unknown1 = reader.ReadInt32(); string bankSuffix = null; if (version >= 1) { bankSuffix = reader.ReadAscii(); } lang.Chunks.Add(new ExtractedSoundChunk(chunk, bankSuffix)); } perm.Languages.Add(lang); } int markercount = reader.ReadInt32(); perm.LayerMarkers = new System.Collections.Generic.List <int>(); for (int m = 0; m < markercount; m++) { perm.LayerMarkers.Add(reader.ReadInt32()); } perms.Add(perm); } return(new ExtractedSoundPitchRange(originalIndex, name, param, hasdata, reqcount, perms)); }