public DlsRegion(ushort rangeKeyHigh, ushort rangeKeyLow, ushort rangeVelocityHigh, ushort rangeVelocityLow, bool selfNonExclusive, ushort keyGroup, DlsWaveSample?waveSample, DlsWaveLink waveLink, IReadOnlyList <DlsArticulator> articulatorList) { RangeKeyHigh = rangeKeyHigh; RangeKeyLow = rangeKeyLow; RangeVelocityHigh = rangeVelocityHigh; RangeVelocityLow = rangeVelocityLow; SelfNonExclusive = selfNonExclusive; KeyGroup = keyGroup; WaveSample = waveSample; WaveLink = waveLink; ArticulatorList = articulatorList; }
private static DlsRegion?ReadDlsRegion(RiffChunk rgnChunk) { var isHeaderSet = false; var rangeKeyLow = default(ushort); var rangeKeyHigh = default(ushort); var rangeVelocityLow = default(ushort); var rangeVelocityHigh = default(ushort); var selfNonExclusive = false; var keyGroup = default(ushort); var waveSample = default(DlsWaveSample?); var waveLink = default(DlsWaveLink); var articulatorList = (IReadOnlyList <DlsArticulator>) new DlsArticulator[0]; foreach (var rgnSubchunk in rgnChunk.ReadList()) { switch (rgnSubchunk.Name) { case "rgnh": isHeaderSet = true; rangeKeyLow = rgnSubchunk.ReadUInt16(); rangeKeyHigh = rgnSubchunk.ReadUInt16(); rangeVelocityLow = rgnSubchunk.ReadUInt16(); rangeVelocityHigh = rgnSubchunk.ReadUInt16(); selfNonExclusive = rgnSubchunk.ReadUInt16() == 1; keyGroup = rgnSubchunk.ReadUInt16(); break; case "wsmp": waveSample = ReadDlsWaveSample(rgnSubchunk); break; case "wlnk": waveLink = new DlsWaveLink( options: (DlsWaveLinkOptions)rgnSubchunk.ReadUInt16(), phaseGroup: rgnSubchunk.ReadUInt16(), channels: rgnSubchunk.ReadUInt32(), tableIndex: rgnSubchunk.ReadUInt32()); break; case "lart": articulatorList = ReadDlsArticulatorList(rgnSubchunk); break; } } if (!isHeaderSet) { return(null); } return(new DlsRegion(rangeKeyLow, rangeKeyHigh, rangeVelocityLow, rangeVelocityHigh, selfNonExclusive, keyGroup, waveSample, waveLink, articulatorList)); }