private void Load(Stream stream)
 {
     using (BinaryReader reader = new BinaryReader(stream))
     {
         string id = new string(IOHelper.Read8BitChars(reader, 4));
         int size = reader.ReadInt32();
         if (!id.ToLower().Equals("riff"))
             throw new Exception("Invalid soundfont. Could not find RIFF header.");
         id = new string(IOHelper.Read8BitChars(reader, 4));
         if (!id.ToLower().Equals("sfbk"))
             throw new Exception("Invalid soundfont. Riff type is invalid.");
         info = new SoundFontInfo(reader);
         data = new SoundFontSampleData(reader);
         presets = new SoundFontPresets(reader);
     }
 }
Ejemplo n.º 2
0
 private void Load(Stream stream)
 {
     using (BinaryReader reader = new BinaryReader(stream))
     {
         string id = new string(IOHelper.Read8BitChars(reader, 4));
         if (!id.ToLower().Equals("riff"))
         {
             throw new Exception("Invalid soundfont. Could not find RIFF header.");
         }
         id = new string(IOHelper.Read8BitChars(reader, 4));
         if (!id.ToLower().Equals("sfbk"))
         {
             throw new Exception("Invalid soundfont. Riff type is invalid.");
         }
         info    = new SoundFontInfo(reader);
         data    = new SoundFontSampleData(reader);
         presets = new SoundFontPresets(reader);
     }
 }