public override void Connect(IBassStreamComponent previous) { this.ConfigureWASAPI(previous); if (this.ShouldCreateMixer(previous)) { Logger.Write(this, LogLevel.Debug, "Creating BASS MIX stream with rate {0} and {1} channels.", this.Rate, this.Channels); this.ChannelHandle = BassMix.CreateMixerStream(this.Rate, this.Channels, this.Flags); if (this.ChannelHandle == 0) { BassUtils.Throw(); } Logger.Write(this, LogLevel.Debug, "Adding stream to the mixer: {0}", previous.ChannelHandle); BassUtils.OK(BassMix.MixerAddChannel(this.ChannelHandle, previous.ChannelHandle, BassFlags.Default | BassFlags.MixerBuffer)); BassUtils.OK(BassWasapiHandler.StreamSet(this.ChannelHandle)); this.MixerChannelHandles.Add(previous.ChannelHandle); } else { Logger.Write(this, LogLevel.Debug, "The stream properties match the device, playing directly."); BassUtils.OK(BassWasapiHandler.StreamSet(previous.ChannelHandle)); } }