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); } }
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); } }
public SampleDataAsset(SampleHeader sample, SoundFontSampleData sampleData) { this.assetName = sample.Name; this.sampleRate = sample.SampleRate; this.rootKey = sample.RootKey; this.tune = sample.Tune; this.start = sample.Start; this.end = sample.End; this.loopStart = sample.StartLoop; this.loopEnd = sample.EndLoop; this.sampleData = PcmData.Create(sampleData.BitsPerSample, sampleData.SampleData, true); }