public void Read(BinaryReader br) { // Read and validate header Header = new Mono.Header(br); if (Header.offsetWaveInfo > Header.headerSize) { throw new SoundBankException("WaveInfo is outside of header"); } // Read block info headers var blockInfoHeaders = new WaveInfoHeader[Header.numBlocks]; br.BaseStream.Seek(Header.offsetWaveInfo, SeekOrigin.Begin); for (int i = 0; i < Header.numBlocks; i++) { blockInfoHeaders[i] = new WaveInfoHeader(br); } // Read block infos _waveInfos = new List <WaveInfo>(Header.numBlocks); var position = br.BaseStream.Position; foreach (var biHeader in blockInfoHeaders) { br.BaseStream.Seek(position + biHeader.offset, SeekOrigin.Begin); var blockInfo = new WaveInfo(biHeader, br); _waveInfos.Add(blockInfo); } }
public void Read(BinaryReader br) { // Read and validate header Header = new Mono.Header(br); if (Header.offsetWaveInfo > Header.headerSize) { throw new SoundBankException("WaveInfo is outside of header"); } // Read block info headers var blockInfoHeaders = new WaveInfoHeader[Header.numBlocks]; br.BaseStream.Seek(Header.offsetWaveInfo, SeekOrigin.Begin); for (int i = 0; i < Header.numBlocks; i++) { blockInfoHeaders[i] = new WaveInfoHeader(br); } // Read block infos _waveInfos = new List<WaveInfo>(Header.numBlocks); var position = br.BaseStream.Position; foreach (var biHeader in blockInfoHeaders) { br.BaseStream.Seek(position + biHeader.offset, SeekOrigin.Begin); var blockInfo = new WaveInfo(biHeader, br); _waveInfos.Add(blockInfo); } }