Example #1
0
        public static bool Start()
        {
            bool retval = false;
            int  rc;

            phase_buf_l = new float[2048];
            phase_buf_r = new float[2048];
            Console c = Console.getConsole();

            rc = NetworkIO.initRadio();

            if (rc != 0)
            {
                if (rc == -101) // firmware version error;
                {
                    string fw_err = NetworkIO.getFWVersionErrorMsg();
                    if (fw_err == null)
                    {
                        fw_err = "Bad Firmware levels";
                    }
                    MessageBox.Show(fw_err, "Firmware Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return(false);
                }
                else
                {
                    MessageBox.Show("Error starting SDR hardware, is it connected and powered?", "Network Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return(false);
                }
            }

            // add setup calls that are needed to change between P1 & P2 before startup
            if (NetworkIO.CurrentRadioProtocol == RadioProtocol.USB)
            {
                console.SampleRateTX = 48000; // set tx audio sampling rate
                WDSP.SetTXACFIRRun(cmaster.chid(cmaster.inid(1, 0), 0), false);
                puresignal.SetPSHWPeak(cmaster.chid(cmaster.inid(1, 0), 0), 0.4072);
                console.psform.PSdefpeak = "0.4072";
            }
            else
            {
                console.SampleRateTX = 192000;
                WDSP.SetTXACFIRRun(cmaster.chid(cmaster.inid(1, 0), 0), true);
                puresignal.SetPSHWPeak(cmaster.chid(cmaster.inid(1, 0), 0), 0.2899);
                console.psform.PSdefpeak = "0.2899";
            }

            c.SetupForm.InitAudioTab();
            c.SetupForm.ForceReset = true;
            cmaster.PSLoopback     = cmaster.PSLoopback;

            int result = NetworkIO.StartAudioNative();

            if (result == 0)
            {
                retval = true;
            }

            return(retval);
        }
Example #2
0
        public static void CMCreateCMaster()
        {
            // set radio structure
            int[] cmSPC = new int[1] {
                2
            };
            int[] cmInboundSize = new int[8] {
                240, 240, 240, 240, 240, 720, 240, 240
            };

            fixed(int *pcmSPC = cmSPC, pcmIbSize = cmInboundSize)
            cmaster.SetRadioStructure(8, cmRCVR, 1, cmSubRCVR, 1, pcmSPC, pcmIbSize, 1536000, 48000, 384000);

            // send function pointers
            cmaster.SendCallbacks();

            // set default rates
            int[] xcm_inrates = new int[8] {
                192000, 192000, 192000, 192000, 192000, 48000, 192000, 192000
            };
            int aud_outrate = 48000;

            int[] rcvr_ch_outrates = new int[5] {
                48000, 48000, 48000, 48000, 48000
            };
            int[] xmtr_ch_outrates = new int[1] {
                192000
            };

            fixed(int *p1 = xcm_inrates, p2 = rcvr_ch_outrates, p3 = xmtr_ch_outrates)
            cmaster.SetCMDefaultRates(p1, aud_outrate, p2, p3);

            // create receivers, transmitters, specials, and buffers
            cmaster.CreateRadio();

            // get transmitter idenifiers
            int txinid = cmaster.inid(1, 0);        // stream id
            int txch   = cmaster.chid(txinid, 0);   // wdsp channel

            // setup transmitter input sample rate here since it is fixed
            cmaster.SetXcmInrate(txinid, 48000);

            // setup CFIR to run; it will always be ON with new protocol firmware
            WDSP.SetTXACFIRRun(txch, true);

            // set PureSignal basic parameters
            // note:  if future models have different settings, these calls could be moved to
            //      CMLoadRouterAll() which is called each time the receiver model changes.
            SetPSRxIdx(0, 0);   // txid = 0, all current models use Stream0 for RX feedback
            SetPSTxIdx(0, 1);   // txid = 0, all current models use Stream1 for TX feedback
            puresignal.SetPSFeedbackRate(txch, 192000);
            puresignal.SetPSHWPeak(txch, 0.2899);

            // setup transmitter display
            WDSP.TXASetSipMode(txch, 1);            // 1=>call the appropriate 'analyzer'
            WDSP.TXASetSipDisplay(txch, txinid);    // disp = txinid = tx stream

            NetworkIO.CreateRNet();
            cmaster.create_rxa();

            // create_wb();
        }