def commit_xlater(row): """ Update xlater on change """ rotate = -(float(model[row][1]) / samplerate) * 2 * math.pi cl.modify_xlater( model[row][0], rotate, getfir(samplerate, model[row][2], model[row][4], model[row][3], maxtaps))
def commit_xlater(row): """ Update xlater on change """ rotate = -(float(model[row][1]) / samplerate) * 2 * math.pi cl.modify_xlater(model[row][0], rotate, getfir(samplerate, model[row][2], model[row][4], model[row][3], maxtaps))
def on_demod(widget, event): """ The item in context menu was selected. Create new xlater. """ global myxln, wf_click_x, wf_click_y, samplerate, maxtaps for mode in modes: # find mode if widget == modes[mode].button: cl.acquire_xlaters() wid = pixel2xlater(wf_click_x) if wid is not None: # user clicked on a running xlater cl.enable_xlater(wid, conf.preferformat) decimation = cl.get_xlaters()[wid].decimation rate = int(round(float(samplerate) / decimation)) resample = (float(samplerate) / decimation) / modes[mode].rate if samplerate % rate != 0 and not modes[mode].resample: showerror( "SDR samplerate %i must be an integer multiple of module samplerate %i!" % (samplerate, modes[mode].rate) ) cl.release_xlaters() return True program = modes[mode].program.replace("_MODEPATH_", conf.modepath) if samplerate % rate != 0: print("decim %i, resample ratio = %f" % (decimation, resample)) program += " -r %f" % resample cl.subscribe_xlater(wid, program) else: # no xlater running here, we need to create one offset = pixel2freq(wf_click_x) startframe = -1 if event.get_state() & gtk.gdk.CONTROL_MASK: startframe = pixel2frame(wf_click_y) print("freq %i x %i y %i hist %i" % (offset, wf_click_x, wf_click_y, startframe)) decimation = int(round(float(samplerate) / modes[mode].rate)) resample = (float(samplerate) / decimation) / modes[mode].rate if samplerate % modes[mode].rate != 0 and not modes[mode].resample: showerror( "SDR samplerate %i must be an integer multiple of module samplerate %i!" % (samplerate, modes[mode].rate) ) cl.release_xlaters() return True rotate = -(offset / samplerate) * 2 * math.pi program = modes[mode].program.replace("_MODEPATH_", conf.modepath) if samplerate % modes[mode].rate != 0: program += " -r %f" % resample print("decim %i, resample ratio = %f" % (decimation, resample)) rid = cl.create_xlater( rotate, decimation, getfir(samplerate, modes[mode].filtertype, modes[mode].bw, modes[mode].transition, maxtaps), program, startframe, ) h = XlaterHelper() h.lowpass = modes[mode].bw h.transition = modes[mode].transition h.filtertype = modes[mode].filtertype XlaterHelpers[rid] = h cl.release_xlaters() return True
def on_demod(widget, event): """ The item in context menu was selected. Create new xlater. """ global myxln, wf_click_x, wf_click_y, samplerate, maxtaps for mode in modes: # find mode if widget == modes[mode].button: cl.acquire_xlaters() wid = pixel2xlater(wf_click_x) if wid is not None: # user clicked on a running xlater cl.enable_xlater(wid, conf.preferformat) decimation = cl.get_xlaters()[wid].decimation rate = int(round(float(samplerate) / decimation)) resample = (float(samplerate)/decimation) / modes[mode].rate if samplerate % rate != 0 and not modes[mode].resample: showerror("SDR samplerate %i must be an integer multiple of module samplerate %i!"%(samplerate, modes[mode].rate)) cl.release_xlaters() return True program = modes[mode].program.replace("_MODEPATH_", conf.modepath) if samplerate % rate != 0: print("decim %i, resample ratio = %f"%(decimation, resample)) program += " -r %f"%resample cl.subscribe_xlater(wid, program) else: # no xlater running here, we need to create one offset = pixel2freq(wf_click_x) startframe = -1 if event.get_state() & gtk.gdk.CONTROL_MASK: startframe = pixel2frame(wf_click_y) print("freq %i x %i y %i hist %i"%(offset, wf_click_x, wf_click_y, startframe)) decimation = int(round(float(samplerate) / modes[mode].rate)) resample = (float(samplerate)/decimation) / modes[mode].rate if samplerate % modes[mode].rate != 0 and not modes[mode].resample: showerror("SDR samplerate %i must be an integer multiple of module samplerate %i!"%(samplerate, modes[mode].rate)) cl.release_xlaters() return True rotate = -(offset/samplerate)*2*math.pi program = modes[mode].program.replace("_MODEPATH_", conf.modepath) if samplerate % modes[mode].rate != 0: program += " -r %f"%resample print("decim %i, resample ratio = %f"%(decimation, resample)) rid = cl.create_xlater(rotate, decimation, getfir(samplerate, modes[mode].filtertype, modes[mode].bw, modes[mode].transition, maxtaps), program, startframe) h = XlaterHelper() h.lowpass = modes[mode].bw h.transition = modes[mode].transition h.filtertype = modes[mode].filtertype XlaterHelpers[rid] = h cl.release_xlaters() return True