public StreamingSoundbank(Stream s)
        {
            DataStream = new MemoryStream();
            s.CopyTo(DataStream);

            DataStream.Seek(0, SeekOrigin.Begin);

            Header = DataStream.ReadStruct <SoundbankHeader>();

            if (Header.Signature != 0x42535756)
            {
                throw new InvalidDataException("File is not a streaming soundbank.");
            }

            for (int i = 0; i < Header.NumFiles; i++)
            {
                var fileInfo = DataStream.ReadStruct <SoundbankEntryInfo>();

                if ((fileInfo.MetadataLength % 2048) != 0)
                {
                    throw new Exception();
                }

                if ((fileInfo.Offset % 2048) != 0)
                {
                    throw new Exception();
                }

                var entry = new SoundbankEntry(this, fileInfo);
                Files.Add(entry);
            }
        }
        public void AddFile(uint id, Stream audioStream, Stream metadataStream)
        {
            SoundbankEntry entry = new SoundbankEntry(this);

            entry.Info.FileId = id;
            if (metadataStream != null)
            {
                entry.Info.MetadataLength = (uint)metadataStream.Length;
            }
            else
            {
                entry.Info.MetadataLength = 0;
            }
            entry.Info.AudioLength = (uint)audioStream.Length;
            m_AudioStreams.Add(audioStream);
            m_MetadataStreams.Add(metadataStream);
            Files.Add(entry);
        }