Exemplo n.º 1
0
        public SF2(string engine = "", string bank = "", string rom = "", ushort rom_revision_major = 0, ushort rom_revision_minor = 0, string date = "", string designer = "", string products = "", string copyright = "", string comment = "", string tools = "")
        {
            SFVersionTag rom_revision = rom_revision_major == 0 && rom_revision_minor == 0 ? null : new SFVersionTag(rom_revision_major, rom_revision_minor);

            infoChunk  = new InfoListChunk(this, engine, bank, rom, rom_revision, date, designer, products, copyright, comment, tools);
            soundChunk = new SdtaListChunk(this);
            hydraChunk = new PdtaListChunk(this);
        }
Exemplo n.º 2
0
 /// <summary>For reading</summary>
 public SF2(string path)
 {
     using (var reader = new EndianBinaryReader(File.Open(path, FileMode.Open)))
     {
         string str = reader.ReadString(4, false);
         if (str != "RIFF")
         {
             throw new InvalidDataException("RIFF header was not found at the start of the file.");
         }
         _size = reader.ReadUInt32();
         str   = reader.ReadString(4, false);
         if (str != "sfbk")
         {
             throw new InvalidDataException("sfbk header was not found at the expected offset.");
         }
         InfoChunk  = new InfoListChunk(this, reader);
         SoundChunk = new SdtaListChunk(this, reader);
         HydraChunk = new PdtaListChunk(this, reader);
     }
 }
Exemplo n.º 3
0
        // For reading
        public SF2(string path)
        {
            using (var reader = new BinaryReader(File.Open(path, FileMode.Open), Encoding.ASCII))
            {
                char[] chars = reader.ReadChars(4);
                if (new string(chars) != "RIFF")
                {
                    throw new InvalidDataException("RIFF header was not found at the start of the file.");
                }

                size  = reader.ReadUInt32();
                chars = reader.ReadChars(4);
                if (new string(chars) != "sfbk")
                {
                    throw new InvalidDataException("sfbk header was not found at the expected offset.");
                }

                InfoChunk  = new InfoListChunk(this, reader);
                SoundChunk = new SdtaListChunk(this, reader);
                HydraChunk = new PdtaListChunk(this, reader);
            }
        }
Exemplo n.º 4
0
 /// <summary>For creating</summary>
 public SF2()
 {
     InfoChunk  = new InfoListChunk(this);
     SoundChunk = new SdtaListChunk(this);
     HydraChunk = new PdtaListChunk(this);
 }