private void TestMinorChannel() { int hr = 0; int minor = 0; hr = atscChannelTR.put_MinorChannel(20); DsError.ThrowExceptionForHR(hr); hr = atscChannelTR.get_MinorChannel(out minor); DsError.ThrowExceptionForHR(hr); // I don't know why but this method always return -1 meaning according to the doc // "that the tuner should tune to the first valid minor channel it finds". // I suppose that it's a normal behaviour since a complete BDA graph is not built... // Debug.Assert(minor == 20, "IATSCChannelTuneRequest.get_MinorChannel / put_MinorChannel"); }
protected virtual Channel GetCurrentChannel() { if (!channelSet || (this.State != GraphState.Running)) { return(new Channel()); } // Debug.WriteLine("null -> get_TuneRequest"); ITuneRequest request; int hr = tuner.get_TuneRequest(out request); // Debug.WriteLine(hr.ToString("X8")); DsError.ThrowExceptionForHR(hr); // Debug.WriteLine("ITuneRequest -> IATSCChannelTuneRequest"); IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)request; ILocator locator; // Debug.WriteLine("null -> get_Locator"); hr = atscRequest.get_Locator(out locator); // Debug.WriteLine(hr.ToString("X8")); DsError.ThrowExceptionForHR(hr); // Debug.WriteLine("ILocator -> IATSCLocator"); IATSCLocator atscLocator = (IATSCLocator)locator; int freq, channel, major, minor; hr = atscLocator.get_CarrierFrequency(out freq); hr = atscLocator.get_PhysicalChannel(out channel); hr = atscRequest.get_Channel(out major); hr = atscRequest.get_MinorChannel(out minor); Channel known = KnownChannels.FindClosest(new Channel(-1, -1, major, minor)); if (known != null) { if ((known.MajorChannel == major) && (known.MinorChannel == minor)) { return(known); } } return(new Channel(freq, channel, major, minor)); }
protected override Channel GetChannel() { ITuneRequest request; int hr = tuner.get_TuneRequest(out request); DsError.ThrowExceptionForHR(hr); IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)request; ILocator locator; atscRequest.get_Locator(out locator); IATSCLocator atscLocator = (IATSCLocator)locator; int freq, channel, major, minor; hr = atscLocator.get_CarrierFrequency(out freq); hr = atscLocator.get_PhysicalChannel(out channel); hr = atscRequest.get_Channel(out major); hr = atscRequest.get_MinorChannel(out minor); return(new Channel(freq, channel, major, minor)); }