Ejemplo n.º 1
0
        public void Write(BinaryWriter bw)
        {
            var msSmp = new MemoryStream();
            var bwSmp = new BinaryWriter(msSmp);

            bwSmp.Write("LIST".ToCharArray());
            bwSmp.Write(0xFFFFFFFF);
            bwSmp.Write("wave".ToCharArray());

            bwSmp.Write("wsmp".ToCharArray());
            bwSmp.Write((uint)(Marshal.SizeOf <CK_WSMP>() + Sampler.LoopCount * Marshal.SizeOf <WaveLoop>()));
            Sampler.Write(bwSmp);
            foreach (var loop in Loops.Values)
            {
                loop.Write(bwSmp);
            }

            Format.Write(bwSmp);

            bwSmp.Write("data".ToCharArray());
            bwSmp.Write(Data.Length);
            bwSmp.Write(Data);

            Info.Write(bwSmp);

            bwSmp.Seek(4, SeekOrigin.Begin);
            bwSmp.Write((uint)msSmp.Length - 8);
            bw.Write(msSmp.ToArray());
        }
Ejemplo n.º 2
0
        public void Write(BinaryWriter bw)
        {
            var msRgn = new MemoryStream();
            var bwRgn = new BinaryWriter(msRgn);

            bwRgn.Write("LIST".ToCharArray());
            bwRgn.Write(0xFFFFFFFF);
            bwRgn.Write("rgn ".ToCharArray());

            Header.Write(bwRgn);

            bwRgn.Write("wsmp".ToCharArray());
            bwRgn.Write((uint)(Marshal.SizeOf <CK_WSMP>() + Sampler.LoopCount * Marshal.SizeOf <WaveLoop>()));
            Sampler.Write(bwRgn);
            for (var i = 0; i < Sampler.LoopCount && i < Loops.Count; ++i)
            {
                Loops[i].Write(bwRgn);
            }

            WaveLink.Write(bwRgn);
            Articulations.Write(bwRgn);

            bwRgn.Seek(4, SeekOrigin.Begin);
            bwRgn.Write((uint)msRgn.Length - 8);
            bw.Write(msRgn.ToArray());
        }