summaryrefslogtreecommitdiff
path: root/gr-analog
diff options
context:
space:
mode:
Diffstat (limited to 'gr-analog')
-rw-r--r--gr-analog/CMakeLists.txt35
-rw-r--r--gr-analog/examples/CMakeLists.txt2
-rw-r--r--[-rwxr-xr-x]gr-analog/examples/fmtest.py37
-rw-r--r--gr-analog/examples/tags/CMakeLists.txt1
-rw-r--r--[-rwxr-xr-x]gr-analog/examples/tags/uhd_burst_detector.py41
-rw-r--r--gr-analog/grc/CMakeLists.txt5
-rw-r--r--gr-analog/grc/analog.tree.yml39
-rw-r--r--gr-analog/grc/analog_agc2_xx.block.yml53
-rw-r--r--gr-analog/grc/analog_agc2_xx.xml71
-rw-r--r--gr-analog/grc/analog_agc3_xx.block.yml57
-rw-r--r--gr-analog/grc/analog_agc3_xx.xml77
-rw-r--r--gr-analog/grc/analog_agc_xx.block.yml48
-rw-r--r--gr-analog/grc/analog_agc_xx.xml64
-rw-r--r--gr-analog/grc/analog_am_demod_cf.block.yml33
-rw-r--r--gr-analog/grc/analog_am_demod_cf.xml47
-rw-r--r--gr-analog/grc/analog_block_tree.xml81
-rw-r--r--gr-analog/grc/analog_const_source_x.block.yml28
-rw-r--r--gr-analog/grc/analog_const_source_x.xml52
-rw-r--r--gr-analog/grc/analog_cpfsk_bc.block.yml31
-rw-r--r--gr-analog/grc/analog_cpfsk_bc.xml38
-rw-r--r--gr-analog/grc/analog_ctcss_squelch_ff.block.yml45
-rw-r--r--gr-analog/grc/analog_ctcss_squelch_ff.xml80
-rw-r--r--gr-analog/grc/analog_dpll_bb.block.yml26
-rw-r--r--gr-analog/grc/analog_dpll_bb.xml31
-rw-r--r--gr-analog/grc/analog_fastnoise_source_x.block.yml45
-rw-r--r--gr-analog/grc/analog_fastnoise_source_x.xml86
-rw-r--r--gr-analog/grc/analog_feedforward_agc_cc.block.yml26
-rw-r--r--gr-analog/grc/analog_feedforward_agc_cc.xml32
-rw-r--r--gr-analog/grc/analog_fm_deemph.block.yml25
-rw-r--r--gr-analog/grc/analog_fm_deemph.xml31
-rw-r--r--gr-analog/grc/analog_fm_demod_cf.block.yml46
-rw-r--r--gr-analog/grc/analog_fm_demod_cf.xml68
-rw-r--r--gr-analog/grc/analog_fm_preemph.block.yml29
-rw-r--r--gr-analog/grc/analog_fm_preemph.xml37
-rw-r--r--gr-analog/grc/analog_fmdet_cf.block.yml31
-rw-r--r--gr-analog/grc/analog_fmdet_cf.xml45
-rw-r--r--gr-analog/grc/analog_frequency_modulator_fc.block.yml23
-rw-r--r--gr-analog/grc/analog_frequency_modulator_fc.xml26
-rw-r--r--gr-analog/grc/analog_nbfm_rx.block.yml38
-rw-r--r--gr-analog/grc/analog_nbfm_rx.xml56
-rw-r--r--gr-analog/grc/analog_nbfm_tx.block.yml42
-rw-r--r--gr-analog/grc/analog_nbfm_tx.xml64
-rw-r--r--gr-analog/grc/analog_noise_source_x.block.yml38
-rw-r--r--gr-analog/grc/analog_noise_source_x.xml77
-rw-r--r--gr-analog/grc/analog_phase_modulator_fc.block.yml23
-rw-r--r--gr-analog/grc/analog_phase_modulator_fc.xml26
-rw-r--r--gr-analog/grc/analog_pll_carriertracking_cc.block.yml31
-rw-r--r--gr-analog/grc/analog_pll_carriertracking_cc.xml38
-rw-r--r--gr-analog/grc/analog_pll_freqdet_cf.block.yml31
-rw-r--r--gr-analog/grc/analog_pll_freqdet_cf.xml38
-rw-r--r--gr-analog/grc/analog_pll_refout_cc.block.yml31
-rw-r--r--gr-analog/grc/analog_pll_refout_cc.xml38
-rw-r--r--gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml47
-rw-r--r--gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml68
-rw-r--r--gr-analog/grc/analog_pwr_squelch_xx.block.yml44
-rw-r--r--gr-analog/grc/analog_pwr_squelch_xx.xml67
-rw-r--r--gr-analog/grc/analog_quadrature_demod_cf.block.yml47
-rw-r--r--gr-analog/grc/analog_quadrature_demod_cf.xml55
-rw-r--r--gr-analog/grc/analog_rail_ff.block.yml27
-rw-r--r--gr-analog/grc/analog_rail_ff.xml54
-rw-r--r--gr-analog/grc/analog_random_source_x.block.yml47
-rw-r--r--gr-analog/grc/analog_random_source_x.xml75
-rw-r--r--gr-analog/grc/analog_random_uniform_source_x.block.yml32
-rw-r--r--gr-analog/grc/analog_random_uniform_source_x.xml55
-rw-r--r--gr-analog/grc/analog_sig_source_x.block.yml57
-rw-r--r--gr-analog/grc/analog_sig_source_x.xml109
-rw-r--r--gr-analog/grc/analog_simple_squelch_cc.block.yml27
-rw-r--r--gr-analog/grc/analog_simple_squelch_cc.xml32
-rw-r--r--gr-analog/grc/analog_standard_squelch.block.yml28
-rw-r--r--gr-analog/grc/analog_standard_squelch.xml32
-rw-r--r--gr-analog/grc/analog_wfm_rcv.block.yml25
-rw-r--r--gr-analog/grc/analog_wfm_rcv.xml33
-rw-r--r--gr-analog/grc/analog_wfm_rcv_pll.block.yml29
-rw-r--r--gr-analog/grc/analog_wfm_rcv_pll.xml37
-rw-r--r--gr-analog/grc/analog_wfm_tx.block.yml40
-rw-r--r--gr-analog/grc/analog_wfm_tx.xml55
-rw-r--r--gr-analog/include/gnuradio/analog/CMakeLists.txt19
-rw-r--r--gr-analog/include/gnuradio/analog/fastnoise_source.h (renamed from gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t)28
-rw-r--r--gr-analog/include/gnuradio/analog/noise_source.h (renamed from gr-analog/include/gnuradio/analog/noise_source_X.h.t)21
-rw-r--r--gr-analog/include/gnuradio/analog/random_uniform_source.h (renamed from gr-analog/include/gnuradio/analog/random_uniform_source_X.h.t)19
-rw-r--r--gr-analog/include/gnuradio/analog/sig_source.h (renamed from gr-analog/include/gnuradio/analog/sig_source_X.h.t)28
-rw-r--r--gr-analog/lib/CMakeLists.txt21
-rw-r--r--gr-analog/lib/cpfsk_bc_impl.cc15
-rw-r--r--gr-analog/lib/cpm.cc32
-rw-r--r--gr-analog/lib/fastnoise_source_X_impl.cc.t171
-rw-r--r--gr-analog/lib/fastnoise_source_impl.cc191
-rw-r--r--gr-analog/lib/fastnoise_source_impl.h (renamed from gr-analog/lib/fastnoise_source_X_impl.h.t)25
-rw-r--r--gr-analog/lib/feedforward_agc_cc_impl.cc6
-rw-r--r--gr-analog/lib/fmdet_cf_impl.cc2
-rw-r--r--gr-analog/lib/frequency_modulator_fc_impl.cc5
-rw-r--r--gr-analog/lib/noise_source_X_impl.cc.t139
-rw-r--r--gr-analog/lib/noise_source_impl.cc150
-rw-r--r--gr-analog/lib/noise_source_impl.h (renamed from gr-analog/lib/noise_source_X_impl.h.t)16
-rw-r--r--gr-analog/lib/pll_carriertracking_cc_impl.cc17
-rw-r--r--gr-analog/lib/pll_freqdet_cf_impl.cc17
-rw-r--r--gr-analog/lib/pll_refout_cc_impl.cc14
-rw-r--r--gr-analog/lib/random_uniform_source_X_impl.cc.t83
-rw-r--r--gr-analog/lib/random_uniform_source_impl.cc76
-rw-r--r--gr-analog/lib/random_uniform_source_impl.h (renamed from gr-analog/lib/random_uniform_source_X_impl.h.t)16
-rw-r--r--gr-analog/lib/sig_source_X_impl.cc.t286
-rw-r--r--gr-analog/lib/sig_source_impl.cc287
-rw-r--r--gr-analog/lib/sig_source_impl.h (renamed from gr-analog/lib/sig_source_X_impl.h.t)26
-rw-r--r--gr-analog/lib/squelch_base_cc_impl.cc7
-rw-r--r--gr-analog/lib/squelch_base_ff_impl.cc7
-rw-r--r--gr-analog/python/analog/CMakeLists.txt3
-rw-r--r--gr-analog/python/analog/__init__.py26
-rw-r--r--gr-analog/python/analog/am_demod.py27
-rw-r--r--gr-analog/python/analog/fm_demod.py13
-rw-r--r--gr-analog/python/analog/fm_emph.py73
-rw-r--r--gr-analog/python/analog/nbfm_rx.py30
-rw-r--r--gr-analog/python/analog/nbfm_tx.py34
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_agc.py47
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_cpfsk.py3
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_ctcss_squelch.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_dpll.py4
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_fmdet.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_frequency_modulator.py8
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_noise.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_phase_modulator.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pll_carriertracking.py4
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pll_freqdet.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pll_refout.py4
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_probe_avg_mag_sqrd.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pwr_squelch.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_quadrature_demod.py8
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_rail_ff.py3
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_random_uniform_source.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_sig_source.py2
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_simple_squelch.py4
-rw-r--r--gr-analog/python/analog/standard_squelch.py20
-rw-r--r--gr-analog/python/analog/wfm_rcv.py25
-rw-r--r--gr-analog/python/analog/wfm_rcv_fmdet.py55
-rw-r--r--gr-analog/python/analog/wfm_rcv_pll.py47
-rw-r--r--gr-analog/python/analog/wfm_tx.py26
-rw-r--r--gr-analog/swig/CMakeLists.txt3
-rw-r--r--gr-analog/swig/analog_swig.i68
136 files changed, 2475 insertions, 3079 deletions
diff --git a/gr-analog/CMakeLists.txt b/gr-analog/CMakeLists.txt
index 3d7aeab4e5..d874ae3cf6 100644
--- a/gr-analog/CMakeLists.txt
+++ b/gr-analog/CMakeLists.txt
@@ -52,40 +52,6 @@ SET(GR_PKG_ANALOG_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/analog)
if(ENABLE_GR_ANALOG)
########################################################################
-# Setup CPack components
-########################################################################
-include(GrPackage)
-CPACK_SET(CPACK_COMPONENT_GROUP_ANALOG_DESCRIPTION "GNU Radio Analog Blocks")
-
-CPACK_COMPONENT("analog_runtime"
- GROUP "Analog"
- DISPLAY_NAME "Runtime"
- DESCRIPTION "Dynamic link libraries"
- DEPENDS "runtime_runtime"
-)
-
-CPACK_COMPONENT("analog_devel"
- GROUP "Analog"
- DISPLAY_NAME "Development"
- DESCRIPTION "C++ headers, package config, import libraries"
- DEPENDS "runtime_devel"
-)
-
-CPACK_COMPONENT("analog_python"
- GROUP "Analog"
- DISPLAY_NAME "Python"
- DESCRIPTION "Python modules for runtime"
- DEPENDS "runtime_python;analog_runtime"
-)
-
-CPACK_COMPONENT("analog_swig"
- GROUP "Analog"
- DISPLAY_NAME "SWIG"
- DESCRIPTION "SWIG development .i files"
- DEPENDS "runtime_swig;analog_python;analog_devel"
-)
-
-########################################################################
# Add subdirectories
########################################################################
add_subdirectory(include/gnuradio/analog)
@@ -110,7 +76,6 @@ configure_file(
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-analog.pc
DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
- COMPONENT "analog_devel"
)
endif(ENABLE_GR_ANALOG)
diff --git a/gr-analog/examples/CMakeLists.txt b/gr-analog/examples/CMakeLists.txt
index acb0656b7f..fb23bdf4a0 100644
--- a/gr-analog/examples/CMakeLists.txt
+++ b/gr-analog/examples/CMakeLists.txt
@@ -23,12 +23,10 @@ include(GrPython)
GR_PYTHON_INSTALL(PROGRAMS
fmtest.py
DESTINATION ${GR_PKG_ANALOG_EXAMPLES_DIR}
- COMPONENT "analog_python"
)
install(
FILES
noise_power.grc
DESTINATION ${GR_PKG_ANALOG_EXAMPLES_DIR}
- COMPONENT "analog_python"
)
diff --git a/gr-analog/examples/fmtest.py b/gr-analog/examples/fmtest.py
index 7ed08cafbe..04218a4472 100755..100644
--- a/gr-analog/examples/fmtest.py
+++ b/gr-analog/examples/fmtest.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -31,13 +34,13 @@ try:
import scipy
from scipy import fftpack
except ImportError:
- print "Error: Program requires scipy (see: www.scipy.org)."
+ print("Error: Program requires scipy (see: www.scipy.org).")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ print("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).")
sys.exit(1)
@@ -80,7 +83,7 @@ class fmtest(gr.top_block):
# Create a signal source and frequency modulate it
self.sum = blocks.add_cc()
- for n in xrange(self._N):
+ for n in range(self._N):
sig = analog.sig_source_f(self._audio_rate, analog.GR_SIN_WAVE, freq[n], 0.5)
fm = fmtx(f_lo[n], self._audio_rate, self._if_rate)
self.connect(sig, fm)
@@ -95,17 +98,17 @@ class fmtest(gr.top_block):
# Design the channlizer
self._M = 10
- bw = chspacing/2.0
- t_bw = chspacing/10.0
+ bw = chspacing / 2.0
+ t_bw = chspacing / 10.0
self._chan_rate = self._if_rate / self._M
self._taps = filter.firdes.low_pass_2(1, self._if_rate, bw, t_bw,
attenuation_dB=100,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
- tpc = math.ceil(float(len(self._taps)) / float(self._M))
+ tpc = math.ceil(float(len(self._taps)) / float(self._M))
- print "Number of taps: ", len(self._taps)
- print "Number of channels: ", self._M
- print "Taps per channel: ", tpc
+ print("Number of taps: ", len(self._taps))
+ print("Number of channels: ", self._M)
+ print("Taps per channel: ", tpc)
self.pfb = filter.pfb.channelizer_ccf(self._M, self._taps)
@@ -115,7 +118,7 @@ class fmtest(gr.top_block):
self.fmdet = list()
self.squelch = list()
self.snks = list()
- for i in xrange(self._M):
+ for i in range(self._M):
self.fmdet.append(analog.nbfm_rx(self._audio_rate, self._chan_rate))
self.squelch.append(analog.standard_squelch(self._audio_rate*10))
self.snks.append(blocks.vector_sink_f())
@@ -152,11 +155,11 @@ def main():
d = fm.snk_tx.data()[Ns:Ns+Ne]
sp1_f = fig1.add_subplot(2, 1, 1)
- X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
visible=False)
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ f_in = scipy.arange(-fs / 2.0, fs / 2.0, fs / float(X_in.size))
p1_f = sp1_f.plot(f_in, X_in, "b")
sp1_f.set_xlim([min(f_in), max(f_in)+1])
sp1_f.set_ylim([-120.0, 20.0])
@@ -165,7 +168,7 @@ def main():
sp1_f.set_xlabel("Frequency (Hz)")
sp1_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs
+ Ts = 1.0 / fs
Tmax = len(d)*Ts
t_in = scipy.arange(0, Tmax, Ts)
@@ -184,20 +187,20 @@ def main():
# Plot each of the channels outputs. Frequencies on Figure 2 and
# time signals on Figure 3
fs_o = fm._audio_rate
- for i in xrange(len(fm.snks)):
+ for i in range(len(fm.snks)):
# remove issues with the transients at the beginning
# also remove some corruption at the end of the stream
# this is a bug, probably due to the corner cases
d = fm.snks[i].data()[Ns:Ne]
sp2_f = fig2.add_subplot(Nrows, Ncols, 1+i)
- X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs_o,
window = lambda d: d*winfunc(fftlen),
visible=False)
#X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
X_o = 10.0*scipy.log10(abs(X))
#f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
- f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size))
+ f_o = scipy.arange(0, fs_o / 2.0, fs_o/2.0/float(X_o.size))
p2_f = sp2_f.plot(f_o, X_o, "b")
sp2_f.set_xlim([min(f_o), max(f_o)+0.1])
sp2_f.set_ylim([-120.0, 20.0])
@@ -208,7 +211,7 @@ def main():
sp2_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs_o
+ Ts = 1.0 / fs_o
Tmax = len(d)*Ts
t_o = scipy.arange(0, Tmax, Ts)
diff --git a/gr-analog/examples/tags/CMakeLists.txt b/gr-analog/examples/tags/CMakeLists.txt
index ba95100665..9e51cee16a 100644
--- a/gr-analog/examples/tags/CMakeLists.txt
+++ b/gr-analog/examples/tags/CMakeLists.txt
@@ -22,5 +22,4 @@ include(GrPython)
GR_PYTHON_INSTALL(PROGRAMS
uhd_burst_detector.py
DESTINATION ${GR_PKG_DATA_DIR}/examples/tags
- COMPONENT "runtime_python"
)
diff --git a/gr-analog/examples/tags/uhd_burst_detector.py b/gr-analog/examples/tags/uhd_burst_detector.py
index b1bb15b974..d3d221a45c 100755..100644
--- a/gr-analog/examples/tags/uhd_burst_detector.py
+++ b/gr-analog/examples/tags/uhd_burst_detector.py
@@ -20,14 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import filter, analog, blocks
from gnuradio import uhd
from gnuradio.fft import window
-from gnuradio.eng_option import eng_option
+from gnuradio.eng_arg import eng_float
from gnuradio.filter import firdes
-from optparse import OptionParser
+from argparse import ArgumentParser
class uhd_burst_detector(gr.top_block):
def __init__(self, uhd_address, options):
@@ -94,24 +95,24 @@ class uhd_burst_detector(gr.top_block):
self.uhd_src_0.set_samp_rate(self.samp_rate)
if __name__ == '__main__':
- parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
- parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2",
- help="select address of the device [default=%default]")
- #parser.add_option("-A", "--antenna", default=None,
+ parser = ArgumentParser()
+ parser.add_argument("-a", "--address", default="addr=192.168.10.2",
+ help="select address of the device [default=%(default)r]")
+ #parser.add_argument("-A", "--antenna", default=None,
# help="select Rx Antenna (only on RFX-series boards)")
- parser.add_option("-f", "--freq", type="eng_float", default=450e6,
+ parser.add_argument("-f", "--freq", type=eng_float, default=450e6,
help="set frequency to FREQ", metavar="FREQ")
- parser.add_option("-g", "--gain", type="eng_float", default=0,
- help="set gain in dB [default=%default]")
- parser.add_option("-R", "--samp-rate", type="eng_float", default=200000,
- help="set USRP sample rate [default=%default]")
- parser.add_option("-t", "--threshold", type="float", default=-60,
- help="Set the detection power threshold (dBm) [default=%default")
- parser.add_option("-T", "--trigger", action="store_true", default=False,
- help="Use internal trigger instead of detector [default=%default]")
- (options, args) = parser.parse_args()
-
- uhd_addr = options.address
-
- tb = uhd_burst_detector(uhd_addr, options)
+ parser.add_argument("-g", "--gain", type=eng_float, default=0,
+ help="set gain in dB [default=%(default)r]")
+ parser.add_argument("-R", "--samp-rate", type=eng_float, default=200000,
+ help="set USRP sample rate [default=%(default)r]")
+ parser.add_argument("-t", "--threshold", type=float, default=-60,
+ help="Set the detection power threshold (dBm) [default=%(default)r")
+ parser.add_argument("-T", "--trigger", action="store_true", default=False,
+ help="Use internal trigger instead of detector [default=%(default)r]")
+ args = parser.parse_args()
+
+ uhd_addr = args.address
+
+ tb = uhd_burst_detector(uhd_addr, args)
tb.run()
diff --git a/gr-analog/grc/CMakeLists.txt b/gr-analog/grc/CMakeLists.txt
index a699d7c2fa..35456cee31 100644
--- a/gr-analog/grc/CMakeLists.txt
+++ b/gr-analog/grc/CMakeLists.txt
@@ -17,6 +17,5 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-file(GLOB xml_files "*.xml")
-install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "analog_python")
-
+file(GLOB yml_files "*.yml")
+install(FILES ${yml_files} DESTINATION ${GRC_BLOCKS_DIR})
diff --git a/gr-analog/grc/analog.tree.yml b/gr-analog/grc/analog.tree.yml
new file mode 100644
index 0000000000..44a88bd5c5
--- /dev/null
+++ b/gr-analog/grc/analog.tree.yml
@@ -0,0 +1,39 @@
+'[Core]':
+- Level Controllers:
+ - analog_agc_xx
+ - analog_agc2_xx
+ - analog_agc3_xx
+ - analog_feedforward_agc_cc
+ - analog_ctcss_squelch_ff
+ - analog_pwr_squelch_xx
+ - analog_simple_squelch_cc
+ - analog_standard_squelch
+ - analog_rail_ff
+- Modulators:
+ - analog_frequency_modulator_fc
+ - analog_phase_modulator_fc
+ - analog_quadrature_demod_cf
+ - analog_nbfm_tx
+ - analog_nbfm_rx
+ - analog_wfm_tx
+ - analog_wfm_rcv
+ - analog_wfm_rcv_pll
+ - analog_am_demod_cf
+ - analog_fm_demod_cf
+ - analog_fm_deemph
+ - analog_fm_preemph
+- Waveform Generators:
+ - analog_sig_source_x
+ - analog_const_source_x
+ - analog_noise_source_x
+ - analog_fastnoise_source_x
+ - analog_random_source_x
+ - analog_random_uniform_source_x
+- Synchronizers:
+ - analog_pll_carriertracking_cc
+ - analog_pll_freqdet_cf
+ - analog_pll_refout_cc
+- Peak Detectors:
+ - analog_dpll_bb
+- Measurement Tools:
+ - analog_probe_avg_mag_sqrd_x
diff --git a/gr-analog/grc/analog_agc2_xx.block.yml b/gr-analog/grc/analog_agc2_xx.block.yml
new file mode 100644
index 0000000000..93990b5c3b
--- /dev/null
+++ b/gr-analog/grc/analog_agc2_xx.block.yml
@@ -0,0 +1,53 @@
+id: analog_agc2_xx
+label: AGC2
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: attack_rate
+ label: Attack Rate
+ dtype: real
+ default: 1e-1
+- id: decay_rate
+ label: Decay Rate
+ dtype: real
+ default: 1e-2
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: max_gain
+ label: Max Gain
+ dtype: real
+ default: '65536'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.agc2_${type.fcn}(${attack_rate}, ${decay_rate}, ${reference}, ${gain})
+ self.${id}.set_max_gain(${max_gain})
+ callbacks:
+ - set_attack_rate(${attack_rate})
+ - set_decay_rate(${decay_rate})
+ - set_reference(${reference})
+ - set_gain(${gain})
+ - set_max_gain(${max_gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_agc2_xx.xml b/gr-analog/grc/analog_agc2_xx.xml
deleted file mode 100644
index cafd6a09b5..0000000000
--- a/gr-analog/grc/analog_agc2_xx.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AGC2
-###################################################
- -->
-<block>
- <name>AGC2</name>
- <key>analog_agc2_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain)
-self.$(id).set_max_gain($max_gain)</make>
- <callback>set_attack_rate($attack_rate)</callback>
- <callback>set_decay_rate($decay_rate)</callback>
- <callback>set_reference($reference)</callback>
- <callback>set_gain($gain)</callback>
- <callback>set_max_gain($max_gain)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Attack Rate</name>
- <key>attack_rate</key>
- <value>1e-1</value>
- <type>real</type>
- </param>
- <param>
- <name>Decay Rate</name>
- <key>decay_rate</key>
- <value>1e-2</value>
- <type>real</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Gain</name>
- <key>max_gain</key>
- <value>65536</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_agc3_xx.block.yml b/gr-analog/grc/analog_agc3_xx.block.yml
new file mode 100644
index 0000000000..17a03f6771
--- /dev/null
+++ b/gr-analog/grc/analog_agc3_xx.block.yml
@@ -0,0 +1,57 @@
+id: analog_agc3_xx
+label: AGC3
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex]
+ option_attributes:
+ fcn: [cc]
+ hide: part
+- id: attack_rate
+ label: Attack Rate
+ dtype: real
+ default: 1e-3
+- id: decay_rate
+ label: Decay Rate
+ dtype: real
+ default: 1e-4
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: max_gain
+ label: Max Gain
+ dtype: real
+ default: '65536'
+- id: iir_update_decim
+ label: IIR Update Decimation
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.agc3_${type.fcn}(${attack_rate}, ${decay_rate}, ${reference}, ${gain}, ${iir_update_decim})
+ self.${id}.set_max_gain(${max_gain})
+ callbacks:
+ - set_attack_rate(${attack_rate})
+ - set_decay_rate(${decay_rate})
+ - set_reference(${reference})
+ - set_gain(${gain})
+ - set_max_gain(${max_gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_agc3_xx.xml b/gr-analog/grc/analog_agc3_xx.xml
deleted file mode 100644
index 1e6b9fd382..0000000000
--- a/gr-analog/grc/analog_agc3_xx.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AGC3
-###################################################
- -->
-<block>
- <name>AGC3</name>
- <key>analog_agc3_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.agc3_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $iir_update_decim)
-self.$(id).set_max_gain($max_gain)</make>
- <callback>set_attack_rate($attack_rate)</callback>
- <callback>set_decay_rate($decay_rate)</callback>
- <callback>set_reference($reference)</callback>
- <callback>set_gain($gain)</callback>
- <callback>set_max_gain($max_gain)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
-<!-- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option> -->
- </param>
- <param>
- <name>Attack Rate</name>
- <key>attack_rate</key>
- <value>1e-3</value>
- <type>real</type>
- </param>
- <param>
- <name>Decay Rate</name>
- <key>decay_rate</key>
- <value>1e-4</value>
- <type>real</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Gain</name>
- <key>max_gain</key>
- <value>65536</value>
- <type>real</type>
- </param>
- <param>
- <name>IIR Update Decimation</name>
- <key>iir_update_decim</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_agc_xx.block.yml b/gr-analog/grc/analog_agc_xx.block.yml
new file mode 100644
index 0000000000..52ef26f79f
--- /dev/null
+++ b/gr-analog/grc/analog_agc_xx.block.yml
@@ -0,0 +1,48 @@
+id: analog_agc_xx
+label: AGC
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: rate
+ label: Rate
+ dtype: real
+ default: 1e-4
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: max_gain
+ label: Max Gain
+ dtype: real
+ default: '65536'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.agc_${type.fcn}(${rate}, ${reference}, ${gain})
+ self.${id}.set_max_gain(${max_gain})
+ callbacks:
+ - set_rate(${rate})
+ - set_reference(${reference})
+ - set_gain(${gain})
+ - set_max_gain(${max_gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_agc_xx.xml b/gr-analog/grc/analog_agc_xx.xml
deleted file mode 100644
index 085ded3d8c..0000000000
--- a/gr-analog/grc/analog_agc_xx.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AGC
-###################################################
- -->
-<block>
- <name>AGC</name>
- <key>analog_agc_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.agc_$(type.fcn)($rate, $reference, $gain)
-self.$(id).set_max_gain($max_gain)</make>
- <callback>set_rate($rate)</callback>
- <callback>set_reference($reference)</callback>
- <callback>set_gain($gain)</callback>
- <callback>set_max_gain($max_gain)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Rate</name>
- <key>rate</key>
- <value>1e-4</value>
- <type>real</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Gain</name>
- <key>max_gain</key>
- <value>65536</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_am_demod_cf.block.yml b/gr-analog/grc/analog_am_demod_cf.block.yml
new file mode 100644
index 0000000000..8bc6cc1c31
--- /dev/null
+++ b/gr-analog/grc/analog_am_demod_cf.block.yml
@@ -0,0 +1,33 @@
+id: analog_am_demod_cf
+label: AM Demod
+
+parameters:
+- id: chan_rate
+ label: Channel Rate
+ dtype: real
+- id: audio_decim
+ label: Audio Decimation
+ dtype: int
+- id: audio_pass
+ label: Audio Pass
+ dtype: real
+ default: '5000'
+- id: audio_stop
+ label: Audio Stop
+ dtype: real
+ default: '5500'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.am_demod_cf(\n\tchannel_rate=${chan_rate},\n\taudio_decim=${audio_decim},\n\
+ \taudio_pass=${audio_pass},\n\taudio_stop=${audio_stop},\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_am_demod_cf.xml b/gr-analog/grc/analog_am_demod_cf.xml
deleted file mode 100644
index b066882bda..0000000000
--- a/gr-analog/grc/analog_am_demod_cf.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AM Demod
-###################################################
- -->
-<block>
- <name>AM Demod</name>
- <key>analog_am_demod_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.am_demod_cf(
- channel_rate=$chan_rate,
- audio_decim=$audio_decim,
- audio_pass=$audio_pass,
- audio_stop=$audio_stop,
-)</make>
- <param>
- <name>Channel Rate</name>
- <key>chan_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decim</key>
- <type>int</type>
- </param>
- <param>
- <name>Audio Pass</name>
- <key>audio_pass</key>
- <value>5000</value>
- <type>real</type>
- </param>
- <param>
- <name>Audio Stop</name>
- <key>audio_stop</key>
- <value>5500</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_block_tree.xml b/gr-analog/grc/analog_block_tree.xml
deleted file mode 100644
index 7337c34c3e..0000000000
--- a/gr-analog/grc/analog_block_tree.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- GNU Radio is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR Analog blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Level Controllers</name>
- <block>analog_agc_xx</block>
- <block>analog_agc2_xx</block>
- <block>analog_agc3_xx</block>
- <block>analog_feedforward_agc_cc</block>
- <block>analog_ctcss_squelch_ff</block>
- <block>analog_pwr_squelch_xx</block>
- <block>analog_simple_squelch_cc</block>
- <block>analog_standard_squelch</block>
- <block>analog_rail_ff</block>
- </cat>
- <cat>
- <name>Modulators</name>
- <block>analog_frequency_modulator_fc</block>
- <block>analog_phase_modulator_fc</block>
- <block>analog_quadrature_demod_cf</block>
- <block>analog_nbfm_tx</block>
- <block>analog_nbfm_rx</block>
- <block>analog_wfm_tx</block>
- <block>analog_wfm_rcv</block>
- <block>analog_wfm_rcv_pll</block>
- <block>analog_am_demod_cf</block>
- <block>analog_fm_demod_cf</block>
- <block>analog_fm_deemph</block>
- <block>analog_fm_preemph</block>
- </cat>
- <cat>
- <name>Waveform Generators</name>
- <block>analog_sig_source_x</block>
- <block>analog_const_source_x</block>
- <block>analog_noise_source_x</block>
- <block>analog_fastnoise_source_x</block>
- <block>analog_random_source_x</block>
- <block>analog_random_uniform_source_x</block>
- </cat>
- <cat>
- <name>Synchronizers</name>
- <block>analog_pll_carriertracking_cc</block>
- <block>analog_pll_freqdet_cf</block>
- <block>analog_pll_refout_cc</block>
- </cat>
- <cat>
- <name>Peak Detectors</name>
- <block>analog_dpll_bb</block>
- </cat>
- <cat>
- <name>Measurement Tools</name>
- <block>analog_probe_avg_mag_sqrd_x</block>
- </cat>
-</cat>
diff --git a/gr-analog/grc/analog_const_source_x.block.yml b/gr-analog/grc/analog_const_source_x.block.yml
new file mode 100644
index 0000000000..ac676b7ac4
--- /dev/null
+++ b/gr-analog/grc/analog_const_source_x.block.yml
@@ -0,0 +1,28 @@
+id: analog_const_source_x
+label: Constant Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ const_type: [complex, real, int, int]
+ fcn: [c, f, i, s]
+ hide: part
+- id: const
+ label: Constant
+ dtype: ${ type.const_type }
+ default: '0'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.sig_source_${type.fcn}(0, analog.GR_CONST_WAVE, 0, 0, ${const})
+ callbacks:
+ - set_offset(${const})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_const_source_x.xml b/gr-analog/grc/analog_const_source_x.xml
deleted file mode 100644
index de8c306264..0000000000
--- a/gr-analog/grc/analog_const_source_x.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Constant Source: Custom wrapper
-###################################################
- -->
-<block>
- <name>Constant Source</name>
- <key>analog_const_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.sig_source_$(type.fcn)(0, analog.GR_CONST_WAVE, 0, 0, $const)</make>
- <callback>set_offset($const)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- <opt>const_type:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- <opt>const_type:real</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>const_type:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>const_type:int</opt>
- </option>
- </param>
- <param>
- <name>Constant</name>
- <key>const</key>
- <value>0</value>
- <type>$type.const_type</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_cpfsk_bc.block.yml b/gr-analog/grc/analog_cpfsk_bc.block.yml
new file mode 100644
index 0000000000..c9ccbaac27
--- /dev/null
+++ b/gr-analog/grc/analog_cpfsk_bc.block.yml
@@ -0,0 +1,31 @@
+id: analog_cpfsk_bc
+label: CPFSK
+category: '[Core]/Deprecated'
+
+parameters:
+- id: k
+ label: K
+ dtype: real
+- id: amplitude
+ label: Amplitude
+ dtype: real
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.cpfsk_bc(${k}, ${amplitude}, ${samples_per_symbol})
+ callbacks:
+ - set_amplitude(${amplitude})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_cpfsk_bc.xml b/gr-analog/grc/analog_cpfsk_bc.xml
deleted file mode 100644
index 5108ff61f9..0000000000
--- a/gr-analog/grc/analog_cpfsk_bc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##CPFSK
-###################################################
- -->
-<block>
- <name>CPFSK</name>
- <key>analog_cpfsk_bc</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import analog</import>
- <make>analog.cpfsk_bc($k, $amplitude, $samples_per_symbol)</make>
- <callback>set_amplitude($amplitude)</callback>
- <param>
- <name>K</name>
- <key>k</key>
- <type>real</type>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amplitude</key>
- <type>real</type>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_ctcss_squelch_ff.block.yml b/gr-analog/grc/analog_ctcss_squelch_ff.block.yml
new file mode 100644
index 0000000000..a3dd89f1f6
--- /dev/null
+++ b/gr-analog/grc/analog_ctcss_squelch_ff.block.yml
@@ -0,0 +1,45 @@
+id: analog_ctcss_squelch_ff
+label: CTCSS Squelch
+
+parameters:
+- id: rate
+ label: Sampling Rate (Hz)
+ dtype: real
+ default: samp_rate
+- id: freq
+ label: Tone Frequency
+ dtype: real
+ default: '100.0'
+- id: level
+ label: Level
+ dtype: real
+ default: '0.01'
+- id: len
+ label: Length
+ dtype: int
+ default: '0'
+- id: ramp
+ label: Ramp
+ dtype: int
+ default: '0'
+- id: gate
+ label: Gate
+ dtype: bool
+ default: 'False'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.ctcss_squelch_ff(${rate}, ${freq}, ${level}, ${len}, ${ramp}, ${gate})
+ callbacks:
+ - set_level(${level})
+ - set_frequency(${freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_ctcss_squelch_ff.xml b/gr-analog/grc/analog_ctcss_squelch_ff.xml
deleted file mode 100644
index 7a2248aa7e..0000000000
--- a/gr-analog/grc/analog_ctcss_squelch_ff.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0"?>
-<!--
-#
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##CTCSS Squelch
-###################################################
- -->
-<block>
- <name>CTCSS Squelch</name>
- <key>analog_ctcss_squelch_ff</key>
- <import>from gnuradio import analog</import>
- <make>analog.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp, $gate)</make>
- <callback>set_level($level)</callback>
- <callback>set_frequency($freq)</callback>
- <param>
- <name>Sampling Rate (Hz)</name>
- <key>rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Tone Frequency</name>
- <key>freq</key>
- <value>100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Level</name>
- <key>level</key>
- <value>0.01</value>
- <type>real</type>
- </param>
- <param>
- <name>Length</name>
- <key>len</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Ramp</name>
- <key>ramp</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Gate</name>
- <key>gate</key>
- <value>False</value>
- <type>bool</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_dpll_bb.block.yml b/gr-analog/grc/analog_dpll_bb.block.yml
new file mode 100644
index 0000000000..289f3a283d
--- /dev/null
+++ b/gr-analog/grc/analog_dpll_bb.block.yml
@@ -0,0 +1,26 @@
+id: analog_dpll_bb
+label: Detect Peak
+
+parameters:
+- id: period
+ label: Period
+ dtype: real
+- id: gain
+ label: Gain
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.dpll_bb(${period}, ${gain})
+ callbacks:
+ - set_gain(${gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_dpll_bb.xml b/gr-analog/grc/analog_dpll_bb.xml
deleted file mode 100644
index 65a489414d..0000000000
--- a/gr-analog/grc/analog_dpll_bb.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Detect Peak
-###################################################
- -->
-<block>
- <name>Detect Peak</name>
- <key>analog_dpll_bb</key>
- <import>from gnuradio import analog</import>
- <make>analog.dpll_bb($period, $gain)</make>
- <callback>set_gain($gain)</callback>
- <param>
- <name>Period</name>
- <key>period</key>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fastnoise_source_x.block.yml b/gr-analog/grc/analog_fastnoise_source_x.block.yml
new file mode 100644
index 0000000000..21c4366074
--- /dev/null
+++ b/gr-analog/grc/analog_fastnoise_source_x.block.yml
@@ -0,0 +1,45 @@
+id: analog_fastnoise_source_x
+label: Fast Noise Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [c, f, i, s]
+ hide: part
+- id: noise_type
+ label: Noise Type
+ dtype: int
+ default: analog.GR_GAUSSIAN
+ options: [analog.GR_UNIFORM, analog.GR_GAUSSIAN, analog.GR_LAPLACIAN, analog.GR_IMPULSE]
+ option_labels: [Uniform, Gaussian, Laplacian, Impulse]
+- id: amp
+ label: Amplitude
+ dtype: real
+ default: '1'
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+- id: samples
+ label: Variate Pool Size
+ dtype: int
+ default: '8192'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.fastnoise_source_${type.fcn}(${noise_type}, ${amp}, ${seed}, ${samples})
+ callbacks:
+ - set_type(${noise_type})
+ - set_amplitude(${amp})
+
+documentation: |-
+ The fast noise source works by pre-generating a pool of random variates taken from the specified distribution. At runtime, samples are then uniform randomly chosen from this pool which is a very fast operation.
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fastnoise_source_x.xml b/gr-analog/grc/analog_fastnoise_source_x.xml
deleted file mode 100644
index f18c8c2f54..0000000000
--- a/gr-analog/grc/analog_fastnoise_source_x.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Fast Noise Source
-###################################################
- -->
-<block>
- <name>Fast Noise Source</name>
- <key>analog_fastnoise_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.fastnoise_source_$(type.fcn)($noise_type, $amp, $seed, $samples)</make>
- <callback>set_type($noise_type)</callback>
- <callback>set_amplitude($amp)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- </param>
- <param>
- <name>Noise Type</name>
- <key>noise_type</key>
- <value>analog.GR_GAUSSIAN</value>
- <type>int</type>
- <option>
- <name>Uniform</name>
- <key>analog.GR_UNIFORM</key>
- </option>
- <option>
- <name>Gaussian</name>
- <key>analog.GR_GAUSSIAN</key>
- </option>
- <option>
- <name>Laplacian</name>
- <key>analog.GR_LAPLACIAN</key>
- </option>
- <option>
- <name>Impulse</name>
- <key>analog.GR_IMPULSE</key>
- </option>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amp</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Variate Pool Size</name>
- <key>samples</key>
- <value>8192</value>
- <type>int</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
- <doc>
-The fast noise source works by pre-generating a pool of random variates taken from the specified distribution. At runtime, samples are then uniform randomly chosen from this pool which is a very fast operation.
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_feedforward_agc_cc.block.yml b/gr-analog/grc/analog_feedforward_agc_cc.block.yml
new file mode 100644
index 0000000000..fd49a654a8
--- /dev/null
+++ b/gr-analog/grc/analog_feedforward_agc_cc.block.yml
@@ -0,0 +1,26 @@
+id: analog_feedforward_agc_cc
+label: Feed Forward AGC
+
+parameters:
+- id: num_samples
+ label: Num Samples
+ dtype: int
+ default: '1024'
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.feedforward_agc_cc(${num_samples}, ${reference})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_feedforward_agc_cc.xml b/gr-analog/grc/analog_feedforward_agc_cc.xml
deleted file mode 100644
index 66d200a847..0000000000
--- a/gr-analog/grc/analog_feedforward_agc_cc.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Feed Forward AGC
-###################################################
- -->
-<block>
- <name>Feed Forward AGC</name>
- <key>analog_feedforward_agc_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.feedforward_agc_cc($num_samples, $reference)</make>
- <param>
- <name>Num Samples</name>
- <key>num_samples</key>
- <value>1024</value>
- <type>int</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fm_deemph.block.yml b/gr-analog/grc/analog_fm_deemph.block.yml
new file mode 100644
index 0000000000..b9c11a6842
--- /dev/null
+++ b/gr-analog/grc/analog_fm_deemph.block.yml
@@ -0,0 +1,25 @@
+id: analog_fm_deemph
+label: FM Deemphasis
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.fm_deemph(fs=${samp_rate}, tau=${tau})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fm_deemph.xml b/gr-analog/grc/analog_fm_deemph.xml
deleted file mode 100644
index 0fcb5a87d4..0000000000
--- a/gr-analog/grc/analog_fm_deemph.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Deemphasis
-###################################################
- -->
-<block>
- <name>FM Deemphasis</name>
- <key>analog_fm_deemph</key>
- <import>from gnuradio import analog</import>
- <make>analog.fm_deemph(fs=$samp_rate, tau=$tau)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fm_demod_cf.block.yml b/gr-analog/grc/analog_fm_demod_cf.block.yml
new file mode 100644
index 0000000000..a558253a2c
--- /dev/null
+++ b/gr-analog/grc/analog_fm_demod_cf.block.yml
@@ -0,0 +1,46 @@
+id: analog_fm_demod_cf
+label: FM Demod
+
+parameters:
+- id: chan_rate
+ label: Channel Rate
+ dtype: real
+- id: audio_decim
+ label: Audio Decimation
+ dtype: int
+- id: deviation
+ label: Deviation
+ dtype: real
+ default: '75000'
+- id: audio_pass
+ label: Audio Pass
+ dtype: real
+ default: '15000'
+- id: audio_stop
+ label: Audio Stop
+ dtype: real
+ default: '16000'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.fm_demod_cf(\n\tchannel_rate=${chan_rate},\n\taudio_decim=${audio_decim},\n\
+ \tdeviation=${deviation},\n\taudio_pass=${audio_pass},\n\taudio_stop=${audio_stop},\n\
+ \tgain=${gain},\n\ttau=${tau},\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fm_demod_cf.xml b/gr-analog/grc/analog_fm_demod_cf.xml
deleted file mode 100644
index c903ddfc73..0000000000
--- a/gr-analog/grc/analog_fm_demod_cf.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Demod
-###################################################
- -->
-<block>
- <name>FM Demod</name>
- <key>analog_fm_demod_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.fm_demod_cf(
- channel_rate=$chan_rate,
- audio_decim=$audio_decim,
- deviation=$deviation,
- audio_pass=$audio_pass,
- audio_stop=$audio_stop,
- gain=$gain,
- tau=$tau,
-)</make>
- <param>
- <name>Channel Rate</name>
- <key>chan_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decim</key>
- <type>int</type>
- </param>
- <param>
- <name>Deviation</name>
- <key>deviation</key>
- <value>75000</value>
- <type>real</type>
- </param>
- <param>
- <name>Audio Pass</name>
- <key>audio_pass</key>
- <value>15000</value>
- <type>real</type>
- </param>
- <param>
- <name>Audio Stop</name>
- <key>audio_stop</key>
- <value>16000</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fm_preemph.block.yml b/gr-analog/grc/analog_fm_preemph.block.yml
new file mode 100644
index 0000000000..d3f05d3164
--- /dev/null
+++ b/gr-analog/grc/analog_fm_preemph.block.yml
@@ -0,0 +1,29 @@
+id: analog_fm_preemph
+label: FM Preemphasis
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: fh
+ label: High Corner Freq
+ dtype: real
+ default: '-1.0'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.fm_preemph(fs=${samp_rate}, tau=${tau}, fh=${fh})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fm_preemph.xml b/gr-analog/grc/analog_fm_preemph.xml
deleted file mode 100644
index a754ce9c6f..0000000000
--- a/gr-analog/grc/analog_fm_preemph.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Preemphasis
-###################################################
- -->
-<block>
- <name>FM Preemphasis</name>
- <key>analog_fm_preemph</key>
- <import>from gnuradio import analog</import>
- <make>analog.fm_preemph(fs=$samp_rate, tau=$tau, fh=$fh)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <param>
- <name>High Corner Freq</name>
- <key>fh</key>
- <value>-1.0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fmdet_cf.block.yml b/gr-analog/grc/analog_fmdet_cf.block.yml
new file mode 100644
index 0000000000..ee8661b80f
--- /dev/null
+++ b/gr-analog/grc/analog_fmdet_cf.block.yml
@@ -0,0 +1,31 @@
+id: analog_fmdet_cf
+label: FM Detector
+
+parameters:
+- id: samplerate
+ label: Sample rate
+ dtype: real
+- id: freq_low
+ label: Lowest frequency
+ dtype: real
+- id: freq_high
+ label: Highest frequency
+ dtype: real
+- id: scl
+ label: Scale factor
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.fmdet_cf(\n\tsamplerate=${samplerate},\n\tfreq_low=${freq_low},\n\
+ \tfreq_high=${freq_high},\n\tscl=${scl}\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fmdet_cf.xml b/gr-analog/grc/analog_fmdet_cf.xml
deleted file mode 100644
index 26688b2893..0000000000
--- a/gr-analog/grc/analog_fmdet_cf.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Detector
-###################################################
- -->
-<block>
- <name>FM Detector</name>
- <key>analog_fmdet_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.fmdet_cf(
- samplerate=$samplerate,
- freq_low=$freq_low,
- freq_high=$freq_high,
- scl=$scl
-)</make>
- <param>
- <name>Sample rate</name>
- <key>samplerate</key>
- <type>real</type>
- </param>
- <param>
- <name>Lowest frequency</name>
- <key>freq_low</key>
- <type>real</type>
- </param>
- <param>
- <name>Highest frequency</name>
- <key>freq_high</key>
- <type>real</type>
- </param>
- <param>
- <name>Scale factor</name>
- <key>scl</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_frequency_modulator_fc.block.yml b/gr-analog/grc/analog_frequency_modulator_fc.block.yml
new file mode 100644
index 0000000000..09f3e807f3
--- /dev/null
+++ b/gr-analog/grc/analog_frequency_modulator_fc.block.yml
@@ -0,0 +1,23 @@
+id: analog_frequency_modulator_fc
+label: Frequency Mod
+
+parameters:
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.frequency_modulator_fc(${sensitivity})
+ callbacks:
+ - set_sensitivity(${sensitivity})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_frequency_modulator_fc.xml b/gr-analog/grc/analog_frequency_modulator_fc.xml
deleted file mode 100644
index 3b6cd159a1..0000000000
--- a/gr-analog/grc/analog_frequency_modulator_fc.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Frequency Modulator
-###################################################
- -->
-<block>
- <name>Frequency Mod</name>
- <key>analog_frequency_modulator_fc</key>
- <import>from gnuradio import analog</import>
- <make>analog.frequency_modulator_fc($sensitivity)</make>
- <callback>set_sensitivity($sensitivity)</callback>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_nbfm_rx.block.yml b/gr-analog/grc/analog_nbfm_rx.block.yml
new file mode 100644
index 0000000000..8bb3da7684
--- /dev/null
+++ b/gr-analog/grc/analog_nbfm_rx.block.yml
@@ -0,0 +1,38 @@
+id: analog_nbfm_rx
+label: NBFM Receive
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: int
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: int
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: max_dev
+ label: Max Deviation
+ dtype: real
+ default: 5e3
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+asserts:
+- ${ (quad_rate)%(audio_rate) == 0 }
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.nbfm_rx(\n\taudio_rate=${audio_rate},\n\tquad_rate=${quad_rate},\n\
+ \ttau=${tau},\n\tmax_dev=${max_dev},\n )"
+ callbacks:
+ - set_max_deviation(${max_dev})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_nbfm_rx.xml b/gr-analog/grc/analog_nbfm_rx.xml
deleted file mode 100644
index 9250b77b5e..0000000000
--- a/gr-analog/grc/analog_nbfm_rx.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##NBFM Receive
-###################################################
- -->
-<block>
- <name>NBFM Receive</name>
- <key>analog_nbfm_rx</key>
- <import>from gnuradio import analog</import>
- <make>analog.nbfm_rx(
- audio_rate=$audio_rate,
- quad_rate=$quad_rate,
- tau=$tau,
- max_dev=$max_dev,
- )</make>
- <callback>set_max_deviation($max_dev)</callback>
-
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>5e3</value>
- <type>real</type>
- </param>
-
- <check>($quad_rate)%($audio_rate) == 0</check>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_nbfm_tx.block.yml b/gr-analog/grc/analog_nbfm_tx.block.yml
new file mode 100644
index 0000000000..00f63f8d64
--- /dev/null
+++ b/gr-analog/grc/analog_nbfm_tx.block.yml
@@ -0,0 +1,42 @@
+id: analog_nbfm_tx
+label: NBFM Transmit
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: int
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: int
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: max_dev
+ label: Max Deviation
+ dtype: real
+ default: 5e3
+- id: fh
+ label: Preemphasis High Corner Freq
+ dtype: real
+ default: '-1.0'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+asserts:
+- ${ (quad_rate)%(audio_rate) == 0 }
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.nbfm_tx(\n\taudio_rate=${audio_rate},\n\tquad_rate=${quad_rate},\n\
+ \ttau=${tau},\n\tmax_dev=${max_dev},\n\tfh=${fh},\n )"
+ callbacks:
+ - set_max_deviation(${max_dev})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_nbfm_tx.xml b/gr-analog/grc/analog_nbfm_tx.xml
deleted file mode 100644
index bc80fffbcb..0000000000
--- a/gr-analog/grc/analog_nbfm_tx.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##NBFM Transmit
-###################################################
- -->
-<block>
- <name>NBFM Transmit</name>
- <key>analog_nbfm_tx</key>
- <import>from gnuradio import analog</import>
- <make>analog.nbfm_tx(
- audio_rate=$audio_rate,
- quad_rate=$quad_rate,
- tau=$tau,
- max_dev=$max_dev,
- fh=$fh,
- )</make>
- <callback>set_max_deviation($max_dev)</callback>
-
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>5e3</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Preemphasis High Corner Freq</name>
- <key>fh</key>
- <value>-1.0</value>
- <type>real</type>
- </param>
-
- <check>($quad_rate)%($audio_rate) == 0</check>
-
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_noise_source_x.block.yml b/gr-analog/grc/analog_noise_source_x.block.yml
new file mode 100644
index 0000000000..bb3f67209e
--- /dev/null
+++ b/gr-analog/grc/analog_noise_source_x.block.yml
@@ -0,0 +1,38 @@
+id: analog_noise_source_x
+label: Noise Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [c, f, i, s]
+ hide: part
+- id: noise_type
+ label: Noise Type
+ dtype: int
+ default: analog.GR_GAUSSIAN
+ options: [analog.GR_UNIFORM, analog.GR_GAUSSIAN, analog.GR_LAPLACIAN, analog.GR_IMPULSE]
+ option_labels: [Uniform, Gaussian, Laplacian, Impulse]
+- id: amp
+ label: Amplitude
+ dtype: real
+ default: '1'
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.noise_source_${type.fcn}(${noise_type}, ${amp}, ${seed})
+ callbacks:
+ - set_type(${noise_type})
+ - set_amplitude(${amp})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_noise_source_x.xml b/gr-analog/grc/analog_noise_source_x.xml
deleted file mode 100644
index 5404e78960..0000000000
--- a/gr-analog/grc/analog_noise_source_x.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Noise Source
-###################################################
- -->
-<block>
- <name>Noise Source</name>
- <key>analog_noise_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.noise_source_$(type.fcn)($noise_type, $amp, $seed)</make>
- <callback>set_type($noise_type)</callback>
- <callback>set_amplitude($amp)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- </param>
- <param>
- <name>Noise Type</name>
- <key>noise_type</key>
- <value>analog.GR_GAUSSIAN</value>
- <type>int</type>
- <option>
- <name>Uniform</name>
- <key>analog.GR_UNIFORM</key>
- </option>
- <option>
- <name>Gaussian</name>
- <key>analog.GR_GAUSSIAN</key>
- </option>
- <option>
- <name>Laplacian</name>
- <key>analog.GR_LAPLACIAN</key>
- </option>
- <option>
- <name>Impulse</name>
- <key>analog.GR_IMPULSE</key>
- </option>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amp</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_phase_modulator_fc.block.yml b/gr-analog/grc/analog_phase_modulator_fc.block.yml
new file mode 100644
index 0000000000..6d38ddd010
--- /dev/null
+++ b/gr-analog/grc/analog_phase_modulator_fc.block.yml
@@ -0,0 +1,23 @@
+id: analog_phase_modulator_fc
+label: Phase Mod
+
+parameters:
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.phase_modulator_fc(${sensitivity})
+ callbacks:
+ - set_sensitivity(${sensitivity})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_phase_modulator_fc.xml b/gr-analog/grc/analog_phase_modulator_fc.xml
deleted file mode 100644
index c13af769c9..0000000000
--- a/gr-analog/grc/analog_phase_modulator_fc.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Phase Modulator
-###################################################
- -->
-<block>
- <name>Phase Mod</name>
- <key>analog_phase_modulator_fc</key>
- <import>from gnuradio import analog</import>
- <make>analog.phase_modulator_fc($sensitivity)</make>
- <callback>set_sensitivity($sensitivity)</callback>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_pll_carriertracking_cc.block.yml b/gr-analog/grc/analog_pll_carriertracking_cc.block.yml
new file mode 100644
index 0000000000..1a66aca0a7
--- /dev/null
+++ b/gr-analog/grc/analog_pll_carriertracking_cc.block.yml
@@ -0,0 +1,31 @@
+id: analog_pll_carriertracking_cc
+label: PLL Carrier Tracking
+
+parameters:
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+- id: max_freq
+ label: Max Freq
+ dtype: real
+- id: min_freq
+ label: Min Freq
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pll_carriertracking_cc(${w}, ${max_freq}, ${min_freq})
+ callbacks:
+ - set_loop_bandwidth(${w})
+ - set_max_freq(${max_freq})
+ - set_min_freq(${min_freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pll_carriertracking_cc.xml b/gr-analog/grc/analog_pll_carriertracking_cc.xml
deleted file mode 100644
index 95ec4b415b..0000000000
--- a/gr-analog/grc/analog_pll_carriertracking_cc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##PLL Carrier Tracking
-###################################################
- -->
-<block>
- <name>PLL Carrier Tracking</name>
- <key>analog_pll_carriertracking_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.pll_carriertracking_cc($w, $max_freq, $min_freq)</make>
- <callback>set_loop_bandwidth($w)</callback>
- <callback>set_max_freq($max_freq)</callback>
- <callback>set_min_freq($min_freq)</callback>
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
- <param>
- <name>Max Freq</name>
- <key>max_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Min Freq</name>
- <key>min_freq</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_pll_freqdet_cf.block.yml b/gr-analog/grc/analog_pll_freqdet_cf.block.yml
new file mode 100644
index 0000000000..b9fe199dd2
--- /dev/null
+++ b/gr-analog/grc/analog_pll_freqdet_cf.block.yml
@@ -0,0 +1,31 @@
+id: analog_pll_freqdet_cf
+label: PLL Freq Det
+
+parameters:
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+- id: max_freq
+ label: Max Freq
+ dtype: real
+- id: min_freq
+ label: Min Freq
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pll_freqdet_cf(${w}, ${max_freq}, ${min_freq})
+ callbacks:
+ - set_loop_bandwidth(${w})
+ - set_max_freq(${max_freq})
+ - set_min_freq(${min_freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pll_freqdet_cf.xml b/gr-analog/grc/analog_pll_freqdet_cf.xml
deleted file mode 100644
index 0d44c160bd..0000000000
--- a/gr-analog/grc/analog_pll_freqdet_cf.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##PLL Frequency Det
-###################################################
- -->
-<block>
- <name>PLL Freq Det</name>
- <key>analog_pll_freqdet_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.pll_freqdet_cf($w, $max_freq, $min_freq)</make>
- <callback>set_loop_bandwidth($w)</callback>
- <callback>set_max_freq($max_freq)</callback>
- <callback>set_min_freq($min_freq)</callback>
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
- <param>
- <name>Max Freq</name>
- <key>max_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Min Freq</name>
- <key>min_freq</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_pll_refout_cc.block.yml b/gr-analog/grc/analog_pll_refout_cc.block.yml
new file mode 100644
index 0000000000..5acd85c3b6
--- /dev/null
+++ b/gr-analog/grc/analog_pll_refout_cc.block.yml
@@ -0,0 +1,31 @@
+id: analog_pll_refout_cc
+label: PLL Ref Out
+
+parameters:
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+- id: max_freq
+ label: Max Freq
+ dtype: real
+- id: min_freq
+ label: Min Freq
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pll_refout_cc(${w}, ${max_freq}, ${min_freq})
+ callbacks:
+ - set_loop_bandwidth(${w})
+ - set_max_freq(${max_freq})
+ - set_min_freq(${min_freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pll_refout_cc.xml b/gr-analog/grc/analog_pll_refout_cc.xml
deleted file mode 100644
index eb2d752b27..0000000000
--- a/gr-analog/grc/analog_pll_refout_cc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##PLL Reference Out
-###################################################
- -->
-<block>
- <name>PLL Ref Out</name>
- <key>analog_pll_refout_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.pll_refout_cc($w, $max_freq, $min_freq)</make>
- <callback>set_loop_bandwidth($w)</callback>
- <callback>set_max_freq($max_freq)</callback>
- <callback>set_min_freq($min_freq)</callback>
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
- <param>
- <name>Max Freq</name>
- <key>max_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Min Freq</name>
- <key>min_freq</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml
new file mode 100644
index 0000000000..ad128c1521
--- /dev/null
+++ b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml
@@ -0,0 +1,47 @@
+id: analog_probe_avg_mag_sqrd_x
+label: Probe Avg Mag^2
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [c, f, cf]
+ option_labels: [Complex, Float, Complex->Float]
+ option_attributes:
+ hide: [all, all, '']
+ input: [complex, float, complex]
+ optional: ['1', '1', '0']
+ hide: part
+- id: threshold
+ label: Threshold (dB)
+ dtype: real
+ default: '0'
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: float
+ optional: true
+ hide: ${ type.hide }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.probe_avg_mag_sqrd_${type}(${threshold}, ${alpha})
+ callbacks:
+ - set_alpha(${alpha})
+ - set_threshold(${threshold})
+ - reset()
+
+documentation: |-
+ Available functions to probe: level()
+
+ Use with the function probe block.
+
+file_format: 1
diff --git a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml
deleted file mode 100644
index 98e6702ffd..0000000000
--- a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Probe Average Magnitude Squared
-###################################################
- -->
-<block>
- <name>Probe Avg Mag^2</name>
- <key>analog_probe_avg_mag_sqrd_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.probe_avg_mag_sqrd_$(type)($threshold, $alpha)</make>
- <callback>set_alpha($alpha)</callback>
- <callback>set_threshold($threshold)</callback>
- <callback>reset()</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>c</key>
- <opt>input:complex</opt>
- <opt>optional:1</opt>
- <opt>hide:all</opt>
- </option>
- <option>
- <name>Float</name>
- <key>f</key>
- <opt>input:float</opt>
- <opt>optional:1</opt>
- <opt>hide:all</opt>
- </option>
- <option>
- <name>Complex->Float</name>
- <key>cf</key>
- <opt>input:complex</opt>
- <opt>optional:0</opt>
- <opt>hide:</opt>
- </option>
- </param>
- <param>
- <name>Threshold (dB)</name>
- <key>threshold</key>
- <value>0</value>
- <type>real</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <optional>$type.optional</optional>
- <hide>$type.hide</hide>
- </source>
- <doc>
-Available functions to probe: level()
-
-Use with the function probe block.
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_pwr_squelch_xx.block.yml b/gr-analog/grc/analog_pwr_squelch_xx.block.yml
new file mode 100644
index 0000000000..20bcfa923e
--- /dev/null
+++ b/gr-analog/grc/analog_pwr_squelch_xx.block.yml
@@ -0,0 +1,44 @@
+id: analog_pwr_squelch_xx
+label: Power Squelch
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: threshold
+ label: Threshold (dB)
+ dtype: real
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: 1e-4
+- id: ramp
+ label: Ramp
+ dtype: int
+ default: '0'
+- id: gate
+ label: Gate
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pwr_squelch_${type.fcn}(${threshold}, ${alpha}, ${ramp}, ${gate})
+ callbacks:
+ - set_threshold(${threshold})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pwr_squelch_xx.xml b/gr-analog/grc/analog_pwr_squelch_xx.xml
deleted file mode 100644
index a75f85cf10..0000000000
--- a/gr-analog/grc/analog_pwr_squelch_xx.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Power Squelch
-###################################################
- -->
-<block>
- <name>Power Squelch</name>
- <key>analog_pwr_squelch_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.pwr_squelch_$(type.fcn)($threshold, $alpha, $ramp, $gate)</make>
- <callback>set_threshold($threshold)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Threshold (dB)</name>
- <key>threshold</key>
- <type>real</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>1e-4</value>
- <type>real</type>
- </param>
- <param>
- <name>Ramp</name>
- <key>ramp</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Gate</name>
- <key>gate</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_quadrature_demod_cf.block.yml b/gr-analog/grc/analog_quadrature_demod_cf.block.yml
new file mode 100644
index 0000000000..874b286c87
--- /dev/null
+++ b/gr-analog/grc/analog_quadrature_demod_cf.block.yml
@@ -0,0 +1,47 @@
+id: analog_quadrature_demod_cf
+label: Quadrature Demod
+
+parameters:
+- id: gain
+ label: Gain
+ dtype: real
+ default: samp_rate/(2*math.pi*fsk_deviation_hz/8.0)
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: |-
+ from gnuradio import analog
+ import math
+ make: analog.quadrature_demod_cf(${gain})
+ callbacks:
+ - set_gain(${gain})
+
+documentation: |-
+ This can be used to demod FM, FSK, GMSK, etc. The input is complex
+ baseband, output is the signal frequency in relation to the sample
+ rated, multiplied with the gain.
+
+ Mathematically, this block calculates the product of the one-sample
+ delayed input and the conjugate undelayed signal, and then calculates
+ the argument of the resulting complex number:
+
+ y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right).
+
+ Let x be a complex sinusoid with amplitude A>0, (absolute)
+ frequency f\in\mathbb R and phase \phi_0\in[0;2\pi] sampled at
+ f_s>0 so, without loss of generality,
+
+ x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f
+
+ then
+
+ y[n] = \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\ = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( \frac f{f_s} (n-1) + \phi_0)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) - \phi_0\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} (n-1)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} \left(n-(n-1)\right)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} = \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\= \frac f{f_s}\\
+
+file_format: 1
diff --git a/gr-analog/grc/analog_quadrature_demod_cf.xml b/gr-analog/grc/analog_quadrature_demod_cf.xml
deleted file mode 100644
index 447acf2ed8..0000000000
--- a/gr-analog/grc/analog_quadrature_demod_cf.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Quadrature Demodulator
-###################################################
- -->
-<block>
- <name>Quadrature Demod</name>
- <key>analog_quadrature_demod_cf</key>
- <import>from gnuradio import analog</import>
- <import>import math</import>
- <make>analog.quadrature_demod_cf($gain)</make>
- <callback>set_gain($gain)</callback>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>samp_rate/(2*math.pi*fsk_deviation_hz/8.0)</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
- <doc>
-This can be used to demod FM, FSK, GMSK, etc. The input is complex
-baseband, output is the signal frequency in relation to the sample
-rated, multiplied with the gain.
-
-Mathematically, this block calculates the product of the one-sample
-delayed input and the conjugate undelayed signal, and then calculates
-the argument of the resulting complex number:
-
-y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right).
-
-Let x be a complex sinusoid with amplitude A>0, (absolute)
-frequency f\in\mathbb R and phase \phi_0\in[0;2\pi] sampled at
-f_s>0 so, without loss of generality,
-
-x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f
-
-then
-
-y[n] = \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\\
- = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( \frac f{f_s} (n-1) + \phi_0)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) - \phi_0\right)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} (n-1)\right)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} \left(n-(n-1)\right)\right)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} = \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\\
-= \frac f{f_s}\\
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_rail_ff.block.yml b/gr-analog/grc/analog_rail_ff.block.yml
new file mode 100644
index 0000000000..8a2d2e8a54
--- /dev/null
+++ b/gr-analog/grc/analog_rail_ff.block.yml
@@ -0,0 +1,27 @@
+id: analog_rail_ff
+label: Rail
+
+parameters:
+- id: lo
+ label: Low clipping
+ dtype: real
+- id: hi
+ label: Hi clipping
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.rail_ff(${lo}, ${hi})
+ callbacks:
+ - set_lo(${lo})
+ - set_hi(${hi})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_rail_ff.xml b/gr-analog/grc/analog_rail_ff.xml
deleted file mode 100644
index 87dff09771..0000000000
--- a/gr-analog/grc/analog_rail_ff.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
-#
-# Copyright 2012 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Rail
-###################################################
- -->
-<block>
- <name>Rail</name>
- <key>analog_rail_ff</key>
- <import>from gnuradio import analog</import>
- <make>analog.rail_ff($lo, $hi)</make>
- <callback>set_lo($lo)</callback>
- <callback>set_hi($hi)</callback>
- <param>
- <name>Low clipping</name>
- <key>lo</key>
- <type>real</type>
- </param>
- <param>
- <name>Hi clipping</name>
- <key>hi</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_random_source_x.block.yml b/gr-analog/grc/analog_random_source_x.block.yml
new file mode 100644
index 0000000000..595aa81b6d
--- /dev/null
+++ b/gr-analog/grc/analog_random_source_x.block.yml
@@ -0,0 +1,47 @@
+id: analog_random_source_x
+label: Random Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [i, s, b]
+ hide: part
+- id: min
+ label: Minimum
+ dtype: int
+ default: '0'
+- id: max
+ label: Maximum
+ dtype: int
+ default: '2'
+- id: num_samps
+ label: Num Samples
+ dtype: int
+ default: '1000'
+- id: repeat
+ label: Repeat
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import numpy
+ make: blocks.vector_source_${type.fcn}(map(int, numpy.random.randint(${min}, ${max},
+ ${num_samps})), ${repeat})
+
+documentation: |-
+ Generate num samples of random numbers of [min, max). Repeat samples if specified.
+
+ Ex: With min=0 and max=2, the sequence 01110101... will be generated.
+
+file_format: 1
diff --git a/gr-analog/grc/analog_random_source_x.xml b/gr-analog/grc/analog_random_source_x.xml
deleted file mode 100644
index e466c02fbe..0000000000
--- a/gr-analog/grc/analog_random_source_x.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Random Source:
-## Custom block
-###################################################
- -->
-<block>
- <name>Random Source</name>
- <key>analog_random_source_x</key>
- <import>from gnuradio import blocks</import>
- <import>import numpy</import>
- <make>blocks.vector_source_$(type.fcn)(map(int, numpy.random.randint($min, $max, $num_samps)), $repeat)</make>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>Minimum</name>
- <key>min</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Maximum</name>
- <key>max</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Samples</name>
- <key>num_samps</key>
- <value>1000</value>
- <type>int</type>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
- <doc>
-Generate num samples of random numbers of [min, max). Repeat samples if specified.
-
-Ex: With min=0 and max=2, the sequence 01110101... will be generated.
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_random_uniform_source_x.block.yml b/gr-analog/grc/analog_random_uniform_source_x.block.yml
new file mode 100644
index 0000000000..d76bc903a5
--- /dev/null
+++ b/gr-analog/grc/analog_random_uniform_source_x.block.yml
@@ -0,0 +1,32 @@
+id: analog_random_uniform_source_x
+label: Random Uniform Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [i, s, b]
+ offset_type: [int, int, int]
+ hide: part
+- id: minimum
+ label: Minimum
+ dtype: int
+- id: maximum
+ label: Maximum
+ dtype: int
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.random_uniform_source_${type.fcn}(${minimum}, ${maximum}, ${seed})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_random_uniform_source_x.xml b/gr-analog/grc/analog_random_uniform_source_x.xml
deleted file mode 100644
index c81b637f97..0000000000
--- a/gr-analog/grc/analog_random_uniform_source_x.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Random Uniform Source</name>
- <key>analog_random_uniform_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.random_uniform_source_$(type.fcn)($minimum, $maximum, $seed)</make>
-
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>offset_type:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>offset_type:int</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- <opt>offset_type:int</opt>
- </option>
- </param>
-
- <param>
- <name>Minimum</name>
- <key>minimum</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Maximum</name>
- <key>maximum</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_sig_source_x.block.yml b/gr-analog/grc/analog_sig_source_x.block.yml
new file mode 100644
index 0000000000..2fbc853a9b
--- /dev/null
+++ b/gr-analog/grc/analog_sig_source_x.block.yml
@@ -0,0 +1,57 @@
+id: analog_sig_source_x
+label: Signal Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [c, f, i, s]
+ offset_type: [complex, real, int, int]
+ hide: part
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: waveform
+ label: Waveform
+ dtype: int
+ default: analog.GR_COS_WAVE
+ options: [analog.GR_CONST_WAVE, analog.GR_SIN_WAVE, analog.GR_COS_WAVE, analog.GR_SQR_WAVE,
+ analog.GR_TRI_WAVE, analog.GR_SAW_WAVE]
+ option_labels: [Constant, Sine, Cosine, Square, Triangle, Saw Tooth]
+- id: freq
+ label: Frequency
+ dtype: real
+ default: '1000'
+- id: amp
+ label: Amplitude
+ dtype: real
+ default: '1'
+- id: offset
+ label: Offset
+ dtype: ${ type.offset_type }
+ default: '0'
+
+inputs:
+- domain: message
+ id: freq
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.sig_source_${type.fcn}(${samp_rate}, ${waveform}, ${freq}, ${amp},
+ ${offset})
+ callbacks:
+ - set_sampling_freq(${samp_rate})
+ - set_waveform(${waveform})
+ - set_frequency(${freq})
+ - set_amplitude(${amp})
+ - set_offset(${offset})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_sig_source_x.xml b/gr-analog/grc/analog_sig_source_x.xml
deleted file mode 100644
index e3c587b254..0000000000
--- a/gr-analog/grc/analog_sig_source_x.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Signal Source
-###################################################
- -->
-<block>
- <name>Signal Source</name>
- <key>analog_sig_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.sig_source_$(type.fcn)($samp_rate, $waveform, $freq, $amp, $offset)</make>
- <callback>set_sampling_freq($samp_rate)</callback>
- <callback>set_waveform($waveform)</callback>
- <callback>set_frequency($freq)</callback>
- <callback>set_amplitude($amp)</callback>
- <callback>set_offset($offset)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- <opt>offset_type:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- <opt>offset_type:real</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>offset_type:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>offset_type:int</opt>
- </option>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Waveform</name>
- <key>waveform</key>
- <value>analog.GR_COS_WAVE</value>
- <type>int</type>
- <option>
- <name>Constant</name>
- <key>analog.GR_CONST_WAVE</key>
- </option>
- <option>
- <name>Sine</name>
- <key>analog.GR_SIN_WAVE</key>
- </option>
- <option>
- <name>Cosine</name>
- <key>analog.GR_COS_WAVE</key>
- </option>
- <option>
- <name>Square</name>
- <key>analog.GR_SQR_WAVE</key>
- </option>
- <option>
- <name>Triangle</name>
- <key>analog.GR_TRI_WAVE</key>
- </option>
- <option>
- <name>Saw Tooth</name>
- <key>analog.GR_SAW_WAVE</key>
- </option>
- </param>
- <param>
- <name>Frequency</name>
- <key>freq</key>
- <value>1000</value>
- <type>real</type>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amp</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Offset</name>
- <key>offset</key>
- <value>0</value>
- <type>$type.offset_type</type>
- </param>
- <sink>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_simple_squelch_cc.block.yml b/gr-analog/grc/analog_simple_squelch_cc.block.yml
new file mode 100644
index 0000000000..17a98eb4ba
--- /dev/null
+++ b/gr-analog/grc/analog_simple_squelch_cc.block.yml
@@ -0,0 +1,27 @@
+id: analog_simple_squelch_cc
+label: Simple Squelch
+
+parameters:
+- id: threshold
+ label: Threshold (dB)
+ dtype: real
+- id: alpha
+ label: Alpha
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.simple_squelch_cc(${threshold}, ${alpha})
+ callbacks:
+ - set_threshold(${threshold})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_simple_squelch_cc.xml b/gr-analog/grc/analog_simple_squelch_cc.xml
deleted file mode 100644
index 648921a149..0000000000
--- a/gr-analog/grc/analog_simple_squelch_cc.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Simple Squelch
-###################################################
- -->
-<block>
- <name>Simple Squelch</name>
- <key>analog_simple_squelch_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.simple_squelch_cc($threshold, $alpha)</make>
- <callback>set_threshold($threshold)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Threshold (dB)</name>
- <key>threshold</key>
- <type>real</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_standard_squelch.block.yml b/gr-analog/grc/analog_standard_squelch.block.yml
new file mode 100644
index 0000000000..d753dfaf01
--- /dev/null
+++ b/gr-analog/grc/analog_standard_squelch.block.yml
@@ -0,0 +1,28 @@
+id: analog_standard_squelch
+label: Standard Squelch
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: real
+- id: threshold
+ label: Threshold
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.standard_squelch(audio_rate=${audio_rate})
+ self.${id}.set_threshold(${threshold})
+ callbacks:
+ - set_threshold(${threshold})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_standard_squelch.xml b/gr-analog/grc/analog_standard_squelch.xml
deleted file mode 100644
index 264c57ab56..0000000000
--- a/gr-analog/grc/analog_standard_squelch.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Standard Squelch
-###################################################
- -->
-<block>
- <name>Standard Squelch</name>
- <key>analog_standard_squelch</key>
- <import>from gnuradio import analog</import>
- <make>analog.standard_squelch(audio_rate=$audio_rate)
-self.$(id).set_threshold($threshold)</make>
- <callback>set_threshold($threshold)</callback>
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_wfm_rcv.block.yml b/gr-analog/grc/analog_wfm_rcv.block.yml
new file mode 100644
index 0000000000..eb3a84893e
--- /dev/null
+++ b/gr-analog/grc/analog_wfm_rcv.block.yml
@@ -0,0 +1,25 @@
+id: analog_wfm_rcv
+label: WBFM Receive
+
+parameters:
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: real
+- id: audio_decimation
+ label: Audio Decimation
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.wfm_rcv(\n\tquad_rate=${quad_rate},\n\taudio_decimation=${audio_decimation},\n\
+ )"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_wfm_rcv.xml b/gr-analog/grc/analog_wfm_rcv.xml
deleted file mode 100644
index ce2abb92de..0000000000
--- a/gr-analog/grc/analog_wfm_rcv.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WBFM Receive
-###################################################
- -->
-<block>
- <name>WBFM Receive</name>
- <key>analog_wfm_rcv</key>
- <import>from gnuradio import analog</import>
- <make>analog.wfm_rcv(
- quad_rate=$quad_rate,
- audio_decimation=$audio_decimation,
-)</make>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decimation</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_wfm_rcv_pll.block.yml b/gr-analog/grc/analog_wfm_rcv_pll.block.yml
new file mode 100644
index 0000000000..e5e3d76ccc
--- /dev/null
+++ b/gr-analog/grc/analog_wfm_rcv_pll.block.yml
@@ -0,0 +1,29 @@
+id: analog_wfm_rcv_pll
+label: WBFM Receive PLL
+
+parameters:
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: real
+- id: audio_decimation
+ label: Audio Decimation
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- label: Lout
+ domain: stream
+ dtype: float
+- label: Rout
+ domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.wfm_rcv_pll(\n\tdemod_rate=${quad_rate},\n\taudio_decimation=${audio_decimation},\n\
+ )"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_wfm_rcv_pll.xml b/gr-analog/grc/analog_wfm_rcv_pll.xml
deleted file mode 100644
index db31ed9bee..0000000000
--- a/gr-analog/grc/analog_wfm_rcv_pll.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WBFM Receive PLL
-###################################################
- -->
-<block>
- <name>WBFM Receive PLL</name>
- <key>analog_wfm_rcv_pll</key>
- <import>from gnuradio import analog</import>
- <make>analog.wfm_rcv_pll(
- demod_rate=$quad_rate,
- audio_decimation=$audio_decimation,
-)</make>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decimation</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>Lout</name>
- <type>float</type>
- </source>
- <source>
- <name>Rout</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_wfm_tx.block.yml b/gr-analog/grc/analog_wfm_tx.block.yml
new file mode 100644
index 0000000000..1e4346c41d
--- /dev/null
+++ b/gr-analog/grc/analog_wfm_tx.block.yml
@@ -0,0 +1,40 @@
+id: analog_wfm_tx
+label: WBFM Transmit
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: int
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: int
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: max_dev
+ label: Max Deviation
+ dtype: real
+ default: 75e3
+- id: fh
+ label: Preemphasis High Corner Freq
+ dtype: real
+ default: '-1.0'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+asserts:
+- ${ (quad_rate)%(audio_rate) == 0 }
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.wfm_tx(\n\taudio_rate=${audio_rate},\n\tquad_rate=${quad_rate},\n\
+ \ttau=${tau},\n\tmax_dev=${max_dev},\n\tfh=${fh},\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_wfm_tx.xml b/gr-analog/grc/analog_wfm_tx.xml
deleted file mode 100644
index 507c2ea894..0000000000
--- a/gr-analog/grc/analog_wfm_tx.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WBFM Transmit
-###################################################
- -->
-<block>
- <name>WBFM Transmit</name>
- <key>analog_wfm_tx</key>
- <import>from gnuradio import analog</import>
- <make>analog.wfm_tx(
- audio_rate=$audio_rate,
- quad_rate=$quad_rate,
- tau=$tau,
- max_dev=$max_dev,
- fh=$fh,
-)</make>
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>75e3</value>
- <type>real</type>
- </param>
- <param>
- <name>Preemphasis High Corner Freq</name>
- <key>fh</key>
- <value>-1.0</value>
- <type>real</type>
- </param>
- <check>($quad_rate)%($audio_rate) == 0</check>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/include/gnuradio/analog/CMakeLists.txt b/gr-analog/include/gnuradio/analog/CMakeLists.txt
index b5333639d6..b03e63fe12 100644
--- a/gr-analog/include/gnuradio/analog/CMakeLists.txt
+++ b/gr-analog/include/gnuradio/analog/CMakeLists.txt
@@ -18,23 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_H(analog noise_source_X s i f c)
-GR_EXPAND_X_H(analog fastnoise_source_X s i f c)
-GR_EXPAND_X_H(analog sig_source_X s i f c)
-GR_EXPAND_X_H(analog random_uniform_source_X b s i)
-
-add_custom_target(analog_generated_includes DEPENDS
- ${generated_includes}
-)
-
-########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
api.h
cpm.h
noise_type.h
@@ -51,9 +37,11 @@ install(FILES
cpfsk_bc.h
ctcss_squelch_ff.h
dpll_bb.h
+ fastnoise_source.h
feedforward_agc_cc.h
fmdet_cf.h
frequency_modulator_fc.h
+ noise_source.h
phase_modulator_fc.h
pll_carriertracking_cc.h
pll_freqdet_cf.h
@@ -65,9 +53,10 @@ install(FILES
pwr_squelch_ff.h
quadrature_demod_cf.h
rail_ff.h
+ random_uniform_source.h
+ sig_source.h
sig_source_waveform.h
simple_squelch_cc.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog
- COMPONENT "analog_devel"
)
diff --git a/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t b/gr-analog/include/gnuradio/analog/fastnoise_source.h
index f588299604..28cb21b4ca 100644
--- a/gr-analog/include/gnuradio/analog/fastnoise_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/fastnoise_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2013 Free Software Foundation, Inc.
+ * Copyright 2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,16 +20,15 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FASTNOISE_SOURCE_H
+#define FASTNOISE_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/analog/noise_type.h>
#include <gnuradio/sync_block.h>
-
#include <vector>
+#include <cstdint>
namespace gr {
namespace analog {
@@ -42,11 +41,12 @@ namespace gr {
* Generate random values from different distributions.
* Currently, only Gaussian and uniform are enabled.
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API fastnoise_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::fastnoise_source::sptr
+ typedef boost::shared_ptr< fastnoise_source<T> > sptr;
/*! \brief Make a fast noise source
* \param type the random distribution to use (see
@@ -62,9 +62,9 @@ namespace gr {
*/
static sptr make(noise_type_t type, float ampl,
long seed = 0, long samples=1024*16);
- virtual @TYPE@ sample() = 0;
- virtual @TYPE@ sample_unbiased() = 0;
- virtual const std::vector<@TYPE@>& samples() const = 0;
+ virtual T sample() = 0;
+ virtual T sample_unbiased() = 0;
+ virtual const std::vector<T>& samples() const = 0;
/*!
* Set the noise type. Nominally from the
@@ -83,8 +83,12 @@ namespace gr {
virtual float amplitude() const = 0;
};
+ typedef fastnoise_source<float> fastnoise_source_f;
+ typedef fastnoise_source<std::int32_t> fastnoise_source_i;
+ typedef fastnoise_source<std::int16_t> fastnoise_source_s;
+ typedef fastnoise_source<gr_complex> fastnoise_source_c;
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FASTNOISE_SOURCE_H */
diff --git a/gr-analog/include/gnuradio/analog/noise_source_X.h.t b/gr-analog/include/gnuradio/analog/noise_source.h
index f619ca5146..4653074cb8 100644
--- a/gr-analog/include/gnuradio/analog/noise_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/noise_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef NOISE_SOURCE_H
+#define NOISE_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/analog/noise_type.h>
@@ -40,11 +39,12 @@ namespace gr {
* Generate random values from different distributions.
* Currently, only Gaussian and uniform are enabled.
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API noise_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::noise_source::sptr
+ typedef boost::shared_ptr< noise_source<T> > sptr;
/*! Build a noise source
* \param type the random distribution to use (see
@@ -76,7 +76,12 @@ namespace gr {
virtual float amplitude() const = 0;
};
+ typedef noise_source<std::int16_t> noise_source_s;
+ typedef noise_source<std::int32_t> noise_source_i;
+ typedef noise_source<float> noise_source_f;
+ typedef noise_source<gr_complex> noise_source_c;
+
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* NOISE_SOURCE_H */
diff --git a/gr-analog/include/gnuradio/analog/random_uniform_source_X.h.t b/gr-analog/include/gnuradio/analog/random_uniform_source.h
index d2f7cbdc44..95948cc24e 100644
--- a/gr-analog/include/gnuradio/analog/random_uniform_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/random_uniform_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2015 Free Software Foundation, Inc.
+ * Copyright 2015,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RANDOM_UNIFORM_SOURCE_H
+#define RANDOM_UNIFORM_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/sync_block.h>
@@ -35,11 +34,12 @@ namespace gr {
* \brief Uniform Random Number Generator with @TYPE@ output.
* \ingroup waveform_generators_blk
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API random_uniform_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::random_uniform_source::sptr
+ typedef boost::shared_ptr< random_uniform_source<T> > sptr;
/*!
* \brief Return a shared_ptr to a new instance of analog::random_uniform_source_X.
@@ -55,7 +55,10 @@ namespace gr {
static sptr make(int minimum, int maximum, int seed);
};
+ typedef random_uniform_source<std::uint8_t> random_uniform_source_b;
+ typedef random_uniform_source<std::int16_t> random_uniform_source_s;
+ typedef random_uniform_source<std::int32_t> random_uniform_source_i;
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* RANDOM_UNIFORM_SOURCE_H */
diff --git a/gr-analog/include/gnuradio/analog/sig_source_X.h.t b/gr-analog/include/gnuradio/analog/sig_source.h
index cf6cdc212d..759f93754c 100644
--- a/gr-analog/include/gnuradio/analog/sig_source_X.h.t
+++ b/gr-analog/include/gnuradio/analog/sig_source.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,9 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SIG_SOURCE_H
+#define SIG_SOURCE_H
#include <gnuradio/analog/api.h>
#include <gnuradio/analog/sig_source_waveform.h>
@@ -33,14 +32,15 @@ namespace gr {
namespace analog {
/*!
- * \brief signal generator with @TYPE@ output.
+ * \brief signal generator with T output.
* \ingroup waveform_generators_blk
*/
- class ANALOG_API @BASE_NAME@ : virtual public sync_block
+template<class T>
+ class ANALOG_API sig_source : virtual public sync_block
{
public:
- // gr::analog::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::analog::sig_source::sptr
+ typedef boost::shared_ptr< sig_source<T> > sptr;
/*!
* Build a signal source block.
@@ -54,22 +54,26 @@ namespace gr {
static sptr make(double sampling_freq,
gr::analog::gr_waveform_t waveform,
double wave_freq,
- double ampl, @TYPE@ offset = 0);
+ double ampl, T offset = 0);
virtual double sampling_freq() const = 0;
virtual gr::analog::gr_waveform_t waveform() const = 0;
virtual double frequency() const = 0;
virtual double amplitude() const = 0;
- virtual @TYPE@ offset() const = 0;
+ virtual T offset() const = 0;
virtual void set_sampling_freq(double sampling_freq) = 0;
virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0;
virtual void set_frequency(double frequency) = 0;
virtual void set_amplitude(double ampl) = 0;
- virtual void set_offset(@TYPE@ offset) = 0;
+ virtual void set_offset(T offset) = 0;
};
+ typedef sig_source<std::int16_t> sig_source_s;
+ typedef sig_source<std::int32_t> sig_source_i;
+ typedef sig_source<float> sig_source_f;
+ typedef sig_source<gr_complex> sig_source_c;
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SIG_SOURCE_H */
diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt
index cc4864d6d1..9a41d12fe7 100644
--- a/gr-analog/lib/CMakeLists.txt
+++ b/gr-analog/lib/CMakeLists.txt
@@ -40,19 +40,9 @@ if(ENABLE_GR_CTRLPORT)
endif(ENABLE_GR_CTRLPORT)
########################################################################
-# Invoke macro to generate various sources and headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H(analog noise_source_X_impl s i f c)
-GR_EXPAND_X_CC_H(analog fastnoise_source_X_impl s i f c)
-GR_EXPAND_X_CC_H(analog sig_source_X_impl s i f c)
-GR_EXPAND_X_CC_H(analog random_uniform_source_X_impl b s i)
-
-########################################################################
# Setup library
########################################################################
list(APPEND analog_sources
- ${generated_sources}
cpm.cc
squelch_base_cc_impl.cc
squelch_base_ff_impl.cc
@@ -64,9 +54,11 @@ list(APPEND analog_sources
cpfsk_bc_impl.cc
ctcss_squelch_ff_impl.cc
dpll_bb_impl.cc
+ fastnoise_source_impl.cc
feedforward_agc_cc_impl.cc
fmdet_cf_impl.cc
frequency_modulator_fc_impl.cc
+ noise_source_impl.cc
phase_modulator_fc_impl.cc
pll_carriertracking_cc_impl.cc
pll_freqdet_cf_impl.cc
@@ -78,6 +70,8 @@ list(APPEND analog_sources
pwr_squelch_ff_impl.cc
quadrature_demod_cf_impl.cc
rail_ff_impl.cc
+ random_uniform_source_impl.cc
+ sig_source_impl.cc
simple_squelch_cc_impl.cc
)
@@ -106,14 +100,13 @@ list(APPEND analog_libs
add_library(gnuradio-analog SHARED ${analog_sources})
target_link_libraries(gnuradio-analog ${analog_libs})
-GR_LIBRARY_FOO(gnuradio-analog RUNTIME_COMPONENT "analog_runtime" DEVEL_COMPONENT "analog_devel")
-add_dependencies(gnuradio-analog analog_generated_includes analog_generated_swigs gnuradio-filter)
+GR_LIBRARY_FOO(gnuradio-analog)
+add_dependencies(gnuradio-analog analog_generated_swigs gnuradio-filter)
if(ENABLE_STATIC_LIBS)
add_library(gnuradio-analog_static STATIC ${analog_sources})
add_dependencies(gnuradio-analog_static
- analog_generated_includes
gnuradio-filter_static)
if(NOT WIN32)
@@ -122,7 +115,7 @@ if(ENABLE_STATIC_LIBS)
endif(NOT WIN32)
install(TARGETS gnuradio-analog_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "analog_devel" # .lib file
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
)
endif(ENABLE_STATIC_LIBS)
diff --git a/gr-analog/lib/cpfsk_bc_impl.cc b/gr-analog/lib/cpfsk_bc_impl.cc
index 3c1674aaa4..01b3ae3ebd 100644
--- a/gr-analog/lib/cpfsk_bc_impl.cc
+++ b/gr-analog/lib/cpfsk_bc_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2010,2012,2018 Free Software Foundation, Inc.
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,12 +25,11 @@
#include "cpfsk_bc_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/expj.h>
+#include <gnuradio/math.h>
namespace gr {
namespace analog {
-#define M_TWOPI (2*M_PI)
-
cpfsk_bc::sptr
cpfsk_bc::make(float k, float ampl, int samples_per_sym)
{
@@ -45,7 +44,7 @@ namespace gr {
samples_per_sym)
{
d_samples_per_sym = samples_per_sym;
- d_freq = k*M_PI/samples_per_sym;
+ d_freq = k*GR_M_PI/samples_per_sym;
d_ampl = ampl;
d_phase = 0.0;
}
@@ -69,10 +68,10 @@ namespace gr {
else
d_phase -= d_freq;
- while(d_phase > M_TWOPI)
- d_phase -= M_TWOPI;
- while(d_phase < -M_TWOPI)
- d_phase += M_TWOPI;
+ while(d_phase > GR_M_TWOPI)
+ d_phase -= GR_M_TWOPI;
+ while(d_phase < -GR_M_TWOPI)
+ d_phase += GR_M_TWOPI;
*out++ = gr_expj(d_phase)*d_ampl;
}
diff --git a/gr-analog/lib/cpm.cc b/gr-analog/lib/cpm.cc
index b61ee28816..163588682d 100644
--- a/gr-analog/lib/cpm.cc
+++ b/gr-analog/lib/cpm.cc
@@ -24,29 +24,23 @@
#include "config.h"
#endif
-#include <cmath>
-#include <cfloat>
#include <gnuradio/analog/cpm.h>
+#include <gnuradio/math.h>
-//gives us erf on compilers without it
-#include <boost/math/special_functions/erf.hpp>
-namespace bm = boost::math;
+#include <cmath>
+#include <cfloat>
namespace gr {
namespace analog {
-#ifndef M_TWOPI
-# define M_TWOPI (2*M_PI)
-#endif
-
- //! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x
+ //! Normalised sinc function, sinc(x)=std::sin(pi*x)/pi*x
inline double
sinc(double x)
{
if(x == 0) {
return 1.0;
}
- return sin(M_PI * x) / (M_PI * x);
+ return std::sin(GR_M_PI * x) / (GR_M_PI * x);
}
@@ -56,7 +50,7 @@ namespace gr {
{
std::vector<float> taps(samples_per_sym * L, 1.0/L/samples_per_sym);
for(unsigned i = 0; i < samples_per_sym * L; i++) {
- taps[i] *= 1 - cos(M_TWOPI * i / L / samples_per_sym);
+ taps[i] *= 1 - std::cos(GR_M_TWOPI * i / L / samples_per_sym);
}
return taps;
@@ -67,7 +61,7 @@ namespace gr {
*
* L-SRC has a time-continuous phase response function of
*
- * g(t) = 1/LT * sinc(2t/LT) * cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2)
+ * g(t) = 1/LT * sinc(2t/LT) * std::cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2)
*
* which is the Fourier transform of a cos-rolloff function with rolloff
* beta, and looks like a sinc-function, multiplied with a rolloff term.
@@ -75,7 +69,7 @@ namespace gr {
* zero crossings.
* The time-discrete IR is thus
*
- * g(k) = 1/Ls * sinc(2k/Ls) * cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2)
+ * g(k) = 1/Ls * sinc(2k/Ls) * std::cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2)
* where k = 0...Ls-1
* and s = samples per symbol.
*/
@@ -100,7 +94,7 @@ namespace gr {
}
else {
double tmp = 4.0 * beta * k / Ls;
- taps_d[i] *= cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp);
+ taps_d[i] *= std::cos(beta * GR_M_TWOPI * k / Ls) / (1 - tmp * tmp);
}
sum += taps_d[i];
}
@@ -127,8 +121,8 @@ namespace gr {
}
const double pi2_24 = 0.411233516712057; // pi^2/24
- double f = M_PI * k / sps;
- return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f);
+ double f = GR_M_PI * k / sps;
+ return sinc(k/sps) - pi2_24 * (2 * std::sin(f) - 2*f*std::cos(f) - f*f*std::sin(f)) / (f*f*f);
}
//! Taps for TFM CPM (Tamed frequency modulation)
@@ -183,8 +177,8 @@ namespace gr {
double alpha = 5.336446256636997 * bt;
for(unsigned i = 0; i < samples_per_sym * L; i++) {
double k = i - Ls/2; // Causal to acausal
- taps_d[i] = (bm::erf(alpha * (k / samples_per_sym + 0.5)) -
- bm::erf(alpha * (k / samples_per_sym - 0.5)))
+ taps_d[i] = (std::erf(alpha * (k / samples_per_sym + 0.5)) -
+ std::erf(alpha * (k / samples_per_sym - 0.5)))
* 0.5 / samples_per_sym;
taps[i] = (float) taps_d[i];
}
diff --git a/gr-analog/lib/fastnoise_source_X_impl.cc.t b/gr-analog/lib/fastnoise_source_X_impl.cc.t
deleted file mode 100644
index 72c6cb0582..0000000000
--- a/gr-analog/lib/fastnoise_source_X_impl.cc.t
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2013 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/xoroshiro128p.h>
-#include <gnuradio/io_signature.h>
-#include <stdexcept>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(noise_type_t type, float ampl, long seed, long samples)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(type, ampl, seed, samples));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@))),
- d_type(type),
-#if @IS_COMPLEX@ // complex?
- d_ampl(ampl/sqrtf(2.0f))
-#else
- d_ampl(ampl)
-#endif
- {
- d_samples.resize(samples);
- xoroshiro128p_seed(d_state, (uint64_t) seed);
- generate();
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::set_type(noise_type_t type)
- {
- gr::thread::scoped_lock l(d_setlock);
- d_type = type;
- generate();
- }
-
- void
- @IMPL_NAME@::set_amplitude(float ampl)
- {
- gr::thread::scoped_lock l(d_setlock);
-#if @IS_COMPLEX@ // complex?
- d_ampl = ampl/sqrtf(2.0f);
-#else
- d_ampl = ampl;
-#endif
- generate();
- }
-
- void
- @IMPL_NAME@::generate()
- {
- int noutput_items = d_samples.size();
- switch(d_type){
-#if @IS_COMPLEX@ // complex?
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
- d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = d_ampl * d_rng.rayleigh_complex();
- break;
-
-#else // nope...
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * d_rng.gasdev());
- break;
-
- case GR_LAPLACIAN:
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * d_rng.laplacian());
- break;
-
- case GR_IMPULSE: // FIXME changeable impulse settings
- for(int i = 0; i < noutput_items; i++)
- d_samples[i] = (@TYPE@)(d_ampl * d_rng.impulse(9));
- break;
-#endif
-
- default:
- throw std::runtime_error("invalid type");
- }
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock l(d_setlock);
-
- @TYPE@ *out = (@TYPE@*)output_items[0];
-
- for(int i=0; i<noutput_items; i++) {
- out[i] = sample();
- }
-
- return noutput_items;
- }
-
- @TYPE@ @IMPL_NAME@::sample()
- {
- size_t idx = xoroshiro128p_next(d_state) % d_samples.size();
- return d_samples[idx];
- }
-
- @TYPE@ @IMPL_NAME@::sample_unbiased()
- {
- uint64_t random_int = xoroshiro128p_next(d_state);
-#if @IS_COMPLEX@
- gr_complex s(sample());
- float re = (random_int & (UINT64_C(1)<<23)) ? (- s.real()) : (s.real());
- float im = (random_int & (UINT64_C(1)<<42)) ? (- s.real()) : (s.real());
- return gr_complex(re, im);
-#else
- float s = sample();
- return (random_int & (1<<23)) ? (-s) : s;
-#endif
- }
-
- const std::vector<@TYPE@>& @IMPL_NAME@::samples() const
- {
- return d_samples;
- }
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/fastnoise_source_impl.cc b/gr-analog/lib/fastnoise_source_impl.cc
new file mode 100644
index 0000000000..9cdea4e50d
--- /dev/null
+++ b/gr-analog/lib/fastnoise_source_impl.cc
@@ -0,0 +1,191 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "fastnoise_source_impl.h"
+#include <gnuradio/xoroshiro128p.h>
+#include <gnuradio/io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename fastnoise_source<T>::sptr
+fastnoise_source<T>::make(noise_type_t type, float ampl, long seed, long samples) {
+ return gnuradio::get_initial_sptr(new fastnoise_source_impl<T>(type, ampl, seed, samples));
+}
+
+ template <>
+ void fastnoise_source_impl<gr_complex>::generate() {
+ int noutput_items = d_samples.size();
+ switch (d_type) {
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
+ d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = d_ampl * d_rng.rayleigh_complex();
+ break;
+ default:
+ throw std::runtime_error("invalid type");
+ }
+ }
+
+template <class T>
+fastnoise_source_impl<T>::fastnoise_source_impl(noise_type_t type,
+ float ampl,
+ long seed,
+ long samples)
+ : sync_block(
+ "fastnoise_source", io_signature::make(0, 0, 0), io_signature::make(1, 1, sizeof(T))),
+ d_type(type), d_ampl(ampl) {
+ d_samples.resize(samples);
+ xoroshiro128p_seed(d_state, (uint64_t) seed);
+ generate();
+}
+
+
+template <>
+fastnoise_source_impl<gr_complex>::fastnoise_source_impl(noise_type_t type,
+ float ampl,
+ long seed,
+ long samples)
+ : sync_block("fastnoise_source",
+ io_signature::make(0, 0, 0),
+ io_signature::make(1, 1, sizeof(gr_complex))),
+ d_type(type), d_ampl(ampl / sqrtf(2.0f)) {
+ d_samples.resize(samples);
+ xoroshiro128p_seed(d_state, (uint64_t) seed);
+ generate();
+}
+
+template <class T>
+fastnoise_source_impl<T>::~fastnoise_source_impl() {}
+
+template <class T>
+void fastnoise_source_impl<T>::set_type(noise_type_t type) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_type = type;
+ generate();
+}
+
+template <class T>
+void fastnoise_source_impl<T>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl;
+ generate();
+}
+
+template <>
+void fastnoise_source_impl<gr_complex>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl / sqrtf(2.0f);
+ generate();
+}
+
+
+template <class T>
+void fastnoise_source_impl<T>::generate() {
+ int noutput_items = d_samples.size();
+ switch (d_type) {
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * d_rng.gasdev());
+ break;
+
+ case GR_LAPLACIAN:
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * d_rng.laplacian());
+ break;
+
+ case GR_IMPULSE: // FIXME changeable impulse settings
+ for (int i = 0; i < noutput_items; i++)
+ d_samples[i] = (T)(d_ampl * d_rng.impulse(9));
+ break;
+ default:
+ throw std::runtime_error("invalid type");
+ }
+}
+
+
+
+template <class T>
+int fastnoise_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ T* out = (T*)output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = sample();
+ }
+
+ return noutput_items;
+}
+
+template <class T>
+T fastnoise_source_impl<T>::sample() {
+ size_t idx = xoroshiro128p_next(d_state) % d_samples.size();
+ return d_samples[idx];
+}
+
+template <class T>
+T fastnoise_source_impl<T>::sample_unbiased() {
+ uint64_t random_int = xoroshiro128p_next(d_state);
+ float s = sample();
+ return (random_int & (1<<23)) ? (-s) : s;
+}
+
+template <>
+gr_complex fastnoise_source_impl<gr_complex>::sample_unbiased() {
+ uint64_t random_int = xoroshiro128p_next(d_state);
+ float re = (random_int & (UINT64_C(1)<<23)) ? (- s.real()) : (s.real());
+ float im = (random_int & (UINT64_C(1)<<42)) ? (- s.real()) : (s.real());
+ return gr_complex(re, im);
+}
+
+template <class T>
+const std::vector<T>& fast_noise_source_impl<T>::samples() const {
+ return d_samples;
+}
+
+
+template class fastnoise_source<std::int16_t>;
+template class fastnoise_source<std::int32_t>;
+template class fastnoise_source<float>;
+template class fastnoise_source<gr_complex>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/fastnoise_source_X_impl.h.t b/gr-analog/lib/fastnoise_source_impl.h
index ef0465729d..f40d39d5f1 100644
--- a/gr-analog/lib/fastnoise_source_X_impl.h.t
+++ b/gr-analog/lib/fastnoise_source_impl.h
@@ -20,37 +20,38 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FASTNOISE_SOURCE_IMPL_H
+#define FASTNOISE_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/fastnoise_source.h>
#include <gnuradio/random.h>
+#include <vector>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class fastnoise_source_impl : public fastnoise_source<T>
{
private:
noise_type_t d_type;
float d_ampl;
gr::random d_rng;
- std::vector<@TYPE@> d_samples;
+ std::vector<T> d_samples;
uint64_t d_state[2];
public:
- @IMPL_NAME@(noise_type_t type, float ampl, long seed, long samples);
- ~@IMPL_NAME@();
+ fastnoise_source_impl(noise_type_t type, float ampl, long seed, long samples);
+ ~fastnoise_source_impl();
- @TYPE@ sample();
- @TYPE@ sample_unbiased();
+ T sample();
+ T sample_unbiased();
+ const std::vector<T>& samples() const;
void set_type(noise_type_t type);
void set_amplitude(float ampl);
void generate();
- const std::vector<@TYPE@>& samples() const;
noise_type_t type() const { return d_type; }
float amplitude() const { return d_ampl; }
@@ -63,4 +64,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FASTNOISE_SOURCE_IMPL_H */
diff --git a/gr-analog/lib/feedforward_agc_cc_impl.cc b/gr-analog/lib/feedforward_agc_cc_impl.cc
index 9870c7c3c0..1a7ba7b9c4 100644
--- a/gr-analog/lib/feedforward_agc_cc_impl.cc
+++ b/gr-analog/lib/feedforward_agc_cc_impl.cc
@@ -54,12 +54,6 @@ namespace gr {
{
}
- inline static float
- mag_squared(gr_complex x)
- {
- return x.real() * x.real() + x.imag() * x.imag();
- }
-
// approximate sqrt(x^2 + y^2)
inline static float
envelope(gr_complex x)
diff --git a/gr-analog/lib/fmdet_cf_impl.cc b/gr-analog/lib/fmdet_cf_impl.cc
index a9b372478a..fdd438f335 100644
--- a/gr-analog/lib/fmdet_cf_impl.cc
+++ b/gr-analog/lib/fmdet_cf_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2008,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
diff --git a/gr-analog/lib/frequency_modulator_fc_impl.cc b/gr-analog/lib/frequency_modulator_fc_impl.cc
index 56fa0f7c17..0c7f9873b1 100644
--- a/gr-analog/lib/frequency_modulator_fc_impl.cc
+++ b/gr-analog/lib/frequency_modulator_fc_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010-2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010-2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,6 +27,7 @@
#include "frequency_modulator_fc_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/fxpt.h>
+#include <gnuradio/math.h>
#include <cmath>
namespace gr {
@@ -63,7 +64,7 @@ namespace gr {
d_phase = d_phase + d_sensitivity * in[i];
//place phase in [-pi, +pi[
- #define F_PI ((float)(M_PI))
+ #define F_PI ((float)(GR_M_PI))
d_phase = std::fmod(d_phase + F_PI, 2.0f * F_PI) - F_PI;
float oi, oq;
diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t
deleted file mode 100644
index d8c1b7eb1b..0000000000
--- a/gr-analog/lib/noise_source_X_impl.cc.t
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <stdexcept>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(noise_type_t type, float ampl, long seed)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(type, ampl, seed));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@))),
- d_type(type),
-#if @IS_COMPLEX@ // complex?
- d_ampl(ampl/sqrtf(2.0f)),
-#else
- d_ampl(ampl),
-#endif
- d_rng(seed)
- {
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::set_type(noise_type_t type)
- {
- gr::thread::scoped_lock l(d_setlock);
- d_type = type;
- }
-
- void
- @IMPL_NAME@::set_amplitude(float ampl)
- {
- gr::thread::scoped_lock l(d_setlock);
-#if @IS_COMPLEX@ // complex?
- d_ampl = ampl/sqrtf(2.0f);
-#else
- d_ampl = ampl;
-#endif
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock l(d_setlock);
-
- @TYPE@ *out = (@TYPE@*)output_items[0];
-
- switch(d_type) {
-#if @IS_COMPLEX@ // complex?
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
- d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- }
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = d_ampl * d_rng.rayleigh_complex();
- }
- break;
-
-#else // nope...
-
- case GR_UNIFORM:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
- }
- break;
-
- case GR_GAUSSIAN:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * d_rng.gasdev());
- }
- break;
-
- case GR_LAPLACIAN:
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * d_rng.laplacian());
- }
- break;
-
- case GR_IMPULSE: // FIXME changeable impulse settings
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@TYPE@)(d_ampl * d_rng.impulse(9));
- }
- break;
-#endif
-
- default:
- throw std::runtime_error("invalid type");
- }
-
- return noutput_items;
- }
-
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/noise_source_impl.cc b/gr-analog/lib/noise_source_impl.cc
new file mode 100644
index 0000000000..a3dd2c20c9
--- /dev/null
+++ b/gr-analog/lib/noise_source_impl.cc
@@ -0,0 +1,150 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "noise_source_impl.h"
+#include <gnuradio/io_signature.h>
+#include <stdexcept>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename noise_source<T>::sptr noise_source<T>::make(noise_type_t type, float ampl, long seed) {
+ return gnuradio::get_initial_sptr(new noise_source_impl<T>(type, ampl, seed));
+}
+
+template <class T>
+noise_source_impl<T>::noise_source_impl(noise_type_t type, float ampl, long seed)
+ : sync_block("noise_source", io_signature::make(0, 0, 0), io_signature::make(1, 1, sizeof(T))),
+ d_type(type), d_ampl(ampl), d_rng(seed) {}
+
+template <>
+noise_source_impl<gr_complex>::noise_source_impl(noise_type_t type, float ampl, long seed)
+ : sync_block("noise_source",
+ io_signature::make(0, 0, 0),
+ io_signature::make(1, 1, sizeof(gr_complex))),
+ d_type(type), d_ampl(ampl / sqrtf(2.0f)), d_rng(seed) {}
+
+
+template <class T>
+noise_source_impl<T>::~noise_source_impl<T>() {}
+
+template <class T>
+void noise_source_impl<T>::set_type(noise_type_t type) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_type = type;
+}
+
+template <class T>
+void noise_source_impl<T>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl;
+}
+
+template <>
+void noise_source_impl<gr_complex>::set_amplitude(float ampl) {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_ampl = ampl / sqrtf(2.0f);
+}
+
+
+template <class T>
+int noise_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ T* out = (T*)output_items[0];
+
+ switch (d_type) {
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ }
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * d_rng.gasdev());
+ }
+ break;
+
+ case GR_LAPLACIAN:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * d_rng.laplacian());
+ }
+ break;
+
+ case GR_IMPULSE: // FIXME changeable impulse settings
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = (T)(d_ampl * d_rng.impulse(9));
+ }
+ break;
+ default:
+ throw std::runtime_error("invalid type");
+ }
+
+ return noutput_items;
+}
+
+template <>
+int noise_source_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ gr_complex* out = (gr_complex*)output_items[0];
+
+ switch (d_type) {
+
+ case GR_UNIFORM:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0),
+ d_ampl * ((d_rng.ran1() * 2.0) - 1.0));
+ }
+ break;
+
+ case GR_GAUSSIAN:
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] = d_ampl * d_rng.rayleigh_complex();
+ }
+ break;
+
+ default:
+ throw std::runtime_error("invalid type");
+ }
+
+ return noutput_items;
+}
+
+
+template class noise_source<std::int16_t>;
+template class noise_source<std::int32_t>;
+template class noise_source<float>;
+template class noise_source<gr_complex>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_impl.h
index cd7a3e1636..ddef4f25e9 100644
--- a/gr-analog/lib/noise_source_X_impl.h.t
+++ b/gr-analog/lib/noise_source_impl.h
@@ -20,26 +20,26 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef NOISE_SOURCE_IMPL_H
+#define NOISE_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/noise_source.h>
#include <gnuradio/random.h>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class noise_source_impl : public noise_source<T>
{
noise_type_t d_type;
float d_ampl;
gr::random d_rng;
public:
- @IMPL_NAME@(noise_type_t type, float ampl, long seed = 0);
- ~@IMPL_NAME@();
+ noise_source_impl(noise_type_t type, float ampl, long seed = 0);
+ ~noise_source_impl();
void set_type(noise_type_t type);
void set_amplitude(float ampl);
@@ -55,4 +55,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* NOISE_SOURCE_IMPL_H */
diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc
index 0cc3f8b8ec..bf8b219189 100644
--- a/gr-analog/lib/pll_carriertracking_cc_impl.cc
+++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2010-2013 Free Software Foundation, Inc.
+ * Copyright 2006,2010-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,16 +27,13 @@
#include "pll_carriertracking_cc_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/sincos.h>
-#include <math.h>
#include <gnuradio/math.h>
+#include <cmath>
+
namespace gr {
namespace analog {
-#ifndef M_TWOPI
-#define M_TWOPI (2.0f*M_PI)
-#endif
-
pll_carriertracking_cc::sptr
pll_carriertracking_cc::make(float loop_bw, float max_freq, float min_freq)
{
@@ -62,10 +59,10 @@ namespace gr {
float
pll_carriertracking_cc_impl::mod_2pi(float in)
{
- if(in>M_PI)
- return in-M_TWOPI;
- else if(in<-M_PI)
- return in+M_TWOPI;
+ if(in>GR_M_PI)
+ return in-GR_M_TWOPI;
+ else if(in<-GR_M_PI)
+ return in+GR_M_TWOPI;
else
return in;
}
diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc
index 42caa0bfd5..46c9a9f954 100644
--- a/gr-analog/lib/pll_freqdet_cf_impl.cc
+++ b/gr-analog/lib/pll_freqdet_cf_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2011 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2011,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,16 +26,13 @@
#include "pll_freqdet_cf_impl.h"
#include <gnuradio/io_signature.h>
-#include <math.h>
#include <gnuradio/math.h>
+#include <cmath>
+
namespace gr {
namespace analog {
-#ifndef M_TWOPI
-#define M_TWOPI (2.0f*M_PI)
-#endif
-
pll_freqdet_cf::sptr
pll_freqdet_cf::make(float loop_bw, float max_freq, float min_freq)
{
@@ -58,10 +55,10 @@ namespace gr {
float
pll_freqdet_cf_impl::mod_2pi(float in)
{
- if(in > M_PI)
- return in - M_TWOPI;
- else if(in < -M_PI)
- return in + M_TWOPI;
+ if(in > GR_M_PI)
+ return in - GR_M_TWOPI;
+ else if(in < -GR_M_PI)
+ return in + GR_M_TWOPI;
else
return in;
}
diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc
index 4822263a9c..4cf3574bc7 100644
--- a/gr-analog/lib/pll_refout_cc_impl.cc
+++ b/gr-analog/lib/pll_refout_cc_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010-2013 Free Software Foundation, Inc.
+ * Copyright 2004,2010-2013,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -33,10 +33,6 @@
namespace gr {
namespace analog {
-#ifndef M_TWOPI
-#define M_TWOPI (2.0f*M_PI)
-#endif
-
pll_refout_cc::sptr
pll_refout_cc::make(float loop_bw, float max_freq, float min_freq)
{
@@ -59,10 +55,10 @@ namespace gr {
float
pll_refout_cc_impl::mod_2pi(float in)
{
- if(in > M_PI)
- return in - M_TWOPI;
- else if(in < -M_PI)
- return in+ M_TWOPI;
+ if(in > GR_M_PI)
+ return in - GR_M_TWOPI;
+ else if(in < -GR_M_PI)
+ return in+ GR_M_TWOPI;
else
return in;
}
diff --git a/gr-analog/lib/random_uniform_source_X_impl.cc.t b/gr-analog/lib/random_uniform_source_X_impl.cc.t
deleted file mode 100644
index 98af5d02fa..0000000000
--- a/gr-analog/lib/random_uniform_source_X_impl.cc.t
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2015 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int minimum, int maximum, int seed)
- {
- return gnuradio::get_initial_sptr(new @IMPL_NAME@(minimum, maximum, seed));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(int minimum, int maximum, int seed)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@)))
- {
- d_rng = new gr::random(seed, minimum, maximum);
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- delete d_rng;
- }
-
- int
- @IMPL_NAME@::random_value()
- {
- return d_rng->ran_int();
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @TYPE@ *out = (@TYPE@*)output_items[0];
-
- for(int i = 0; i < noutput_items; i++){
- *out++ = (@TYPE@) random_value();
- }
-
- // Tell runtime system how many output items we produced.
- return noutput_items;
- }
-
-
-
-
-
-
-
-
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/random_uniform_source_impl.cc b/gr-analog/lib/random_uniform_source_impl.cc
new file mode 100644
index 0000000000..cf89cac1e3
--- /dev/null
+++ b/gr-analog/lib/random_uniform_source_impl.cc
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2015 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "random_uniform_source_impl.h"
+#include <gnuradio/io_signature.h>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename random_uniform_source<T>::sptr
+random_uniform_source<T>::make(int minimum, int maximum, int seed) {
+ return gnuradio::get_initial_sptr(new random_uniform_source_impl<T>(minimum, maximum, seed));
+}
+
+template <class T>
+random_uniform_source_impl<T>::random_uniform_source_impl(int minimum, int maximum, int seed)
+ : sync_block("random_uniform_source",
+ io_signature::make(0, 0, 0),
+ io_signature::make(1, 1, sizeof(T))) {
+ d_rng = new gr::random(seed, minimum, maximum);
+}
+
+template <class T>
+random_uniform_source_impl<T>::~random_uniform_source_impl() {
+ delete d_rng;
+}
+
+template <class T>
+int random_uniform_source_impl<T>::random_value() {
+ return d_rng->ran_int();
+}
+
+template <class T>
+int random_uniform_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ T* out = (T*)output_items[0];
+
+ for (int i = 0; i < noutput_items; i++) {
+ *out++ = (T)random_value();
+ }
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
+
+template class random_uniform_source<std::uint8_t>;
+template class random_uniform_source<std::int16_t>;
+template class random_uniform_source<std::int32_t>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/random_uniform_source_X_impl.h.t b/gr-analog/lib/random_uniform_source_impl.h
index 67fcfc9893..65e6c3ef64 100644
--- a/gr-analog/lib/random_uniform_source_X_impl.h.t
+++ b/gr-analog/lib/random_uniform_source_impl.h
@@ -20,25 +20,25 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RANDOM_UNIFORM_SOURCE_IMPL_H
+#define RANDOM_UNIFORM_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/random_uniform_source.h>
#include <gnuradio/random.h>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class random_uniform_source_impl : public random_uniform_source<T>
{
private:
gr::random *d_rng;
public:
- @IMPL_NAME@(int minimum, int maximum, int seed);
- ~@IMPL_NAME@();
+ random_uniform_source_impl(int minimum, int maximum, int seed);
+ ~random_uniform_source_impl();
// Where all the action really happens
int work(int noutput_items,
@@ -51,4 +51,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */ \ No newline at end of file
+#endif /* RANDOM_UNIFORM_SOURCE_IMPL_H */
diff --git a/gr-analog/lib/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t
deleted file mode 100644
index 017177eae0..0000000000
--- a/gr-analog/lib/sig_source_X_impl.cc.t
+++ /dev/null
@@ -1,286 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <algorithm>
-#include <gnuradio/io_signature.h>
-#include <stdexcept>
-#include <algorithm>
-#include <gnuradio/gr_complex.h>
-
-namespace gr {
- namespace analog {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(double sampling_freq, gr_waveform_t waveform,
- double frequency, double ampl, @TYPE@ offset)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(sampling_freq, waveform, frequency, ampl, offset));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(double sampling_freq, gr_waveform_t waveform,
- double frequency, double ampl, @TYPE@ offset)
- : sync_block("@BASE_NAME@",
- io_signature::make(0, 0, 0),
- io_signature::make(1, 1, sizeof(@TYPE@))),
- d_sampling_freq(sampling_freq), d_waveform(waveform),
- d_frequency(frequency), d_ampl(ampl), d_offset(offset)
- {
- set_frequency(frequency);
-
- message_port_register_in(pmt::mp("freq"));
- set_msg_handler(pmt::mp("freq"), boost::bind(&@IMPL_NAME@::set_frequency_msg, this, _1));
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::set_frequency_msg(pmt::pmt_t msg)
- {
- // Accepts either a number that is assumed to be the new
- // frequency or a key:value pair message where the key must be
- // "freq" and the value is the new frequency.
-
- if(pmt::is_number(msg)) {
- set_frequency(pmt::to_double(msg));
- }
- else if(pmt::is_pair(msg)) {
- pmt::pmt_t key = pmt::car(msg);
- pmt::pmt_t val = pmt::cdr(msg);
- if(pmt::eq(key, pmt::intern("freq"))) {
- if(pmt::is_number(val)) {
- set_frequency(pmt::to_double(val));
- }
- }
- else {
- GR_LOG_WARN(d_logger, boost::format("Set Frequency Message must have "
- "the key = 'freq'; got '%1%'.") \
- % pmt::write_string(key));
- }
- }
- else {
- GR_LOG_WARN(d_logger, "Set Frequency Message must be either a number or a "
- "key:value pair where the key is 'freq'.");
- }
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- @TYPE@ *optr = (@TYPE@*)output_items[0];
- @TYPE@ t;
-
- switch(d_waveform) {
-
-#if @IS_COMPLEX@ // complex?
-
- case GR_CONST_WAVE:
- t = (gr_complex) d_ampl + d_offset;
- std::fill_n(optr, noutput_items, t);
- break;
-
- case GR_SIN_WAVE:
- case GR_COS_WAVE:
- d_nco.sincos(optr, noutput_items, d_ampl);
- if(d_offset == gr_complex(0,0))
- break;
-
- for(int i = 0; i < noutput_items; i++) {
- optr[i] += d_offset;
- }
- break;
-
- /* Implements a real square wave high from -PI to 0.
- * The imaginary square wave leads by 90 deg.
- */
- case GR_SQR_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < -1*M_PI/2)
- optr[i] = gr_complex(d_ampl, 0) + d_offset;
- else if(d_nco.get_phase() < 0)
- optr[i] = gr_complex(d_ampl, d_ampl) + d_offset;
- else if(d_nco.get_phase() < M_PI/2)
- optr[i] = gr_complex(0, d_ampl) + d_offset;
- else
- optr[i] = d_offset;
- d_nco.step();
- }
- break;
-
- /* Implements a real triangle wave rising from -PI to 0 and
- * falling from 0 to PI. The imaginary triangle wave leads by
- * 90 deg.
- */
- case GR_TRI_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < -1*M_PI/2){
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
- -1*d_ampl*d_nco.get_phase()/M_PI - d_ampl/2) + d_offset;
- }
- else if(d_nco.get_phase() < 0) {
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
- d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset;
- }
- else if(d_nco.get_phase() < M_PI/2) {
- optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
- d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset;
- }
- else {
- optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
- -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2) + d_offset;
- }
- d_nco.step();
- }
- break;
-
- /* Implements a real saw tooth wave rising from -PI to PI.
- * The imaginary saw tooth wave leads by 90 deg.
- */
- case GR_SAW_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < -1*M_PI/2) {
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
- d_ampl*d_nco.get_phase()/(2*M_PI) + 5*d_ampl/4) + d_offset;
- }
- else {
- optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
- d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4) + d_offset;
- }
- d_nco.step();
- }
- break;
-
-#else // nope...
-
- case GR_CONST_WAVE:
- t = (@TYPE@)d_ampl + d_offset;
- std::fill_n(optr, noutput_items, t);
- break;
-
- case GR_SIN_WAVE:
- d_nco.sin(optr, noutput_items, d_ampl);
- if(d_offset == 0)
- break;
-
- for(int i = 0; i < noutput_items; i++) {
- optr[i] += d_offset;
- }
- break;
-
- case GR_COS_WAVE:
- d_nco.cos(optr, noutput_items, d_ampl);
- if(d_offset == 0)
- break;
-
- for(int i = 0; i < noutput_items; i++) {
- optr[i] += d_offset;
- }
- break;
-
- /* The square wave is high from -PI to 0. */
- case GR_SQR_WAVE:
- t = (@TYPE@)d_ampl + d_offset;
- for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < 0)
- optr[i] = t;
- else
- optr[i] = d_offset;
- d_nco.step();
- }
- break;
-
- /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */
- case GR_TRI_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- double t = d_ampl*d_nco.get_phase()/M_PI;
- if (d_nco.get_phase() < 0)
- optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset);
- else
- optr[i] = static_cast<@TYPE@>(-1*t + d_ampl + d_offset);
- d_nco.step();
- }
- break;
-
- /* The saw tooth wave rises from -PI to PI. */
- case GR_SAW_WAVE:
- for(int i = 0; i < noutput_items; i++) {
- t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*M_PI)
- + d_ampl/2 + d_offset);
- optr[i] = t;
- d_nco.step();
- }
- break;
-
-#endif
-
- default:
- throw std::runtime_error("analog::sig_source: invalid waveform");
- }
-
- return noutput_items;
- }
-
- void
- @NAME@::set_sampling_freq(double sampling_freq)
- {
- d_sampling_freq = sampling_freq;
- d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq);
- }
-
- void
- @NAME@::set_waveform(gr_waveform_t waveform)
- {
- d_waveform = waveform;
- }
-
- void
- @NAME@::set_frequency(double frequency)
- {
- d_frequency = frequency;
- d_nco.set_freq(2 * M_PI * d_frequency / d_sampling_freq);
- }
-
- void
- @NAME@::set_amplitude(double ampl)
- {
- d_ampl = ampl;
- }
-
- void
- @NAME@::set_offset(@TYPE@ offset)
- {
- d_offset = offset;
- }
-
- } /* namespace analog */
-} /* namespace gr */
diff --git a/gr-analog/lib/sig_source_impl.cc b/gr-analog/lib/sig_source_impl.cc
new file mode 100644
index 0000000000..0f7ced0eb2
--- /dev/null
+++ b/gr-analog/lib/sig_source_impl.cc
@@ -0,0 +1,287 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "sig_source_impl.h"
+#include <gnuradio/gr_complex.h>
+#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
+
+#include <algorithm>
+#include <stdexcept>
+
+namespace gr {
+namespace analog {
+
+template <class T>
+typename sig_source<T>::sptr sig_source<T>::make(
+ double sampling_freq, gr_waveform_t waveform, double frequency, double ampl, T offset) {
+ return gnuradio::get_initial_sptr(
+ new sig_source_impl<T>(sampling_freq, waveform, frequency, ampl, offset));
+}
+
+template <class T>
+sig_source_impl<T>::sig_source_impl(
+ double sampling_freq, gr_waveform_t waveform, double frequency, double ampl, T offset)
+ : sync_block("sig_source", io_signature::make(0, 0, 0), io_signature::make(1, 1, sizeof(T))),
+ d_sampling_freq(sampling_freq), d_waveform(waveform), d_frequency(frequency), d_ampl(ampl),
+ d_offset(offset) {
+ this->set_frequency(frequency);
+
+ this->message_port_register_in(pmt::mp("freq"));
+ this->set_msg_handler(pmt::mp("freq"), boost::bind(&sig_source_impl<T>::set_frequency_msg, this, _1));
+}
+
+template <class T>
+sig_source_impl<T>::~sig_source_impl() {}
+
+template <class T>
+void sig_source_impl<T>::set_frequency_msg(pmt::pmt_t msg) {
+ // Accepts either a number that is assumed to be the new
+ // frequency or a key:value pair message where the key must be
+ // "freq" and the value is the new frequency.
+
+ if (pmt::is_number(msg)) {
+ set_frequency(pmt::to_double(msg));
+ } else if (pmt::is_pair(msg)) {
+ pmt::pmt_t key = pmt::car(msg);
+ pmt::pmt_t val = pmt::cdr(msg);
+ if (pmt::eq(key, pmt::intern("freq"))) {
+ if (pmt::is_number(val)) {
+ set_frequency(pmt::to_double(val));
+ }
+ } else {
+ GR_LOG_WARN(this->d_logger,
+ boost::format("Set Frequency Message must have "
+ "the key = 'freq'; got '%1%'.") %
+ pmt::write_string(key));
+ }
+ } else {
+ GR_LOG_WARN(this->d_logger,
+ "Set Frequency Message must be either a number or a "
+ "key:value pair where the key is 'freq'.");
+ }
+}
+
+template <class T>
+int sig_source_impl<T>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ T* optr = (T*)output_items[0];
+ T t;
+
+ switch (d_waveform) {
+ case GR_CONST_WAVE:
+ t = (T)d_ampl + d_offset;
+ std::fill_n(optr, noutput_items, t);
+ break;
+
+ case GR_SIN_WAVE:
+ d_nco.sin(optr, noutput_items, d_ampl);
+ if (d_offset == 0)
+ break;
+
+ for (int i = 0; i < noutput_items; i++) {
+ optr[i] += d_offset;
+ }
+ break;
+
+ case GR_COS_WAVE:
+ d_nco.cos(optr, noutput_items, d_ampl);
+ if (d_offset == 0)
+ break;
+
+ for (int i = 0; i < noutput_items; i++) {
+ optr[i] += d_offset;
+ }
+ break;
+
+ /* The square wave is high from -PI to 0. */
+ case GR_SQR_WAVE:
+ t = (T)d_ampl + d_offset;
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < 0)
+ optr[i] = t;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ double t = d_ampl * d_nco.get_phase() / GR_M_PI;
+ if (d_nco.get_phase() < 0)
+ optr[i] = static_cast<T>(t + d_ampl + d_offset);
+ else
+ optr[i] = static_cast<T>(-1 * t + d_ampl + d_offset);
+ d_nco.step();
+ }
+ break;
+
+ /* The saw tooth wave rises from -PI to PI. */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ t = static_cast<T>(d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 2 + d_offset);
+ optr[i] = t;
+ d_nco.step();
+ }
+ break;
+ default:
+ throw std::runtime_error("analog::sig_source: invalid waveform");
+ }
+
+ return noutput_items;
+}
+
+
+template <>
+int sig_source_impl<gr_complex>::work(int noutput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) {
+ gr_complex* optr = (gr_complex*)output_items[0];
+ gr_complex t;
+
+ switch (d_waveform) {
+ case GR_CONST_WAVE:
+ t = (gr_complex)d_ampl + d_offset;
+ std::fill_n(optr, noutput_items, t);
+ break;
+
+ case GR_SIN_WAVE:
+ case GR_COS_WAVE:
+ d_nco.sincos(optr, noutput_items, d_ampl);
+ if (d_offset == gr_complex(0, 0))
+ break;
+
+ for (int i = 0; i < noutput_items; i++) {
+ optr[i] += d_offset;
+ }
+ break;
+
+ /* Implements a real square wave high from -PI to 0.
+ * The imaginary square wave leads by 90 deg.
+ */
+ case GR_SQR_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < -1 * GR_M_PI / 2)
+ optr[i] = gr_complex(d_ampl, 0) + d_offset;
+ else if (d_nco.get_phase() < 0)
+ optr[i] = gr_complex(d_ampl, d_ampl) + d_offset;
+ else if (d_nco.get_phase() < GR_M_PI / 2)
+ optr[i] = gr_complex(0, d_ampl) + d_offset;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real triangle wave rising from -PI to 0 and
+ * falling from 0 to PI. The imaginary triangle wave leads by
+ * 90 deg.
+ */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < -1 * GR_M_PI / 2) {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ -1 * d_ampl * d_nco.get_phase() / GR_M_PI - d_ampl / 2) +
+ d_offset;
+ } else if (d_nco.get_phase() < 0) {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl / 2) +
+ d_offset;
+ } else if (d_nco.get_phase() < GR_M_PI / 2) {
+ optr[i] = gr_complex(-1 * d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl / 2) +
+ d_offset;
+ } else {
+ optr[i] = gr_complex(-1 * d_ampl * d_nco.get_phase() / GR_M_PI + d_ampl,
+ -1 * d_ampl * d_nco.get_phase() / GR_M_PI + 3 * d_ampl / 2) +
+ d_offset;
+ }
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real saw tooth wave rising from -PI to PI.
+ * The imaginary saw tooth wave leads by 90 deg.
+ */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++) {
+ if (d_nco.get_phase() < -1 * GR_M_PI / 2) {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 2,
+ d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + 5 * d_ampl / 4) +
+ d_offset;
+ } else {
+ optr[i] = gr_complex(d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 2,
+ d_ampl * d_nco.get_phase() / (2 * GR_M_PI) + d_ampl / 4) +
+ d_offset;
+ }
+ d_nco.step();
+ }
+ break;
+ default:
+ throw std::runtime_error("analog::sig_source: invalid waveform");
+ }
+
+ return noutput_items;
+}
+
+
+template <class T>
+void sig_source_impl<T>::set_sampling_freq(double sampling_freq) {
+ d_sampling_freq = sampling_freq;
+ d_nco.set_freq(2 * GR_M_PI * this->d_frequency / this->d_sampling_freq);
+}
+
+template <class T>
+void sig_source_impl<T>::set_waveform(gr_waveform_t waveform) {
+ d_waveform = waveform;
+}
+
+template <class T>
+void sig_source_impl<T>::set_frequency(double frequency) {
+ d_frequency = frequency;
+ d_nco.set_freq(2 * GR_M_PI * this->d_frequency / this->d_sampling_freq);
+}
+
+template <class T>
+void sig_source_impl<T>::set_amplitude(double ampl) {
+ d_ampl = ampl;
+}
+
+template <class T>
+void sig_source_impl<T>::set_offset(T offset) {
+ d_offset = offset;
+}
+
+template class sig_source<std::int16_t>;
+template class sig_source<std::int32_t>;
+template class sig_source<float>;
+template class sig_source<gr_complex>;
+} /* namespace analog */
+} /* namespace gr */
diff --git a/gr-analog/lib/sig_source_X_impl.h.t b/gr-analog/lib/sig_source_impl.h
index f5dfd5c4f6..9fd26582fa 100644
--- a/gr-analog/lib/sig_source_X_impl.h.t
+++ b/gr-analog/lib/sig_source_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,32 +20,32 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SIG_SOURCE_IMPL_H
+#define SIG_SOURCE_IMPL_H
-#include <gnuradio/analog/@BASE_NAME@.h>
+#include <gnuradio/analog/sig_source.h>
#include <gnuradio/sync_block.h>
#include <gnuradio/fxpt_nco.h>
namespace gr {
namespace analog {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class sig_source_impl : public sig_source<T>
{
private:
double d_sampling_freq;
gr_waveform_t d_waveform;
double d_frequency;
double d_ampl;
- @TYPE@ d_offset;
+ T d_offset;
gr::fxpt_nco d_nco;
public:
- @IMPL_NAME@(double sampling_freq, gr_waveform_t waveform,
- double wave_freq, double ampl, @TYPE@ offset = 0);
- ~@IMPL_NAME@();
+ sig_source_impl(double sampling_freq, gr_waveform_t waveform,
+ double wave_freq, double ampl, T offset = 0);
+ ~sig_source_impl();
virtual int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -55,17 +55,17 @@ namespace gr {
gr_waveform_t waveform() const { return d_waveform; }
double frequency() const { return d_frequency; }
double amplitude() const { return d_ampl; }
- @TYPE@ offset() const { return d_offset; }
+ T offset() const { return d_offset; }
void set_sampling_freq(double sampling_freq);
void set_waveform(gr_waveform_t waveform);
void set_frequency_msg(pmt::pmt_t msg);
void set_frequency(double frequency);
void set_amplitude(double ampl);
- void set_offset(@TYPE@ offset);
+ void set_offset(T offset);
};
} /* namespace analog */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SIG_SOURCE_IMPL_H */
diff --git a/gr-analog/lib/squelch_base_cc_impl.cc b/gr-analog/lib/squelch_base_cc_impl.cc
index b5c153558b..0873d81acc 100644
--- a/gr-analog/lib/squelch_base_cc_impl.cc
+++ b/gr-analog/lib/squelch_base_cc_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,6 +26,7 @@
#include "squelch_base_cc_impl.h"
#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
namespace gr {
namespace analog {
@@ -120,7 +121,7 @@ namespace gr {
break;
case ST_ATTACK:
- d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+ d_envelope = 0.5-std::cos(GR_M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
if(d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere
d_state = ST_UNMUTED;
d_tag_next_unmuted = true;
@@ -129,7 +130,7 @@ namespace gr {
break;
case ST_DECAY:
- d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
+ d_envelope = 0.5-std::cos(GR_M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
if(d_ramped == 0.0) {
d_state = ST_MUTED;
add_item_tag(0, nitems_written(0) + j, d_eob_key, pmt::PMT_NIL);
diff --git a/gr-analog/lib/squelch_base_ff_impl.cc b/gr-analog/lib/squelch_base_ff_impl.cc
index ea2d29bd97..2f164be363 100644
--- a/gr-analog/lib/squelch_base_ff_impl.cc
+++ b/gr-analog/lib/squelch_base_ff_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,6 +26,7 @@
#include "squelch_base_ff_impl.h"
#include <gnuradio/io_signature.h>
+#include <gnuradio/math.h>
#include <pmt/pmt.h>
namespace gr {
@@ -120,7 +121,7 @@ namespace gr {
case ST_ATTACK:
// FIXME: precalculate window for speed
- d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0;
+ d_envelope = 0.5-std::cos(GR_M_PI*(++d_ramped)/d_ramp)/2.0;
// use >= in case d_ramp is set to lower value elsewhere
if(d_ramped >= d_ramp) {
@@ -132,7 +133,7 @@ namespace gr {
case ST_DECAY:
// FIXME: precalculate window for speed
- d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0;
+ d_envelope = 0.5-std::cos(GR_M_PI*(--d_ramped)/d_ramp)/2.0;
if(d_ramped == 0.0) {
d_state = ST_MUTED;
add_item_tag(0, nitems_written(0) + j, d_eob_key, pmt::PMT_NIL);
diff --git a/gr-analog/python/analog/CMakeLists.txt b/gr-analog/python/analog/CMakeLists.txt
index c885f24524..4c5d24f4c4 100644
--- a/gr-analog/python/analog/CMakeLists.txt
+++ b/gr-analog/python/analog/CMakeLists.txt
@@ -36,7 +36,6 @@ GR_PYTHON_INSTALL(
wfm_rcv_pll.py
wfm_tx.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/analog
- COMPONENT "analog_python"
)
########################################################################
@@ -59,7 +58,7 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-analog/python/analog/__init__.py b/gr-analog/python/analog/__init__.py
index 3c4a0ff624..79c19e1e3e 100644
--- a/gr-analog/python/analog/__init__.py
+++ b/gr-analog/python/analog/__init__.py
@@ -21,24 +21,26 @@
'''
Blocks and utilities for analog modulation and demodulation.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
# The presence of this file turns this directory into a Python package
import os
try:
- from analog_swig import *
+ from .analog_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from analog_swig import *
+ from .analog_swig import *
-from am_demod import *
-from fm_demod import *
-from fm_emph import *
-from nbfm_rx import *
-from nbfm_tx import *
-from standard_squelch import *
-from wfm_rcv import *
-from wfm_rcv_fmdet import *
-from wfm_rcv_pll import *
-from wfm_tx import *
+from .am_demod import *
+from .fm_demod import *
+from .fm_emph import *
+from .nbfm_rx import *
+from .nbfm_tx import *
+from .standard_squelch import *
+from .wfm_rcv import *
+from .wfm_rcv_fmdet import *
+from .wfm_rcv_pll import *
+from .wfm_tx import *
diff --git a/gr-analog/python/analog/am_demod.py b/gr-analog/python/analog/am_demod.py
index 3459e825f4..eeb8964f34 100644
--- a/gr-analog/python/analog/am_demod.py
+++ b/gr-analog/python/analog/am_demod.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2006,2007,2012 Free Software Foundation, Inc.
#
@@ -39,22 +40,22 @@ class am_demod_cf(gr.hier_block2):
audio_stop: audio low pass filter stop frequency (float)
"""
def __init__(self, channel_rate, audio_decim, audio_pass, audio_stop):
- gr.hier_block2.__init__(self, "am_demod_cf",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Input signature
+ gr.hier_block2.__init__(self, "am_demod_cf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Input signature
- MAG = blocks.complex_to_mag()
- DCR = blocks.add_const_ff(-1.0)
+ MAG = blocks.complex_to_mag()
+ DCR = blocks.add_const_ff(-1.0)
- audio_taps = filter.optfir.low_pass(0.5, # Filter gain
+ audio_taps = filter.optfir.low_pass(0.5, # Filter gain
channel_rate, # Sample rate
audio_pass, # Audio passband
audio_stop, # Audio stopband
- 0.1, # Passband ripple
- 60) # Stopband attenuation
- LPF = filter.fir_filter_fff(audio_decim, audio_taps)
+ 0.1, # Passband ripple
+ 60) # Stopband attenuation
+ LPF = filter.fir_filter_fff(audio_decim, audio_taps)
- self.connect(self, MAG, DCR, LPF, self)
+ self.connect(self, MAG, DCR, LPF, self)
class demod_10k0a3e_cf(am_demod_cf):
"""
@@ -68,6 +69,6 @@ class demod_10k0a3e_cf(am_demod_cf):
audio_decim: input to output decimation rate (integer)
"""
def __init__(self, channel_rate, audio_decim):
- am_demod_cf.__init__(self, channel_rate, audio_decim,
- 5000, # Audio passband
- 5500) # Audio stopband
+ am_demod_cf.__init__(self, channel_rate, audio_decim,
+ 5000, # Audio passband
+ 5500) # Audio stopband
diff --git a/gr-analog/python/analog/fm_demod.py b/gr-analog/python/analog/fm_demod.py
index 4e3c01d194..1344db831c 100644
--- a/gr-analog/python/analog/fm_demod.py
+++ b/gr-analog/python/analog/fm_demod.py
@@ -19,14 +19,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, filter
-from fm_emph import fm_deemph
+from .fm_emph import fm_deemph
from math import pi
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
class fm_demod_cf(gr.hier_block2):
@@ -54,7 +55,7 @@ class fm_demod_cf(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
- k = channel_rate/(2*pi*deviation)
+ k = channel_rate / (2*pi*deviation)
QUAD = analog.quadrature_demod_cf(k)
audio_taps = filter.optfir.low_pass(
diff --git a/gr-analog/python/analog/fm_emph.py b/gr-analog/python/analog/fm_emph.py
index 348fb172d5..02bdd576ee 100644
--- a/gr-analog/python/analog/fm_emph.py
+++ b/gr-analog/python/analog/fm_emph.py
@@ -19,6 +19,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, filter
import math
import cmath
@@ -132,8 +136,8 @@ class fm_deemph(gr.hier_block2):
# Since H(s = 0) = 1.0, then H(z = 1) = 1.0 and has 0 dB gain at DC
if 0:
- print "btaps =", btaps
- print "ataps =", ataps
+ print("btaps =", btaps)
+ print("ataps =", ataps)
global plot1
plot1 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True)
@@ -149,11 +153,11 @@ class fm_deemph(gr.hier_block2):
# o------+ +-----+--------o
# | R1 | |
# +----/\/\/\/--+ \
-# /
+ # /
# \ R2
# /
# \
-# |
+ # |
# o--------------------------+--------o
#
# (This fine ASCII rendition is based on Figure 5-15
@@ -263,44 +267,43 @@ class fm_preemph(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_float), # Input signature
gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
- # Set fh to something sensible, if needed.
- # N.B. fh == fs/2.0 or fh == 0.0 results in a pole on the unit circle
- # at z = -1.0 or z = 1.0 respectively. That makes the filter unstable
- # and useless.
- if fh <= 0.0 or fh >= fs/2.0:
- fh = 0.925 * fs/2.0
+ # Set fh to something sensible, if needed.
+ # N.B. fh == fs/2.0 or fh == 0.0 results in a pole on the unit circle
+ # at z = -1.0 or z = 1.0 respectively. That makes the filter unstable
+ # and useless.
+ if fh <= 0.0 or fh >= fs / 2.0:
+ fh = 0.925 * fs/2.0
- # Digital corner frequencies
- w_cl = 1.0 / tau
- w_ch = 2.0 * math.pi * fh
+ # Digital corner frequencies
+ w_cl = 1.0 / tau
+ w_ch = 2.0 * math.pi * fh
- # Prewarped analog corner frequencies
- w_cla = 2.0 * fs * math.tan(w_cl / (2.0 * fs))
- w_cha = 2.0 * fs * math.tan(w_ch / (2.0 * fs))
+ # Prewarped analog corner frequencies
+ w_cla = 2.0 * fs * math.tan(w_cl / (2.0 * fs))
+ w_cha = 2.0 * fs * math.tan(w_ch / (2.0 * fs))
- # Resulting digital pole, zero, and gain term from the bilinear
- # transformation of H(s) = (s + w_cla) / (s + w_cha) to
- # H(z) = b0 (1 - z1 z^-1)/(1 - p1 z^-1)
- kl = -w_cla / (2.0 * fs)
- kh = -w_cha / (2.0 * fs)
- z1 = (1.0 + kl) / (1.0 - kl)
- p1 = (1.0 + kh) / (1.0 - kh)
- b0 = (1.0 - kl) / (1.0 - kh)
+ # Resulting digital pole, zero, and gain term from the bilinear
+ # transformation of H(s) = (s + w_cla) / (s + w_cha) to
+ # H(z) = b0 (1 - z1 z^-1)/(1 - p1 z^-1)
+ kl = -w_cla / (2.0 * fs)
+ kh = -w_cha / (2.0 * fs)
+ z1 = (1.0 + kl) / (1.0 - kl)
+ p1 = (1.0 + kh) / (1.0 - kh)
+ b0 = (1.0 - kl) / (1.0 - kh)
- # Since H(s = infinity) = 1.0, then H(z = -1) = 1.0 and
- # this filter has 0 dB gain at fs/2.0.
- # That isn't what users are going to expect, so adjust with a
- # gain, g, so that H(z = 1) = 1.0 for 0 dB gain at DC.
- w_0dB = 2.0 * math.pi * 0.0
- g = abs(1.0 - p1 * cmath.rect(1.0, -w_0dB)) \
- / (b0 * abs(1.0 - z1 * cmath.rect(1.0, -w_0dB)))
+ # Since H(s = infinity) = 1.0, then H(z = -1) = 1.0 and
+ # this filter has 0 dB gain at fs/2.0.
+ # That isn't what users are going to expect, so adjust with a
+ # gain, g, so that H(z = 1) = 1.0 for 0 dB gain at DC.
+ w_0dB = 2.0 * math.pi * 0.0
+ g = abs(1.0 - p1 * cmath.rect(1.0 / -w_0dB), (b0 * abs(1.0 - z1 * cmath.rect(1.0, -w_0dB))))
- btaps = [ g * b0 * 1.0, g * b0 * -z1 ]
- ataps = [ 1.0, -p1 ]
+ btaps = [ g * b0 * 1.0, g * b0 * -z1 ]
+ ataps = [ 1.0, -p1 ]
if 0:
- print "btaps =", btaps
- print "ataps =", ataps
+ print("btaps =", btaps)
+ print("ataps =", ataps)
global plot2
plot2 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True)
diff --git a/gr-analog/python/analog/nbfm_rx.py b/gr-analog/python/analog/nbfm_rx.py
index 38fbf803c8..3e8dcd5287 100644
--- a/gr-analog/python/analog/nbfm_rx.py
+++ b/gr-analog/python/analog/nbfm_rx.py
@@ -19,15 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+
from gnuradio import gr
from gnuradio import filter
-from fm_emph import fm_deemph
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class nbfm_rx(gr.hier_block2):
def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
@@ -52,22 +56,22 @@ class nbfm_rx(gr.hier_block2):
audio_filter
"""
- gr.hier_block2.__init__(self, "nbfm_rx",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "nbfm_rx",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
self._audio_rate = audio_rate = int(audio_rate)
self._quad_rate = quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
- raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+ raise ValueError("quad_rate is not an integer multiple of audio_rate")
- squelch_threshold = 20 # dB
+ squelch_threshold = 20 # dB
#self.squelch = analog.simple_squelch_cc(squelch_threshold, 0.001)
# FM Demodulator input: complex; output: float
- k = quad_rate/(2*math.pi*max_dev)
+ k = quad_rate / (2*math.pi*max_dev)
self.quad_demod = analog.quadrature_demod_cf(k)
# FM Deemphasis IIR filter
@@ -81,7 +85,7 @@ class nbfm_rx(gr.hier_block2):
0.5e3, # Transition band
filter.firdes.WIN_HAMMING) # filter type
- print "len(audio_taps) =", len(audio_taps)
+ print("len(audio_taps) =", len(audio_taps))
# Decimating audio filter
# input: float; output: float; taps: float
@@ -90,5 +94,5 @@ class nbfm_rx(gr.hier_block2):
self.connect(self, self.quad_demod, self.deemph, self.audio_filter, self)
def set_max_deviation(self, max_dev):
- k = self._quad_rate/(2*math.pi*max_dev)
+ k = self._quad_rate / (2*math.pi*max_dev)
self.quad_demod.set_gain(k)
diff --git a/gr-analog/python/analog/nbfm_tx.py b/gr-analog/python/analog/nbfm_tx.py
index aa6c1eccc7..a7620451eb 100644
--- a/gr-analog/python/analog/nbfm_tx.py
+++ b/gr-analog/python/analog/nbfm_tx.py
@@ -19,14 +19,18 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+
from gnuradio import gr, filter
-from fm_emph import fm_preemph
+from .fm_emph import fm_preemph
+
+from . import analog_swig as analog
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
class nbfm_tx(gr.hier_block2):
def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3, fh=-1.0):
@@ -46,16 +50,16 @@ class nbfm_tx(gr.hier_block2):
quad_rate must be an integer multiple of audio_rate.
"""
- gr.hier_block2.__init__(self, "nbfm_tx",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "nbfm_tx",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
self._audio_rate = audio_rate = int(audio_rate)
self._quad_rate = quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
- raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+ raise ValueError("quad_rate is not an integer multiple of audio_rate")
do_interp = audio_rate != quad_rate
@@ -66,10 +70,10 @@ class nbfm_tx(gr.hier_block2):
quad_rate, # Fs
4500, # passband cutoff
7000, # stopband cutoff
- 0.1, # passband ripple dB
+ 0.1, # passband ripple dB
40) # stopband atten dB
- #print "len(interp_taps) =", len(interp_taps)
+ #print("len(interp_taps) =", len(interp_taps))
self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps)
self.preemph = fm_preemph(quad_rate, tau=tau, fh=fh)
@@ -90,10 +94,10 @@ class nbfm_tx(gr.hier_block2):
class ctcss_gen_f(gr.hier_block2):
def __init__(self, sample_rate, tone_freq):
- gr.hier_block2.__init__(self, "ctcss_gen_f",
- gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "ctcss_gen_f",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
self.plgen = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE,
tone_freq, 0.1, 0.0)
- self.connect(self.plgen, self)
+ self.connect(self.plgen, self)
diff --git a/gr-analog/python/analog/qa_agc.py b/gr-analog/python/analog/qa_agc.py
index 70c9ba578c..bac661f8b2 100755..100644
--- a/gr-analog/python/analog/qa_agc.py
+++ b/gr-analog/python/analog/qa_agc.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_agc(gr_unittest.TestCase):
@@ -33,10 +34,10 @@ class test_agc(gr_unittest.TestCase):
def test_001_sets(self):
agc = analog.agc_cc(1e-3, 1, 1)
- agc.set_rate(1)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_rate(1)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.rate(), 1)
self.assertAlmostEqual(agc.reference(), 1.1)
@@ -118,10 +119,10 @@ class test_agc(gr_unittest.TestCase):
def test_002_sets(self):
agc = analog.agc_ff(1e-3, 1, 1)
- agc.set_rate(1)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_rate(1)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.rate(), 1)
self.assertAlmostEqual(agc.reference(), 1.1)
@@ -203,11 +204,11 @@ class test_agc(gr_unittest.TestCase):
def test_003_sets(self):
agc = analog.agc2_cc(1e-3, 1e-1, 1, 1)
- agc.set_attack_rate(1)
- agc.set_decay_rate(2)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_attack_rate(1)
+ agc.set_decay_rate(2)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.attack_rate(), 1)
self.assertAlmostEqual(agc.decay_rate(), 2)
@@ -290,11 +291,11 @@ class test_agc(gr_unittest.TestCase):
def test_004_sets(self):
agc = analog.agc2_ff(1e-3, 1e-1, 1, 1)
- agc.set_attack_rate(1)
- agc.set_decay_rate(2)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_attack_rate(1)
+ agc.set_decay_rate(2)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.attack_rate(), 1)
self.assertAlmostEqual(agc.decay_rate(), 2)
@@ -450,10 +451,10 @@ class test_agc(gr_unittest.TestCase):
def test_006_sets(self):
agc = analog.agc3_cc(1e-3, 1e-1, 1)
- agc.set_attack_rate(1)
- agc.set_decay_rate(2)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
+ agc.set_attack_rate(1)
+ agc.set_decay_rate(2)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
self.assertAlmostEqual(agc.attack_rate(), 1)
self.assertAlmostEqual(agc.decay_rate(), 2)
@@ -481,7 +482,7 @@ class test_agc(gr_unittest.TestCase):
tb.run()
dst_data = dst1.data()
M = 100
- result = map(lambda x: abs(x), dst_data[N-M:])
+ result = [abs(x) for x in dst_data[N-M:]]
self.assertFloatTuplesAlmostEqual(result, M*[ref,], 4)
def test_100(self):
diff --git a/gr-analog/python/analog/qa_cpfsk.py b/gr-analog/python/analog/qa_cpfsk.py
index be2e0a9b7e..ef8ea0cb3f 100755..100644
--- a/gr-analog/python/analog/qa_cpfsk.py
+++ b/gr-analog/python/analog/qa_cpfsk.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -50,7 +51,7 @@ class test_cpfsk_bc(gr_unittest.TestCase):
def test_cpfsk_bc_002(self):
src_data = 10*[0, 1]
- expected_result = map(lambda x: complex(2*x-1,0), src_data)
+ expected_result = [complex(2*x-1,0) for x in src_data]
src = blocks.vector_source_b(src_data)
op = analog.cpfsk_bc(2, 1, 2)
diff --git a/gr-analog/python/analog/qa_ctcss_squelch.py b/gr-analog/python/analog/qa_ctcss_squelch.py
index 3be1e9de3b..f3db194f5d 100755..100644
--- a/gr-analog/python/analog/qa_ctcss_squelch.py
+++ b/gr-analog/python/analog/qa_ctcss_squelch.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_ctcss_squelch(gr_unittest.TestCase):
@@ -63,7 +65,7 @@ class test_ctcss_squelch(gr_unittest.TestCase):
ramp = 1
gate = True
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
expected_result = src_data
expected_result[0] = 0
@@ -88,7 +90,7 @@ class test_ctcss_squelch(gr_unittest.TestCase):
ramp = 1
gate = False
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_f(src_data)
op = analog.ctcss_squelch_ff(rate, freq, level,
length, ramp, gate)
diff --git a/gr-analog/python/analog/qa_dpll.py b/gr-analog/python/analog/qa_dpll.py
index 3ae8a3684b..2d215e3d9d 100755..100644
--- a/gr-analog/python/analog/qa_dpll.py
+++ b/gr-analog/python/analog/qa_dpll.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_dpll_bb(gr_unittest.TestCase):
@@ -42,7 +44,7 @@ class test_dpll_bb(gr_unittest.TestCase):
self.assertAlmostEqual(g, 0.2)
f = op.freq()
- self.assertEqual(1/period, f)
+ self.assertEqual(1 / period, f)
d0 = 1.0 - 0.5*f;
d1 = op.decision_threshold()
diff --git a/gr-analog/python/analog/qa_fmdet.py b/gr-analog/python/analog/qa_fmdet.py
index a9c88c3b95..77ad213411 100755..100644
--- a/gr-analog/python/analog/qa_fmdet.py
+++ b/gr-analog/python/analog/qa_fmdet.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_fmdet_cf(gr_unittest.TestCase):
diff --git a/gr-analog/python/analog/qa_frequency_modulator.py b/gr-analog/python/analog/qa_frequency_modulator.py
index 0f5c45b11a..29282b0ea6 100755..100644
--- a/gr-analog/python/analog/qa_frequency_modulator.py
+++ b/gr-analog/python/analog/qa_frequency_modulator.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -38,9 +40,9 @@ class test_frequency_modulator(gr_unittest.TestCase):
def test_fm_001(self):
pi = math.pi
- sensitivity = pi/4
- src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0)
- running_sum = (pi/16, 3*pi/16, pi/4, 3*pi/16, pi/16, 0)
+ sensitivity = pi / 4
+ src_data = (1.0 / 4, 1.0 / 2, 1.0 / 4, -1.0 / 4, -1.0 / 2, -1 / 4.0)
+ running_sum = (pi / 16, 3*pi/16, pi / 4, 3*pi/16, pi / 16, 0)
expected_result = tuple([sincos(x) for x in running_sum])
src = blocks.vector_source_f(src_data)
op = analog.frequency_modulator_fc(sensitivity)
diff --git a/gr-analog/python/analog/qa_noise.py b/gr-analog/python/analog/qa_noise.py
index 5576773f23..cf2e9e607f 100755..100644
--- a/gr-analog/python/analog/qa_noise.py
+++ b/gr-analog/python/analog/qa_noise.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog
class test_noise_source(gr_unittest.TestCase):
diff --git a/gr-analog/python/analog/qa_phase_modulator.py b/gr-analog/python/analog/qa_phase_modulator.py
index c6223e5cd4..7f7d57fa75 100755..100644
--- a/gr-analog/python/analog/qa_phase_modulator.py
+++ b/gr-analog/python/analog/qa_phase_modulator.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -38,8 +40,8 @@ class test_phase_modulator(gr_unittest.TestCase):
def test_fm_001(self):
pi = math.pi
- sensitivity = pi/4
- src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0)
+ sensitivity = pi / 4
+ src_data = (1.0 / 4, 1.0 / 2, 1.0 / 4, -1.0 / 4, -1.0 / 2, -1 / 4.0)
expected_result = tuple([sincos(sensitivity*x) for x in src_data])
src = blocks.vector_source_f(src_data)
diff --git a/gr-analog/python/analog/qa_pll_carriertracking.py b/gr-analog/python/analog/qa_pll_carriertracking.py
index 10ad414644..56bb14d2cb 100755..100644
--- a/gr-analog/python/analog/qa_pll_carriertracking.py
+++ b/gr-analog/python/analog/qa_pll_carriertracking.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -137,7 +139,7 @@ class test_pll_carriertracking(gr_unittest.TestCase):
sampling_freq = 10e3
freq = sampling_freq / 100
- loop_bw = math.pi/100.0
+ loop_bw = math.pi / 100.0
maxf = 1
minf = -1
diff --git a/gr-analog/python/analog/qa_pll_freqdet.py b/gr-analog/python/analog/qa_pll_freqdet.py
index c7a8aa8363..2006dd7360 100755..100644
--- a/gr-analog/python/analog/qa_pll_freqdet.py
+++ b/gr-analog/python/analog/qa_pll_freqdet.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -137,7 +139,7 @@ class test_pll_freqdet(gr_unittest.TestCase):
sampling_freq = 10e3
freq = sampling_freq / 100
- loop_bw = math.pi/100.0
+ loop_bw = math.pi / 100.0
maxf = 1
minf = -1
@@ -153,7 +155,7 @@ class test_pll_freqdet(gr_unittest.TestCase):
dst_data = dst.data()
# convert it from normalized frequency to absolute frequency (Hz)
- dst_data = [i*(sampling_freq/(2*math.pi)) for i in dst_data]
+ dst_data = [i*(sampling_freq / (2*math.pi)) for i in dst_data]
self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 3)
diff --git a/gr-analog/python/analog/qa_pll_refout.py b/gr-analog/python/analog/qa_pll_refout.py
index 835b6a4522..ac1139cc03 100755..100644
--- a/gr-analog/python/analog/qa_pll_refout.py
+++ b/gr-analog/python/analog/qa_pll_refout.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -137,7 +139,7 @@ class test_pll_refout(gr_unittest.TestCase):
sampling_freq = 10e3
freq = sampling_freq / 100
- loop_bw = math.pi/100.0
+ loop_bw = math.pi / 100.0
maxf = 1
minf = -1
diff --git a/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py b/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
index a52c0806e3..68652eb364 100755..100644
--- a/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
+++ b/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
diff --git a/gr-analog/python/analog/qa_pwr_squelch.py b/gr-analog/python/analog/qa_pwr_squelch.py
index 561ca79a7c..9f84a61402 100755..100644
--- a/gr-analog/python/analog/qa_pwr_squelch.py
+++ b/gr-analog/python/analog/qa_pwr_squelch.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_pwr_squelch(gr_unittest.TestCase):
@@ -61,7 +63,7 @@ class test_pwr_squelch(gr_unittest.TestCase):
alpha = 0.0001
thr = -25
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_c(src_data)
op = analog.pwr_squelch_cc(thr, alpha)
dst = blocks.vector_sink_c()
@@ -107,7 +109,7 @@ class test_pwr_squelch(gr_unittest.TestCase):
alpha = 0.0001
thr = -25
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_f(src_data)
op = analog.pwr_squelch_ff(thr, alpha)
dst = blocks.vector_sink_f()
diff --git a/gr-analog/python/analog/qa_quadrature_demod.py b/gr-analog/python/analog/qa_quadrature_demod.py
index 08f3f4600e..e3a513b9ab 100755..100644
--- a/gr-analog/python/analog/qa_quadrature_demod.py
+++ b/gr-analog/python/analog/qa_quadrature_demod.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import cmath
from gnuradio import gr, gr_unittest, analog, blocks
@@ -37,13 +39,13 @@ class test_quadrature_demod(gr_unittest.TestCase):
fs = 8000.0
src_data = []
- for i in xrange(200):
- ti = i/fs
+ for i in range(200):
+ ti = i / fs
src_data.append(cmath.exp(2j*cmath.pi*f*ti))
# f/fs is a quarter turn per sample.
# Set the gain based on this to get 1 out.
- gain = 1.0/(cmath.pi/4)
+ gain = 1.0 / (cmath.pi / 4)
expected_result = [0,] + 199*[1.0]
diff --git a/gr-analog/python/analog/qa_rail_ff.py b/gr-analog/python/analog/qa_rail_ff.py
index e3990dfd3a..93cde00a97 100755..100644
--- a/gr-analog/python/analog/qa_rail_ff.py
+++ b/gr-analog/python/analog/qa_rail_ff.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks
def clip(x, lo, hi):
@@ -60,7 +61,7 @@ class test_rail(gr_unittest.TestCase):
lo = -0.75
hi = 0.90
src_data = [-2, -1, -0.5, -0.25, 0, 0.25, 0.5, 1, 2]
- expected_result = map(lambda x: clip(x, lo, hi), src_data)
+ expected_result = [clip(x, lo, hi) for x in src_data]
src = blocks.vector_source_f(src_data)
op = analog.rail_ff(lo, hi)
diff --git a/gr-analog/python/analog/qa_random_uniform_source.py b/gr-analog/python/analog/qa_random_uniform_source.py
index 474c5716c7..d02ea7ea87 100755..100644
--- a/gr-analog/python/analog/qa_random_uniform_source.py
+++ b/gr-analog/python/analog/qa_random_uniform_source.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
from gnuradio import blocks, analog
import numpy as np
diff --git a/gr-analog/python/analog/qa_sig_source.py b/gr-analog/python/analog/qa_sig_source.py
index a795c66605..8b239fc070 100755..100644
--- a/gr-analog/python/analog/qa_sig_source.py
+++ b/gr-analog/python/analog/qa_sig_source.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
import pmt
from gnuradio import gr, gr_unittest, analog, blocks
diff --git a/gr-analog/python/analog/qa_simple_squelch.py b/gr-analog/python/analog/qa_simple_squelch.py
index b09a3b2a87..a0b09e7198 100755..100644
--- a/gr-analog/python/analog/qa_simple_squelch.py
+++ b/gr-analog/python/analog/qa_simple_squelch.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_simple_squelch(gr_unittest.TestCase):
@@ -48,7 +50,7 @@ class test_simple_squelch(gr_unittest.TestCase):
alpha = 0.0001
thr = -25
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_c(src_data)
op = analog.simple_squelch_cc(thr, alpha)
dst = blocks.vector_sink_c()
diff --git a/gr-analog/python/analog/standard_squelch.py b/gr-analog/python/analog/standard_squelch.py
index 3ed9ebceaa..9609f2449e 100644
--- a/gr-analog/python/analog/standard_squelch.py
+++ b/gr-analog/python/analog/standard_squelch.py
@@ -1,3 +1,5 @@
+from __future__ import division
+from __future__ import unicode_literals
#
# Copyright 2005,2007,2012 Free Software Foundation, Inc.
#
@@ -26,29 +28,29 @@ from gnuradio import filter
class standard_squelch(gr.hier_block2):
def __init__(self, audio_rate):
- gr.hier_block2.__init__(self, "standard_squelch",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "standard_squelch",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
self.input_node = blocks.add_const_ff(0) # FIXME kludge
self.low_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615))
self.low_square = blocks.multiply_ff()
- self.low_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant
+ self.low_smooth = filter.single_pole_iir_filter_ff(1 / (0.01*audio_rate)) # 100ms time constant
self.hi_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615))
self.hi_square = blocks.multiply_ff()
- self.hi_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate))
+ self.hi_smooth = filter.single_pole_iir_filter_ff(1 / (0.01*audio_rate))
self.sub = blocks.sub_ff();
self.add = blocks.add_ff();
self.gate = blocks.threshold_ff(0.3,0.43,0)
- self.squelch_lpf = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate))
+ self.squelch_lpf = filter.single_pole_iir_filter_ff(1 / (0.01*audio_rate))
self.div = blocks.divide_ff()
self.squelch_mult = blocks.multiply_ff()
- self.connect(self, self.input_node)
+ self.connect(self, self.input_node)
self.connect(self.input_node, (self.squelch_mult, 0))
self.connect(self.input_node,self.low_iir)
@@ -66,7 +68,7 @@ class standard_squelch(gr.hier_block2):
self.connect(self.sub, (self.div, 0))
self.connect(self.add, (self.div, 1))
self.connect(self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1))
- self.connect(self.squelch_mult, self)
+ self.connect(self.squelch_mult, self)
def set_threshold(self, threshold):
self.gate.set_hi(threshold)
@@ -75,4 +77,4 @@ class standard_squelch(gr.hier_block2):
return self.gate.hi()
def squelch_range(self):
- return (0.0, 1.0, 1.0/100)
+ return (0.0, 1.0, 1.0 / 100)
diff --git a/gr-analog/python/analog/wfm_rcv.py b/gr-analog/python/analog/wfm_rcv.py
index d35d219275..c1f6dea339 100644
--- a/gr-analog/python/analog/wfm_rcv.py
+++ b/gr-analog/python/analog/wfm_rcv.py
@@ -19,14 +19,17 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, filter
-from fm_emph import fm_deemph
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from gnuradio import gr, filter
+
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class wfm_rcv(gr.hier_block2):
def __init__ (self, quad_rate, audio_decimation):
@@ -40,14 +43,14 @@ class wfm_rcv(gr.hier_block2):
quad_rate: input sample rate of complex baseband input. (float)
audio_decimation: how much to decimate quad_rate to get to audio. (integer)
"""
- gr.hier_block2.__init__(self, "wfm_rcv",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "wfm_rcv",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
volume = 20.
max_dev = 75e3
- fm_demod_gain = quad_rate/(2*math.pi*max_dev)
+ fm_demod_gain = quad_rate / (2*math.pi*max_dev)
audio_rate = quad_rate / audio_decimation
@@ -64,7 +67,7 @@ class wfm_rcv(gr.hier_block2):
width_of_transition_band = audio_rate / 32
audio_coeffs = filter.firdes.low_pass(1.0, # gain
quad_rate, # sampling rate
- audio_rate/2 - width_of_transition_band,
+ audio_rate / 2 - width_of_transition_band,
width_of_transition_band,
filter.firdes.WIN_HAMMING)
# input: float; output: float
diff --git a/gr-analog/python/analog/wfm_rcv_fmdet.py b/gr-analog/python/analog/wfm_rcv_fmdet.py
index b7cd1458fb..fe91465a3b 100644
--- a/gr-analog/python/analog/wfm_rcv_fmdet.py
+++ b/gr-analog/python/analog/wfm_rcv_fmdet.py
@@ -19,16 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+import math
+
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
-from fm_emph import fm_deemph
-import math
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class wfm_rcv_fmdet(gr.hier_block2):
def __init__ (self, demod_rate, audio_decimation):
@@ -43,11 +46,11 @@ class wfm_rcv_fmdet(gr.hier_block2):
demod_rate: input sample rate of complex baseband input. (float)
audio_decimation: how much to decimate demod_rate to get to audio. (integer)
"""
- gr.hier_block2.__init__(self, "wfm_rcv_fmdet",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
- lowfreq = -125e3/demod_rate
- highfreq = 125e3/demod_rate
+ gr.hier_block2.__init__(self, "wfm_rcv_fmdet",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
+ lowfreq = -125e3 / demod_rate
+ highfreq = 125e3 / demod_rate
audio_rate = demod_rate / audio_decimation
# We assign to self so that outsiders can grab the demodulator
@@ -98,8 +101,8 @@ class wfm_rcv_fmdet(gr.hier_block2):
stereo_dsbsc_filter_coeffs = \
filter.firdes.complex_band_pass(20.0,
demod_rate,
- 38000-15000/2,
- 38000+15000/2,
+ 38000-15000 / 2,
+ 38000+15000 / 2,
width_of_transition_band,
filter.firdes.WIN_HAMMING)
#print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
@@ -127,12 +130,12 @@ class wfm_rcv_fmdet(gr.hier_block2):
#print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
# construct overlap add filter system from coefficients for stereo carrier
- self.rds_signal_filter = \
+ self.rds_signal_filter = \
filter.fir_filter_fcc(audio_decimation,
stereo_rds_filter_coeffs)
- self.rds_carrier_generator = blocks.multiply_cc();
- self.rds_signal_generator = blocks.multiply_cc();
- self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
+ self.rds_carrier_generator = blocks.multiply_cc();
+ self.rds_signal_generator = blocks.multiply_cc();
+ self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
loop_bw = 2*math.pi/100.0
max_freq = -2.0*math.pi*18990/audio_rate;
@@ -191,21 +194,21 @@ class wfm_rcv_fmdet(gr.hier_block2):
#send it to negative side of a subtracter
self.connect(self.LmR_real,(self.Make_Right,1))
- # Make rds carrier by taking the squared pilot tone and
- # multiplying by pilot tone
- self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
+ # Make rds carrier by taking the squared pilot tone and
+ # multiplying by pilot tone
+ self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
- # take signal, filter off rds, send into mixer 0 channel
- self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
+ # take signal, filter off rds, send into mixer 0 channel
+ self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
# take rds_carrier_generator output and send into mixer 1
# channel
- self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
+ self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
- # send basebanded rds signal and send into "processor"
- # which for now is a null sink
- self.connect(self.rds_signal_generator,self_rds_signal_processor)
+ # send basebanded rds signal and send into "processor"
+ # which for now is a null sink
+ self.connect(self.rds_signal_generator,self_rds_signal_processor)
if 1:
diff --git a/gr-analog/python/analog/wfm_rcv_pll.py b/gr-analog/python/analog/wfm_rcv_pll.py
index 282e2b14be..b6ca7fe7c2 100644
--- a/gr-analog/python/analog/wfm_rcv_pll.py
+++ b/gr-analog/python/analog/wfm_rcv_pll.py
@@ -19,16 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+import math
+
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
-from fm_emph import fm_deemph
-import math
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class wfm_rcv_pll(gr.hier_block2):
def __init__(self, demod_rate, audio_decimation):
@@ -42,9 +45,9 @@ class wfm_rcv_pll(gr.hier_block2):
demod_rate: input sample rate of complex baseband input. (float)
audio_decimation: how much to decimate demod_rate to get to audio. (integer)
"""
- gr.hier_block2.__init__(self, "wfm_rcv_pll",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "wfm_rcv_pll",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
bandwidth = 250e3
audio_rate = demod_rate / audio_decimation
@@ -92,8 +95,8 @@ class wfm_rcv_pll(gr.hier_block2):
stereo_dsbsc_filter_coeffs = \
filter.firdes.complex_band_pass(20.0,
demod_rate,
- 38000-15000/2,
- 38000+15000/2,
+ 38000-15000 / 2,
+ 38000+15000 / 2,
width_of_transition_band,
filter.firdes.WIN_HAMMING)
#print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
@@ -120,12 +123,12 @@ class wfm_rcv_pll(gr.hier_block2):
#print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
# construct overlap add filter system from coefficients for stereo carrier
- self.rds_signal_filter = \
+ self.rds_signal_filter = \
filter.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs)
- self.rds_carrier_generator = blocks.multiply_cc();
- self.rds_signal_generator = blocks.multiply_cc();
- self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
+ self.rds_carrier_generator = blocks.multiply_cc();
+ self.rds_signal_generator = blocks.multiply_cc();
+ self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
loop_bw = 2*math.pi/100.0
max_freq = -2.0*math.pi*18990/audio_rate;
@@ -169,15 +172,15 @@ class wfm_rcv_pll(gr.hier_block2):
#take the same real part of the DSBSC baseband signal and send it to negative side of a subtracter
self.connect(self.LmR_real,(self.Make_Right,1))
- # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone
- self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
+ # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone
+ self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
- # take signal, filter off rds, send into mixer 0 channel
- self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
+ # take signal, filter off rds, send into mixer 0 channel
+ self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
# take rds_carrier_generator output and send into mixer 1 channel
- self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
- # send basebanded rds signal and send into "processor" which for now is a null sink
- self.connect(self.rds_signal_generator,self_rds_signal_processor)
+ self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
+ # send basebanded rds signal and send into "processor" which for now is a null sink
+ self.connect(self.rds_signal_generator,self_rds_signal_processor)
if 1:
diff --git a/gr-analog/python/analog/wfm_tx.py b/gr-analog/python/analog/wfm_tx.py
index a1b589350d..9f49ca3ca2 100644
--- a/gr-analog/python/analog/wfm_tx.py
+++ b/gr-analog/python/analog/wfm_tx.py
@@ -19,15 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+
from gnuradio import gr
from gnuradio import filter
-from fm_emph import fm_preemph
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_preemph
+
class wfm_tx(gr.hier_block2):
def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=75e3, fh=-1.0):
@@ -46,16 +50,16 @@ class wfm_tx(gr.hier_block2):
quad_rate must be an integer multiple of audio_rate.
"""
- gr.hier_block2.__init__(self, "wfm_tx",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "wfm_tx",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
audio_rate = int(audio_rate)
quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
- raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+ raise ValueError("quad_rate is not an integer multiple of audio_rate")
do_interp = audio_rate != quad_rate
@@ -66,10 +70,10 @@ class wfm_tx(gr.hier_block2):
quad_rate, # Fs
16000, # passband cutoff
18000, # stopband cutoff
- 0.1, # passband ripple dB
+ 0.1, # passband ripple dB
40) # stopband atten dB
- print "len(interp_taps) =", len(interp_taps)
+ print("len(interp_taps) =", len(interp_taps))
self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps)
self.preemph = fm_preemph(quad_rate, tau=tau, fh=fh)
diff --git a/gr-analog/swig/CMakeLists.txt b/gr-analog/swig/CMakeLists.txt
index 38fef3a236..9646299098 100644
--- a/gr-analog/swig/CMakeLists.txt
+++ b/gr-analog/swig/CMakeLists.txt
@@ -42,7 +42,6 @@ set(GR_SWIG_DOC_DIRS
${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/analog
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
-set(GR_SWIG_TARGET_DEPS analog_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-analog gnuradio-filter)
GR_SWIG_MAKE(analog_swig analog_swig.i)
@@ -50,7 +49,6 @@ GR_SWIG_MAKE(analog_swig analog_swig.i)
GR_SWIG_INSTALL(
TARGETS analog_swig
DESTINATION ${GR_PYTHON_DIR}/gnuradio/analog
- COMPONENT "analog_python"
)
install(
@@ -58,5 +56,4 @@ install(
analog_swig.i
${CMAKE_CURRENT_BINARY_DIR}/analog_swig_doc.i
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
- COMPONENT "analog_swig"
)
diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i
index 7f064f545f..8f4b90b71c 100644
--- a/gr-analog/swig/analog_swig.i
+++ b/gr-analog/swig/analog_swig.i
@@ -47,14 +47,8 @@
#include "gnuradio/analog/feedforward_agc_cc.h"
#include "gnuradio/analog/fmdet_cf.h"
#include "gnuradio/analog/frequency_modulator_fc.h"
-#include "gnuradio/analog/fastnoise_source_s.h"
-#include "gnuradio/analog/fastnoise_source_i.h"
-#include "gnuradio/analog/fastnoise_source_f.h"
-#include "gnuradio/analog/fastnoise_source_c.h"
-#include "gnuradio/analog/noise_source_s.h"
-#include "gnuradio/analog/noise_source_i.h"
-#include "gnuradio/analog/noise_source_f.h"
-#include "gnuradio/analog/noise_source_c.h"
+#include "gnuradio/analog/fastnoise_source.h"
+#include "gnuradio/analog/noise_source.h"
#include "gnuradio/analog/phase_modulator_fc.h"
#include "gnuradio/analog/pll_carriertracking_cc.h"
#include "gnuradio/analog/pll_freqdet_cf.h"
@@ -66,17 +60,12 @@
#include "gnuradio/analog/pwr_squelch_ff.h"
#include "gnuradio/analog/quadrature_demod_cf.h"
#include "gnuradio/analog/rail_ff.h"
-#include "gnuradio/analog/sig_source_s.h"
-#include "gnuradio/analog/sig_source_i.h"
-#include "gnuradio/analog/sig_source_f.h"
-#include "gnuradio/analog/sig_source_c.h"
+#include "gnuradio/analog/sig_source.h"
#include "gnuradio/analog/sig_source_waveform.h"
#include "gnuradio/analog/simple_squelch_cc.h"
#include "gnuradio/analog/squelch_base_cc.h"
#include "gnuradio/analog/squelch_base_ff.h"
-#include "gnuradio/analog/random_uniform_source_b.h"
-#include "gnuradio/analog/random_uniform_source_s.h"
-#include "gnuradio/analog/random_uniform_source_i.h"
+#include "gnuradio/analog/random_uniform_source.h"
%}
%include "gnuradio/analog/cpm.h"
@@ -92,14 +81,8 @@
%include "gnuradio/analog/feedforward_agc_cc.h"
%include "gnuradio/analog/fmdet_cf.h"
%include "gnuradio/analog/frequency_modulator_fc.h"
-%include "gnuradio/analog/fastnoise_source_s.h"
-%include "gnuradio/analog/fastnoise_source_i.h"
-%include "gnuradio/analog/fastnoise_source_f.h"
-%include "gnuradio/analog/fastnoise_source_c.h"
-%include "gnuradio/analog/noise_source_s.h"
-%include "gnuradio/analog/noise_source_i.h"
-%include "gnuradio/analog/noise_source_f.h"
-%include "gnuradio/analog/noise_source_c.h"
+%include "gnuradio/analog/fastnoise_source.h"
+%include "gnuradio/analog/noise_source.h"
%include "gnuradio/analog/phase_modulator_fc.h"
%include "gnuradio/analog/pll_carriertracking_cc.h"
%include "gnuradio/analog/pll_freqdet_cf.h"
@@ -111,17 +94,12 @@
%include "gnuradio/analog/pwr_squelch_ff.h"
%include "gnuradio/analog/quadrature_demod_cf.h"
%include "gnuradio/analog/rail_ff.h"
-%include "gnuradio/analog/sig_source_s.h"
-%include "gnuradio/analog/sig_source_i.h"
-%include "gnuradio/analog/sig_source_f.h"
-%include "gnuradio/analog/sig_source_c.h"
+%include "gnuradio/analog/sig_source.h"
%include "gnuradio/analog/sig_source_waveform.h"
%include "gnuradio/analog/simple_squelch_cc.h"
%include "gnuradio/analog/squelch_base_cc.h"
%include "gnuradio/analog/squelch_base_ff.h"
-%include "gnuradio/analog/random_uniform_source_b.h"
-%include "gnuradio/analog/random_uniform_source_s.h"
-%include "gnuradio/analog/random_uniform_source_i.h"
+%include "gnuradio/analog/random_uniform_source.h"
GR_SWIG_BLOCK_MAGIC2(analog, agc_cc);
GR_SWIG_BLOCK_MAGIC2(analog, agc_ff);
@@ -134,14 +112,14 @@ GR_SWIG_BLOCK_MAGIC2(analog, dpll_bb);
GR_SWIG_BLOCK_MAGIC2(analog, feedforward_agc_cc);
GR_SWIG_BLOCK_MAGIC2(analog, fmdet_cf);
GR_SWIG_BLOCK_MAGIC2(analog, frequency_modulator_fc);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_i);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_f);
-GR_SWIG_BLOCK_MAGIC2(analog, fastnoise_source_c);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_i);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_f);
-GR_SWIG_BLOCK_MAGIC2(analog, noise_source_c);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_s, fastnoise_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_i, fastnoise_source<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_f, fastnoise_source<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, fastnoise_source_c, fastnoise_source<gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_s, noise_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_i, noise_source<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_f, noise_source<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, noise_source_c, noise_source<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(analog, phase_modulator_fc);
GR_SWIG_BLOCK_MAGIC2(analog, pll_carriertracking_cc);
GR_SWIG_BLOCK_MAGIC2(analog, pll_freqdet_cf);
@@ -153,11 +131,11 @@ GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_cc);
GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_ff);
GR_SWIG_BLOCK_MAGIC2(analog, quadrature_demod_cf);
GR_SWIG_BLOCK_MAGIC2(analog, rail_ff);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_i);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_f);
-GR_SWIG_BLOCK_MAGIC2(analog, sig_source_c);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_s, sig_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_i, sig_source<std::int32_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_f, sig_source<float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, sig_source_c, sig_source<gr_complex>);
GR_SWIG_BLOCK_MAGIC2(analog, simple_squelch_cc);
-GR_SWIG_BLOCK_MAGIC2(analog, random_uniform_source_b);
-GR_SWIG_BLOCK_MAGIC2(analog, random_uniform_source_s);
-GR_SWIG_BLOCK_MAGIC2(analog, random_uniform_source_i);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, random_uniform_source_b, random_uniform_source<std::uint8_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, random_uniform_source_s, random_uniform_source<std::int16_t>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(analog, random_uniform_source_i, random_uniform_source<std::int32_t>);