/// <summary> /// Initializes a new instance of the <see cref="Music"/> class /// from specified <see cref="Stream"/> containing sound data. /// </summary> /// <param name="stream">A <see cref="Stream"/> contains sound data to load.</param> public Music(Stream stream) : this() { _reader = Decoders.CreateReader(stream); if (_reader == null) { throw new NotSupportedException("The specified sound is not supported."); } _info = _reader.Open(stream); Initialize(_info.ChannelCount, _info.SampleRate); }
/// <summary> /// Initializes a new instance of the <see cref="SoundBuffer"/> class /// from specified <see cref="Stream"/> containing sound data. /// </summary> /// <param name="stream">A <see cref="Stream"/> contains sound data to load.</param> public SoundBuffer(Stream stream) : this() { var reader = Decoders.CreateReader(stream); if (reader == null) { throw new NotSupportedException("The specified sound is not supported."); } var info = reader.Open(stream); Initialize(reader, info); }