protected override void SetChannel(Channel channel) { if (channel == null) { throw new ArgumentNullException("channel"); } ITuneRequest tuneRequest; int hr = tuningSpace.CreateTuneRequest(out tuneRequest); DsError.ThrowExceptionForHR(hr); IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)tuneRequest; IATSCLocator locator = (IATSCLocator) new ATSCLocator(); locator.put_CarrierFrequency(channel.CarrierFrequency); locator.put_PhysicalChannel(channel.PhysicalChannel); atscRequest.put_Locator(locator); atscRequest.put_Channel(channel.MajorChannel); atscRequest.put_MinorChannel(channel.MinorChannel); hr = tuner.put_TuneRequest(atscRequest); DsError.ThrowExceptionForHR(hr); ReleaseComObject(tuneRequest); }
protected virtual void SetCurrentChannel(Channel channel) { if (channel == null) { throw new ArgumentNullException("channel"); } if (this.State != GraphState.Running) { return; } ITuneRequest tuneRequest; int hr = tuningSpace.CreateTuneRequest(out tuneRequest); DsError.ThrowExceptionForHR(hr); IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)tuneRequest; IATSCLocator locator = (IATSCLocator) new ATSCLocator(); locator.put_CarrierFrequency(channel.CarrierFrequency); locator.put_PhysicalChannel(channel.PhysicalChannel); atscRequest.put_Locator(locator); atscRequest.put_Channel(channel.MajorChannel); atscRequest.put_MinorChannel(channel.MinorChannel); hr = tuner.put_TuneRequest(atscRequest); DsError.ThrowExceptionForHR(hr); ReleaseComObject(tuneRequest); channelSet = true; }