public TunerStack(Tuner masterTuner, DigitalTuner slaveTuner, long masterTunerFreqSteps) : this(masterTuner, (Tuner)slaveTuner, masterTunerFreqSteps) { /* this is a digital tuner, register for sampling rate change */ slaveTuner.SamplingRateChanged += new EventHandler(Tuner_SamplingRateChanged); }
public bool Init() { try { //ShowConsole(true); Tuner mainTuner = null; long stepSize = 0; bool success = false; BO35 bo35 = null; AR5000N ar5000 = null; MT2131 mt2131 = null; USBRX_R820 r820 = null; VUHF_RX vuhfrx = null; if (mainTuner == null && (TunerCombination == eCombinationType.BO35 || TunerCombination == eCombinationType.Automatic)) { /* try to open BO-35 */ bo35 = new BO35(true); try { success = bo35.OpenTuner(); } catch (Exception e) { } if (success) { stepSize = 0; mainTuner = bo35; } else if (TunerCombination == eCombinationType.BO35) { return(false); } } if (mainTuner == null && (TunerCombination == eCombinationType.AR5000 || TunerCombination == eCombinationType.Automatic)) { /* try to open BO-35 */ ar5000 = new AR5000N("AR5000"); try { success = ar5000.OpenTuner(); } catch (Exception e) { } if (success) { stepSize = 0; mainTuner = ar5000; } else if (TunerCombination == eCombinationType.AR5000) { return(false); } } lock (Lock) { DevNum = GetFreeDeviceNum(); if (USBRXDeviceNative.UsbInit(DevNum)) { if (!UseAtmelFIFO) { USBRXDeviceNative.UsbSetIODir(DevNum, FIFOResetPortPin, USBRXDeviceNative.PIN_DIR_OUT); } /* we will handle ext fifo flushing ourselves */ USBRXDeviceNative.SetFifoFlushing(false); /* set maximum I2C speed */ USBRXDeviceNative.UsbI2CSetSpeed(DevNum, 1); /* init low level interface to atmel */ AtmelProgrammer = new AtmelProgrammer(this); AtmelProgrammer.ResetAtmel(); Atmel = new Atmel(this); if (Atmel.Exists) { AD6636 = new AD6636(Atmel, Atmel.TCXOFreq); Tuner = AD6636; /* detect I2C tuners */ if (mainTuner == null && (TunerCombination == eCombinationType.MT2131 || TunerCombination == eCombinationType.Automatic)) { mt2131 = new MT2131(this); try { success = mt2131.OpenTuner(); } catch (Exception e) { } if (success) { stepSize = mt2131.IFStepSize; mainTuner = mt2131; } else if (TunerCombination == eCombinationType.MT2131) { ReleaseDeviceNum(DevNum); return(false); } } if (mainTuner == null && (TunerCombination == eCombinationType.R820 || TunerCombination == eCombinationType.Automatic)) { r820 = new USBRX_R820(this); try { success = r820.OpenTuner(); } catch (Exception e) { } if (success) { stepSize = r820.IFStepSize; mainTuner = r820; } else if (TunerCombination == eCombinationType.MT2131) { ReleaseDeviceNum(DevNum); return(false); } } if (mainTuner == null && (TunerCombination == eCombinationType.VUHF_RX || TunerCombination == eCombinationType.Automatic)) { vuhfrx = new VUHF_RX(this); try { success = vuhfrx.OpenTuner(); } catch (Exception e) { } if (success) { stepSize = vuhfrx.IFStepSize; mainTuner = vuhfrx; } else if (TunerCombination == eCombinationType.VUHF_RX) { ReleaseDeviceNum(DevNum); return(false); } } if (mainTuner != null) { Tuner = new TunerStack(mainTuner, Tuner, stepSize); } Tuner.OpenTuner(); } //SetAgc(eAgcType.Slow); CurrentMode = eTransferMode.Stopped; StartThreads(); SetAtt(0); return(true); } else { ReleaseDeviceNum(DevNum); } } } catch (DllNotFoundException e) { MessageBox.Show("Was not able to load the driver. The driver DLL was not found." + Environment.NewLine + Environment.NewLine + e.Message); } catch (Exception e) { MessageBox.Show("Was not able to load the driver:" + Environment.NewLine + Environment.NewLine + e.Message); } return(false); }