public Generator(Stream stream) { Gen = (GeneratorType)StreamHelperLe.ReadUInt16(stream); AmoutLo = (byte)stream.ReadByte(); AmoutHi = (byte)stream.ReadByte(); }
public Modulator(Stream stream) { ModSrc = new ModulatorType(stream); ModDest = (GeneratorType)StreamHelperLe.ReadUInt16(stream); ModAmount = StreamHelperLe.ReadInt16(stream); ModAmtSrc = new ModulatorType(stream); ModTrans = (TransformType)StreamHelperLe.ReadUInt16(stream); }
public void Read(Stream stream) { var masterChunk = new RiffChunk(stream); if (masterChunk.Id != "RIFF") { throw new FileFormatException("WaveFile.masterChunk.Id", masterChunk.Id, "RIFF"); } // masterChunk using (var masterStream = masterChunk.GetStream()) { var WaveId = StreamHelperLe.ReadString(masterStream, 4); if (WaveId != "WAVE") { throw new FileFormatException("WaveFile.WaveId", WaveId, "WAVE"); } // formatChunk var formatChunk = new RiffChunk(masterStream); if (formatChunk.Id != "fmt ") { throw new FileFormatException("WaveFile.formatChunk.Id", formatChunk.Id, "fmt "); } using (var formatStream = formatChunk.GetStream()) { FormatTag = StreamHelperLe.ReadUInt16(formatStream); Channels = StreamHelperLe.ReadUInt16(formatStream); SamplePerSec = StreamHelperLe.ReadUInt32(formatStream); AvgBytesPerSec = StreamHelperLe.ReadUInt32(formatStream); BlockAlign = StreamHelperLe.ReadUInt16(formatStream); BitsPerSample = StreamHelperLe.ReadUInt16(formatStream); } if (Format != WaveFileFormat.MicrosoftPcm) { throw new FileFormatException("WaveFile.Format", Format, WaveFileFormat.MicrosoftPcm); } // dataChunk while (masterStream.Position < masterStream.Length) { var chunk = new RiffChunk(masterStream); if (chunk.Id == "data") { Data = chunk.Data; using (var dataStream = chunk.GetStream()) { BuildSamples(dataStream); } break; } } if (Data == null) { throw new FileFormatException("WaveFile.WaveData", "null", "byte[]"); } } }
public PresetHeader(Stream stream) { PresetName = StreamHelperLe.ReadString(stream, 20); Preset = StreamHelperLe.ReadUInt16(stream); Bank = StreamHelperLe.ReadUInt16(stream); PresetBagIndex = StreamHelperLe.ReadUInt16(stream); Library = StreamHelperLe.ReadUInt32(stream); Genre = StreamHelperLe.ReadUInt32(stream); Morphology = StreamHelperLe.ReadUInt32(stream); }
public SampleHeader(Stream stream) { SampleName = StreamHelperLe.ReadString(stream, 20); Start = StreamHelperLe.ReadUInt32(stream); End = StreamHelperLe.ReadUInt32(stream); Startloop = StreamHelperLe.ReadUInt32(stream); Endloop = StreamHelperLe.ReadUInt32(stream); SampleRate = StreamHelperLe.ReadUInt32(stream); OriginalKey = (byte)stream.ReadByte(); Correction = (sbyte)stream.ReadByte(); SampleLink = StreamHelperLe.ReadUInt16(stream); SampleLinkType = (SampleLinkType)StreamHelperLe.ReadUInt16(stream); }
public ModulatorType(System.IO.Stream stream) { var data = StreamHelperLe.ReadUInt16(stream); Type = (SourceType)(data >> 10); Polarity = (SourcePolarityType)((data >> 9) & 0x01); Direction = (SourceDirectionType)((data >> 8) & 0x01); if (((data >> 7) & 0x01) == 0) { Source = (ControllerSourceType)(data & 0x3F); } else { Source = ControllerSourceType.MidiController; MidiSource = (MidiControllerType)(data & 0x3F); } }
public Bag(Stream stream) { GenNdx = StreamHelperLe.ReadUInt16(stream); ModNdx = StreamHelperLe.ReadUInt16(stream); }
public InstrumentHeader(Stream stream) { InstName = StreamHelperLe.ReadString(stream, 20); InstBagNdx = StreamHelperLe.ReadUInt16(stream); }