Exemple #1
0
 public WaveInfo(WaveInfoHeader header, BinaryReader br) : this()
 {
     Header = header;
     Read(br);
 }
Exemple #2
0
 public WaveInfo(WaveInfoHeader header) : this()
 {
     Header = header;
 }
Exemple #3
0
 public WaveInfo(WaveInfoHeader header) : this()
 {
     Header = header;
 }
Exemple #4
0
 public WaveInfo(WaveInfoHeader header, BinaryReader br) : this()
 {
     Header = header;
     Read(br);
 }
Exemple #5
0
        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);
            }
        }