protected virtual void OnFreeDevice() { if (!BassWasapiDevice.IsInitialized) { return; } BassWasapiDevice.Free(); }
protected override void OnDisposing() { if (this.ChannelHandle != 0) { Logger.Write(this, LogLevel.Debug, "Freeing BASS stream: {0}", this.ChannelHandle); Bass.StreamFree(this.ChannelHandle); //Not checking result code as it contains an error if the application is shutting down. } this.Stop(); BassWasapiDevice.Free(); base.OnDisposing(); }
protected virtual void OnInitDevice() { if (BassWasapiDevice.IsInitialized) { return; } BassWasapiDevice.Init(this.WasapiDevice, this.Exclusive, this.EventDriven, this.Dither); if (this.Output.EnforceRate && !BassWasapiDevice.Info.SupportedRates.Contains(this.Output.Rate)) { var supportedRates = string.Join( ", ", BassWasapiDevice.Info.SupportedRates.Select( supportedRate => string.Format( "{0}@{1}", Enum.GetName(typeof(WasapiFormat), BassWasapiDevice.Info.SupportedFormats[supportedRate]), supportedRate ) ) ); Logger.Write(this, LogLevel.Error, "The output rate {0} is not supported by the device, supported rates are: {1}", this.Output.Rate, supportedRates); BassWasapiDevice.Free(); throw new NotImplementedException(string.Format("The output rate {0} is not supported by the device, supported rates are: {1}", this.Output.Rate, supportedRates)); } }