public void ForcePS() { EventArgs e = EventArgs.Empty; if (!autoON) { puresignal.SetPSControl(txachannel, 1, 0, 0, 0); } else { puresignal.SetPSControl(txachannel, 0, 0, 1, 0); } if (!ttgenON) WDSP.SetTXAPostGenRun(txachannel, 0); }
private void create_rxa() { // JanusAudio setup NetworkIO.SetDDCRate(fwid, 48000); // set receivers samplerate to 48K NetworkIO.EnableRx(fwid, 1); // enable the receiver // ChannelMaster setup cmaster.SetXcmInrate(stid, 48000); // tell ChannelMaster the sample rate is 48K cmaster.SetRunPanadapter(stid, true); // turn off the panadapter computation cmaster.SetAAudioMixState((void *)0, 0, chid, true); // add main-rcvr to mixer state cmaster.SetAAudioMixWhat((void *)0, 0, chid, true); // add main-rcvr to mixer what // WDSP setup WDSP.SetChannelState(chid + 0, 1, 0); // main rcvr ON WDSP.SetChannelState(chid + 1, 0, 0); // sub-rcvr OFF }
private void timer1_Tick(object sender, EventArgs e) { if (psform.DismissAmpv) { Common.SaveForm(this, "AmpView"); Application.ExitThread(); } disp_setup(); puresignal.GetPSDisp(WDSP.id(1, 0), hx.AddrOfPinnedObject(), hym.AddrOfPinnedObject(), hyc.AddrOfPinnedObject(), hys.AddrOfPinnedObject(), hcm.AddrOfPinnedObject(), hcc.AddrOfPinnedObject(), hcs.AddrOfPinnedObject()); lock (intslock) { disp_data(); } if (psform.DismissAmpv) { Common.SaveForm(this, "AmpView"); Application.ExitThread(); } }
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); }
// 'wrecord()' is called by ChannelMaster.dll unsafe public void wrecord(int state, int pos, double *data) { if (run && (condx == state)) // if run && (!MOX and calling with receive data, or, MOX and calling with transmit data) { if (System.Threading.Interlocked.Exchange(ref busy, 1) != 1) { fixed(float *pleft = &left[0], pright = &right[0], pltemp = <emp[0], prtemp = &rtemp[0]) { if (pos == 0) // calling from the "pre" location { if ((state == 0) && rxpre) // getting receive data and want receive data for 'pre' position { int rcvr_inrate = cmaster.GetInputRate(0, id); // could just read these from WaveThing.wave_file_writer[id] int rcvr_insize = cmaster.GetBuffSize(rcvr_inrate); deswizzle(rcvr_insize, data, pleft, pright); if (WaveThing.wave_file_writer[id].BaseRate != rcvr_inrate) { int outsamps; WDSP.xresampleFV(pleft, pltemp, rcvr_insize, &outsamps, WaveThing.wave_file_writer[id].RcvrResampL); WDSP.xresampleFV(pright, prtemp, rcvr_insize, &outsamps, WaveThing.wave_file_writer[id].RcvrResampR); WaveThing.wave_file_writer[id].AddWriteBuffer(pltemp, prtemp, outsamps); } else { WaveThing.wave_file_writer[id].AddWriteBuffer(pleft, pright, rcvr_insize); } } if ((state == 1) && txpre) // getting transmit data and want transmit data for 'pre' position { int xmtr_inrate = cmaster.GetInputRate(1, 0); int xmtr_insize = cmaster.GetBuffSize(xmtr_inrate); deswizzle(xmtr_insize, data, pleft, pright); if (WaveThing.wave_file_writer[id].BaseRate != xmtr_inrate) { int outsamps; WDSP.xresampleFV(pleft, pltemp, xmtr_insize, &outsamps, WaveThing.wave_file_writer[id].XmtrResampL); WDSP.xresampleFV(pright, prtemp, xmtr_insize, &outsamps, WaveThing.wave_file_writer[id].XmtrResampR); WaveThing.wave_file_writer[id].AddWriteBuffer(pltemp, prtemp, outsamps); } else { WaveThing.wave_file_writer[id].AddWriteBuffer(pleft, pright, xmtr_insize); } } } if (pos == 1) // calling from "post" location { if ((state == 0) && !rxpre) // getting receive data and want receive data for 'post' position { int rcvr_outrate = cmaster.GetChannelOutputRate(0, id); int rcvr_outsize = cmaster.GetBuffSize(rcvr_outrate); deswizzle(rcvr_outsize, data, pleft, pright); if (WaveThing.wave_file_writer[id].BaseRate != rcvr_outrate) { int outsamps; WDSP.xresampleFV(pleft, pltemp, rcvr_outsize, &outsamps, WaveThing.wave_file_writer[id].RcvrResampL); WDSP.xresampleFV(pright, prtemp, rcvr_outsize, &outsamps, WaveThing.wave_file_writer[id].RcvrResampR); WaveThing.wave_file_writer[id].AddWriteBuffer(pltemp, prtemp, outsamps); } else { WaveThing.wave_file_writer[id].AddWriteBuffer(pleft, pright, rcvr_outsize); } } if ((state == 1) && !txpre) // getting transmit data and want transmit data for 'post' position { int xmtr_outrate = cmaster.GetChannelOutputRate(1, 0); int xmtr_outsize = cmaster.GetBuffSize(xmtr_outrate); deswizzle(xmtr_outsize, data, pleft, pright); if (WaveThing.wave_file_writer[id].BaseRate != xmtr_outrate) { int outsamps; WDSP.xresampleFV(pleft, pltemp, xmtr_outsize, &outsamps, WaveThing.wave_file_writer[id].XmtrResampL); WDSP.xresampleFV(pright, prtemp, xmtr_outsize, &outsamps, WaveThing.wave_file_writer[id].XmtrResampR); WaveThing.wave_file_writer[id].AddWriteBuffer(pltemp, prtemp, outsamps); } else { WaveThing.wave_file_writer[id].AddWriteBuffer(pleft, pright, xmtr_outsize); } } } } System.Threading.Interlocked.Exchange(ref busy, 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(); }
private void udRXAVolume_ValueChanged(object sender, EventArgs e) { WDSP.SetRXAPanelGain1(chid, 0.01 * (double)udRXAVolume.Value); }
private void udRXAAGCGain_ValueChanged(object sender, EventArgs e) { WDSP.SetRXAAGCTop(chid, (double)udRXAAGCGain.Value); }