diff options
author | Josh Morman <mormjb@gmail.com> | 2020-04-23 11:01:05 -0400 |
---|---|---|
committer | Josh Morman <mormjb@gmail.com> | 2020-06-04 10:05:48 -0400 |
commit | 2a5cb62885ab46ae0d8594bee26e256baed9813b (patch) | |
tree | 2f0339463e6eba8ca3a7582259c6f1d9965204cd /gr-vocoder/python/vocoder | |
parent | 9f49495b36004af83372a31bb658f32fbb334599 (diff) |
vocoder: add pybind11 bindings
Diffstat (limited to 'gr-vocoder/python/vocoder')
43 files changed, 1526 insertions, 11 deletions
diff --git a/gr-vocoder/python/vocoder/CMakeLists.txt b/gr-vocoder/python/vocoder/CMakeLists.txt index f05d5b7ea4..dae780e74e 100644 --- a/gr-vocoder/python/vocoder/CMakeLists.txt +++ b/gr-vocoder/python/vocoder/CMakeLists.txt @@ -26,11 +26,6 @@ if(ENABLE_TESTING) set(GR_TEST_LIBRARY_DIRS "") set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/gnuradio-runtime/python - ${CMAKE_BINARY_DIR}/gnuradio-runtime/swig - ${CMAKE_BINARY_DIR}/gr-blocks/swig - ${CMAKE_BINARY_DIR}/gr-fft/swig - ${CMAKE_BINARY_DIR}/gr-filter/swig - ${CMAKE_BINARY_DIR}/gr-vocoder/swig ) include(GrTest) @@ -57,3 +52,5 @@ if(ENABLE_TESTING) GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) + +add_subdirectory(bindings) diff --git a/gr-vocoder/python/vocoder/__init__.py b/gr-vocoder/python/vocoder/__init__.py index 97877ff4e3..2ed56fc925 100644 --- a/gr-vocoder/python/vocoder/__init__.py +++ b/gr-vocoder/python/vocoder/__init__.py @@ -17,10 +17,10 @@ from __future__ import unicode_literals import os try: - from .vocoder_swig import * + from .vocoder_python import * except ImportError: dirname, filename = os.path.split(os.path.abspath(__file__)) - __path__.append(os.path.join(dirname, "..", "..", "swig")) - from .vocoder_swig import * + __path__.append(os.path.join(dirname, "bindings")) + from .vocoder_python import * from .cvsd import * diff --git a/gr-vocoder/python/vocoder/bindings/CMakeLists.txt b/gr-vocoder/python/vocoder/bindings/CMakeLists.txt new file mode 100644 index 0000000000..ad6184c21e --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/CMakeLists.txt @@ -0,0 +1,78 @@ +######################################################################## +# Python Bindings +######################################################################## + +pybind11_add_module(vocoder_python + alaw_decode_bs_python.cc + alaw_encode_sb_python.cc + cvsd_decode_bs_python.cc + cvsd_encode_sb_python.cc + g721_decode_bs_python.cc + g721_encode_sb_python.cc + g723_24_decode_bs_python.cc + g723_24_encode_sb_python.cc + g723_40_decode_bs_python.cc + g723_40_encode_sb_python.cc + ulaw_decode_bs_python.cc + ulaw_encode_sb_python.cc) + +if(LIBCODEC2_FOUND) + target_sources(vocoder_python PRIVATE + codec2_python.cc + codec2_decode_ps_python.cc + codec2_encode_sp_python.cc + ) +endif(LIBCODEC2_FOUND) + +if(LIBCODEC2_HAS_FREEDV_API) + target_sources(vocoder_python PRIVATE + freedv_rx_ss_python.cc + freedv_tx_ss_python.cc + ) +endif(LIBCODEC2_HAS_FREEDV_API) + +if(LIBGSM_FOUND) + target_sources(vocoder_python PRIVATE + gsm_fr_decode_ps_python.cc + gsm_fr_encode_sp_python.cc + ) +endif(LIBGSM_FOUND) + +target_sources(vocoder_python PRIVATE + python_bindings.cc) + +configure_file(${CMAKE_SOURCE_DIR}/docs/doxygen/pydoc_macros.h ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) + +if(ENABLE_DOXYGEN) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/docstring_status + COMMAND python3 ${CMAKE_SOURCE_DIR}/docs/doxygen/update_pydoc.py "sub" + "--json_path" ${CMAKE_BINARY_DIR}/docs/doxygen/gnuradio_docstrings.json + "--bindings_dir" ${CMAKE_CURRENT_SOURCE_DIR}/docstrings + "--output_dir" ${CMAKE_CURRENT_BINARY_DIR} + "--filter" gr::vocoder + COMMENT "Adding docstrings into vocoder pybind headers ..." + DEPENDS gnuradio_docstrings gnuradio-vocoder) + add_custom_target(vocoder_docstrings ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/docstring_status) +else(ENABLE_DOXYGEN) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/docstring_status + COMMAND python3 ${CMAKE_SOURCE_DIR}/docs/doxygen/update_pydoc.py "copy" + "--bindings_dir" ${CMAKE_CURRENT_SOURCE_DIR}/docstrings + "--output_dir" ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Copying vocoder docstring templates as pybind headers ...") + add_custom_target(vocoder_docstrings ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/docstring_status) +endif(ENABLE_DOXYGEN) + +target_include_directories(vocoder_python PUBLIC + ${CMAKE_CURRENT_BINARY_DIR} + ${PYTHON_NUMPY_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../lib + ${CMAKE_CURRENT_SOURCE_DIR}/../../../include + ${PYBIND11_INCLUDE_DIR} +) +target_link_libraries(vocoder_python PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} gnuradio-runtime gnuradio-vocoder) +target_compile_options(vocoder_python PRIVATE -Wno-unused-variable) # disable warnings for docstring templates +add_dependencies(vocoder_python vocoder_docstrings) + +install(TARGETS vocoder_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/vocoder COMPONENT pythonapi) diff --git a/gr-vocoder/python/vocoder/bindings/alaw_decode_bs_python.cc b/gr-vocoder/python/vocoder/bindings/alaw_decode_bs_python.cc new file mode 100644 index 0000000000..d64e1b52ff --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/alaw_decode_bs_python.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/alaw_decode_bs.h> +// pydoc.h is automatically generated in the build directory +#include <alaw_decode_bs_pydoc.h> + +void bind_alaw_decode_bs(py::module& m) +{ + + using alaw_decode_bs = ::gr::vocoder::alaw_decode_bs; + + + py::class_<alaw_decode_bs, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<alaw_decode_bs>>(m, "alaw_decode_bs", D(alaw_decode_bs)) + + .def(py::init(&alaw_decode_bs::make), D(alaw_decode_bs, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/alaw_encode_sb_python.cc b/gr-vocoder/python/vocoder/bindings/alaw_encode_sb_python.cc new file mode 100644 index 0000000000..7ff9f72831 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/alaw_encode_sb_python.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/alaw_encode_sb.h> +// pydoc.h is automatically generated in the build directory +#include <alaw_encode_sb_pydoc.h> + +void bind_alaw_encode_sb(py::module& m) +{ + + using alaw_encode_sb = ::gr::vocoder::alaw_encode_sb; + + + py::class_<alaw_encode_sb, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<alaw_encode_sb>>(m, "alaw_encode_sb", D(alaw_encode_sb)) + + .def(py::init(&alaw_encode_sb::make), D(alaw_encode_sb, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/codec2_decode_ps_python.cc b/gr-vocoder/python/vocoder/bindings/codec2_decode_ps_python.cc new file mode 100644 index 0000000000..b24380fe86 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/codec2_decode_ps_python.cc @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/codec2_decode_ps.h> +// pydoc.h is automatically generated in the build directory +#include <codec2_decode_ps_pydoc.h> + +void bind_codec2_decode_ps(py::module& m) +{ + + using codec2_decode_ps = ::gr::vocoder::codec2_decode_ps; + + + py::class_<codec2_decode_ps, + gr::sync_interpolator, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<codec2_decode_ps>>( + m, "codec2_decode_ps", D(codec2_decode_ps)) + + .def(py::init(&codec2_decode_ps::make), + py::arg("mode") = gr::vocoder::codec2::MODE_2400, + D(codec2_decode_ps, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/codec2_encode_sp_python.cc b/gr-vocoder/python/vocoder/bindings/codec2_encode_sp_python.cc new file mode 100644 index 0000000000..202cac70db --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/codec2_encode_sp_python.cc @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/codec2_encode_sp.h> +// pydoc.h is automatically generated in the build directory +#include <codec2_encode_sp_pydoc.h> + +void bind_codec2_encode_sp(py::module& m) +{ + + using codec2_encode_sp = ::gr::vocoder::codec2_encode_sp; + + + py::class_<codec2_encode_sp, + gr::sync_decimator, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<codec2_encode_sp>>( + m, "codec2_encode_sp", D(codec2_encode_sp)) + + .def(py::init(&codec2_encode_sp::make), + py::arg("mode") = gr::vocoder::codec2::MODE_2400, + D(codec2_encode_sp, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/codec2_python.cc b/gr-vocoder/python/vocoder/bindings/codec2_python.cc new file mode 100644 index 0000000000..7c9d960dd2 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/codec2_python.cc @@ -0,0 +1,35 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/codec2.h> +// pydoc.h is automatically generated in the build directory +#include <codec2_pydoc.h> + +void bind_codec2(py::module& m) +{ + + using codec2 = ::gr::vocoder::codec2; + + + py::class_<codec2, std::shared_ptr<codec2>>(m, "codec2", D(codec2)) + + .def(py::init<>(), D(codec2, codec2, 0)) + .def( + py::init<gr::vocoder::codec2 const&>(), py::arg("arg0"), D(codec2, codec2, 1)) + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/cvsd_decode_bs_python.cc b/gr-vocoder/python/vocoder/bindings/cvsd_decode_bs_python.cc new file mode 100644 index 0000000000..94c9b2d31a --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/cvsd_decode_bs_python.cc @@ -0,0 +1,75 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/cvsd_decode_bs.h> +// pydoc.h is automatically generated in the build directory +#include <cvsd_decode_bs_pydoc.h> + +void bind_cvsd_decode_bs(py::module& m) +{ + + using cvsd_decode_bs = ::gr::vocoder::cvsd_decode_bs; + + + py::class_<cvsd_decode_bs, + gr::sync_interpolator, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<cvsd_decode_bs>>(m, "cvsd_decode_bs", D(cvsd_decode_bs)) + + .def(py::init(&cvsd_decode_bs::make), + py::arg("min_step") = 10, + py::arg("max_step") = 1280, + py::arg("step_decay") = 0.9990234375, + py::arg("accum_decay") = 0.96875, + py::arg("K") = 32, + py::arg("J") = 4, + py::arg("pos_accum_max") = 32767, + py::arg("neg_accum_max") = -32767, + D(cvsd_decode_bs, make)) + + + .def("min_step", &cvsd_decode_bs::min_step, D(cvsd_decode_bs, min_step)) + + + .def("max_step", &cvsd_decode_bs::max_step, D(cvsd_decode_bs, max_step)) + + + .def("step_decay", &cvsd_decode_bs::step_decay, D(cvsd_decode_bs, step_decay)) + + + .def("accum_decay", &cvsd_decode_bs::accum_decay, D(cvsd_decode_bs, accum_decay)) + + + .def("K", &cvsd_decode_bs::K, D(cvsd_decode_bs, K)) + + + .def("J", &cvsd_decode_bs::J, D(cvsd_decode_bs, J)) + + + .def("pos_accum_max", + &cvsd_decode_bs::pos_accum_max, + D(cvsd_decode_bs, pos_accum_max)) + + + .def("neg_accum_max", + &cvsd_decode_bs::neg_accum_max, + D(cvsd_decode_bs, neg_accum_max)) + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/cvsd_encode_sb_python.cc b/gr-vocoder/python/vocoder/bindings/cvsd_encode_sb_python.cc new file mode 100644 index 0000000000..35cea2cf2b --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/cvsd_encode_sb_python.cc @@ -0,0 +1,75 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/cvsd_encode_sb.h> +// pydoc.h is automatically generated in the build directory +#include <cvsd_encode_sb_pydoc.h> + +void bind_cvsd_encode_sb(py::module& m) +{ + + using cvsd_encode_sb = ::gr::vocoder::cvsd_encode_sb; + + + py::class_<cvsd_encode_sb, + gr::sync_decimator, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<cvsd_encode_sb>>(m, "cvsd_encode_sb", D(cvsd_encode_sb)) + + .def(py::init(&cvsd_encode_sb::make), + py::arg("min_step") = 10, + py::arg("max_step") = 1280, + py::arg("step_decay") = 0.9990234375, + py::arg("accum_decay") = 0.96875, + py::arg("K") = 32, + py::arg("J") = 4, + py::arg("pos_accum_max") = 32767, + py::arg("neg_accum_max") = -32767, + D(cvsd_encode_sb, make)) + + + .def("min_step", &cvsd_encode_sb::min_step, D(cvsd_encode_sb, min_step)) + + + .def("max_step", &cvsd_encode_sb::max_step, D(cvsd_encode_sb, max_step)) + + + .def("step_decay", &cvsd_encode_sb::step_decay, D(cvsd_encode_sb, step_decay)) + + + .def("accum_decay", &cvsd_encode_sb::accum_decay, D(cvsd_encode_sb, accum_decay)) + + + .def("K", &cvsd_encode_sb::K, D(cvsd_encode_sb, K)) + + + .def("J", &cvsd_encode_sb::J, D(cvsd_encode_sb, J)) + + + .def("pos_accum_max", + &cvsd_encode_sb::pos_accum_max, + D(cvsd_encode_sb, pos_accum_max)) + + + .def("neg_accum_max", + &cvsd_encode_sb::neg_accum_max, + D(cvsd_encode_sb, neg_accum_max)) + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/alaw_decode_bs_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/alaw_decode_bs_pydoc_template.h new file mode 100644 index 0000000000..5b4897353e --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/alaw_decode_bs_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_alaw_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_alaw_decode_bs_alaw_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_alaw_decode_bs_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/alaw_encode_sb_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/alaw_encode_sb_pydoc_template.h new file mode 100644 index 0000000000..de33861098 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/alaw_encode_sb_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_alaw_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_alaw_encode_sb_alaw_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_alaw_encode_sb_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/codec2_decode_ps_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/codec2_decode_ps_pydoc_template.h new file mode 100644 index 0000000000..3687b8302d --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/codec2_decode_ps_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_codec2_decode_ps = R"doc()doc"; + + +static const char* __doc_gr_vocoder_codec2_decode_ps_codec2_decode_ps = R"doc()doc"; + + +static const char* __doc_gr_vocoder_codec2_decode_ps_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/codec2_encode_sp_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/codec2_encode_sp_pydoc_template.h new file mode 100644 index 0000000000..582ec21741 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/codec2_encode_sp_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_codec2_encode_sp = R"doc()doc"; + + +static const char* __doc_gr_vocoder_codec2_encode_sp_codec2_encode_sp = R"doc()doc"; + + +static const char* __doc_gr_vocoder_codec2_encode_sp_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/codec2_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/codec2_pydoc_template.h new file mode 100644 index 0000000000..d1d814f9c2 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/codec2_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_codec2 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_codec2_codec2_0 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_codec2_codec2_1 = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/cvsd_decode_bs_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/cvsd_decode_bs_pydoc_template.h new file mode 100644 index 0000000000..ad00510d41 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/cvsd_decode_bs_pydoc_template.h @@ -0,0 +1,51 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_cvsd_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_cvsd_decode_bs_0 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_cvsd_decode_bs_1 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_make = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_min_step = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_max_step = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_step_decay = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_accum_decay = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_K = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_J = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_pos_accum_max = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_decode_bs_neg_accum_max = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/cvsd_encode_sb_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/cvsd_encode_sb_pydoc_template.h new file mode 100644 index 0000000000..1bb2791401 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/cvsd_encode_sb_pydoc_template.h @@ -0,0 +1,51 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_cvsd_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_cvsd_encode_sb_0 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_cvsd_encode_sb_1 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_make = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_min_step = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_max_step = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_step_decay = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_accum_decay = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_K = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_J = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_pos_accum_max = R"doc()doc"; + + +static const char* __doc_gr_vocoder_cvsd_encode_sb_neg_accum_max = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/freedv_rx_ss_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/freedv_rx_ss_pydoc_template.h new file mode 100644 index 0000000000..f66b4c6282 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/freedv_rx_ss_pydoc_template.h @@ -0,0 +1,36 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_freedv_rx_ss = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_rx_ss_freedv_rx_ss_0 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_rx_ss_freedv_rx_ss_1 = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_rx_ss_make = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_rx_ss_set_squelch_thresh = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_rx_ss_squelch_thresh = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_rx_ss_set_squelch_en = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/freedv_tx_ss_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/freedv_tx_ss_pydoc_template.h new file mode 100644 index 0000000000..becd9fcd7f --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/freedv_tx_ss_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_freedv_tx_ss = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_tx_ss_freedv_tx_ss = R"doc()doc"; + + +static const char* __doc_gr_vocoder_freedv_tx_ss_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/g721_decode_bs_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/g721_decode_bs_pydoc_template.h new file mode 100644 index 0000000000..41589ea518 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/g721_decode_bs_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_g721_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g721_decode_bs_g721_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g721_decode_bs_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/g721_encode_sb_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/g721_encode_sb_pydoc_template.h new file mode 100644 index 0000000000..aa5d6abcb6 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/g721_encode_sb_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_g721_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g721_encode_sb_g721_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g721_encode_sb_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/g723_24_decode_bs_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/g723_24_decode_bs_pydoc_template.h new file mode 100644 index 0000000000..595edea32e --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/g723_24_decode_bs_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_g723_24_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_24_decode_bs_g723_24_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_24_decode_bs_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/g723_24_encode_sb_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/g723_24_encode_sb_pydoc_template.h new file mode 100644 index 0000000000..dcfed7a29a --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/g723_24_encode_sb_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_g723_24_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_24_encode_sb_g723_24_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_24_encode_sb_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/g723_40_decode_bs_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/g723_40_decode_bs_pydoc_template.h new file mode 100644 index 0000000000..2211cd500e --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/g723_40_decode_bs_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_g723_40_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_40_decode_bs_g723_40_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_40_decode_bs_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/g723_40_encode_sb_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/g723_40_encode_sb_pydoc_template.h new file mode 100644 index 0000000000..cd70ab9aba --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/g723_40_encode_sb_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_g723_40_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_40_encode_sb_g723_40_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_g723_40_encode_sb_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/gsm_fr_decode_ps_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/gsm_fr_decode_ps_pydoc_template.h new file mode 100644 index 0000000000..7eb0cb759a --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/gsm_fr_decode_ps_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_gsm_fr_decode_ps = R"doc()doc"; + + +static const char* __doc_gr_vocoder_gsm_fr_decode_ps_gsm_fr_decode_ps = R"doc()doc"; + + +static const char* __doc_gr_vocoder_gsm_fr_decode_ps_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/gsm_fr_encode_sp_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/gsm_fr_encode_sp_pydoc_template.h new file mode 100644 index 0000000000..ba22e6e233 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/gsm_fr_encode_sp_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_gsm_fr_encode_sp = R"doc()doc"; + + +static const char* __doc_gr_vocoder_gsm_fr_encode_sp_gsm_fr_encode_sp = R"doc()doc"; + + +static const char* __doc_gr_vocoder_gsm_fr_encode_sp_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/ulaw_decode_bs_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/ulaw_decode_bs_pydoc_template.h new file mode 100644 index 0000000000..3be76ab71c --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/ulaw_decode_bs_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_ulaw_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_ulaw_decode_bs_ulaw_decode_bs = R"doc()doc"; + + +static const char* __doc_gr_vocoder_ulaw_decode_bs_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/docstrings/ulaw_encode_sb_pydoc_template.h b/gr-vocoder/python/vocoder/bindings/docstrings/ulaw_encode_sb_pydoc_template.h new file mode 100644 index 0000000000..b194701869 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/docstrings/ulaw_encode_sb_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, vocoder, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_vocoder_ulaw_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_ulaw_encode_sb_ulaw_encode_sb = R"doc()doc"; + + +static const char* __doc_gr_vocoder_ulaw_encode_sb_make = R"doc()doc"; diff --git a/gr-vocoder/python/vocoder/bindings/freedv_rx_ss_python.cc b/gr-vocoder/python/vocoder/bindings/freedv_rx_ss_python.cc new file mode 100644 index 0000000000..6b4e358628 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/freedv_rx_ss_python.cc @@ -0,0 +1,55 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/freedv_rx_ss.h> +// pydoc.h is automatically generated in the build directory +#include <freedv_rx_ss_pydoc.h> + +void bind_freedv_rx_ss(py::module& m) +{ + + using freedv_rx_ss = ::gr::vocoder::freedv_rx_ss; + + + py::class_<freedv_rx_ss, gr::block, gr::basic_block, std::shared_ptr<freedv_rx_ss>>( + m, "freedv_rx_ss", D(freedv_rx_ss)) + + .def(py::init(&freedv_rx_ss::make), + py::arg("mode") = gr::vocoder::freedv_api::MODE_1600, + py::arg("squelch_thresh") = -100., + py::arg("interleave_frames") = 1, + D(freedv_rx_ss, make)) + + + .def("set_squelch_thresh", + &freedv_rx_ss::set_squelch_thresh, + py::arg("squelch_thresh"), + D(freedv_rx_ss, set_squelch_thresh)) + + + .def("squelch_thresh", + &freedv_rx_ss::squelch_thresh, + D(freedv_rx_ss, squelch_thresh)) + + + .def("set_squelch_en", + &freedv_rx_ss::set_squelch_en, + py::arg("squelch_enable"), + D(freedv_rx_ss, set_squelch_en)) + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/freedv_tx_ss_python.cc b/gr-vocoder/python/vocoder/bindings/freedv_tx_ss_python.cc new file mode 100644 index 0000000000..a770bb6bfb --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/freedv_tx_ss_python.cc @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/freedv_tx_ss.h> +// pydoc.h is automatically generated in the build directory +#include <freedv_tx_ss_pydoc.h> + +void bind_freedv_tx_ss(py::module& m) +{ + + using freedv_tx_ss = ::gr::vocoder::freedv_tx_ss; + + + py::class_<freedv_tx_ss, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<freedv_tx_ss>>(m, "freedv_tx_ss", D(freedv_tx_ss)) + + .def(py::init(&freedv_tx_ss::make), + py::arg("mode") = gr::vocoder::freedv_api::MODE_1600, + py::arg("msg_txt") = "GNU Radio", + py::arg("interleave_frames") = 1, + D(freedv_tx_ss, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/g721_decode_bs_python.cc b/gr-vocoder/python/vocoder/bindings/g721_decode_bs_python.cc new file mode 100644 index 0000000000..5b48a4c86e --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/g721_decode_bs_python.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/g721_decode_bs.h> +// pydoc.h is automatically generated in the build directory +#include <g721_decode_bs_pydoc.h> + +void bind_g721_decode_bs(py::module& m) +{ + + using g721_decode_bs = ::gr::vocoder::g721_decode_bs; + + + py::class_<g721_decode_bs, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<g721_decode_bs>>(m, "g721_decode_bs", D(g721_decode_bs)) + + .def(py::init(&g721_decode_bs::make), D(g721_decode_bs, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/g721_encode_sb_python.cc b/gr-vocoder/python/vocoder/bindings/g721_encode_sb_python.cc new file mode 100644 index 0000000000..8f2b8d2ccd --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/g721_encode_sb_python.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/g721_encode_sb.h> +// pydoc.h is automatically generated in the build directory +#include <g721_encode_sb_pydoc.h> + +void bind_g721_encode_sb(py::module& m) +{ + + using g721_encode_sb = ::gr::vocoder::g721_encode_sb; + + + py::class_<g721_encode_sb, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<g721_encode_sb>>(m, "g721_encode_sb", D(g721_encode_sb)) + + .def(py::init(&g721_encode_sb::make), D(g721_encode_sb, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/g723_24_decode_bs_python.cc b/gr-vocoder/python/vocoder/bindings/g723_24_decode_bs_python.cc new file mode 100644 index 0000000000..9d35b65229 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/g723_24_decode_bs_python.cc @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/g723_24_decode_bs.h> +// pydoc.h is automatically generated in the build directory +#include <g723_24_decode_bs_pydoc.h> + +void bind_g723_24_decode_bs(py::module& m) +{ + + using g723_24_decode_bs = ::gr::vocoder::g723_24_decode_bs; + + + py::class_<g723_24_decode_bs, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<g723_24_decode_bs>>( + m, "g723_24_decode_bs", D(g723_24_decode_bs)) + + .def(py::init(&g723_24_decode_bs::make), D(g723_24_decode_bs, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/g723_24_encode_sb_python.cc b/gr-vocoder/python/vocoder/bindings/g723_24_encode_sb_python.cc new file mode 100644 index 0000000000..0252108daf --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/g723_24_encode_sb_python.cc @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/g723_24_encode_sb.h> +// pydoc.h is automatically generated in the build directory +#include <g723_24_encode_sb_pydoc.h> + +void bind_g723_24_encode_sb(py::module& m) +{ + + using g723_24_encode_sb = ::gr::vocoder::g723_24_encode_sb; + + + py::class_<g723_24_encode_sb, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<g723_24_encode_sb>>( + m, "g723_24_encode_sb", D(g723_24_encode_sb)) + + .def(py::init(&g723_24_encode_sb::make), D(g723_24_encode_sb, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/g723_40_decode_bs_python.cc b/gr-vocoder/python/vocoder/bindings/g723_40_decode_bs_python.cc new file mode 100644 index 0000000000..dce937596f --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/g723_40_decode_bs_python.cc @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/g723_40_decode_bs.h> +// pydoc.h is automatically generated in the build directory +#include <g723_40_decode_bs_pydoc.h> + +void bind_g723_40_decode_bs(py::module& m) +{ + + using g723_40_decode_bs = ::gr::vocoder::g723_40_decode_bs; + + + py::class_<g723_40_decode_bs, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<g723_40_decode_bs>>( + m, "g723_40_decode_bs", D(g723_40_decode_bs)) + + .def(py::init(&g723_40_decode_bs::make), D(g723_40_decode_bs, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/g723_40_encode_sb_python.cc b/gr-vocoder/python/vocoder/bindings/g723_40_encode_sb_python.cc new file mode 100644 index 0000000000..dc53457018 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/g723_40_encode_sb_python.cc @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/g723_40_encode_sb.h> +// pydoc.h is automatically generated in the build directory +#include <g723_40_encode_sb_pydoc.h> + +void bind_g723_40_encode_sb(py::module& m) +{ + + using g723_40_encode_sb = ::gr::vocoder::g723_40_encode_sb; + + + py::class_<g723_40_encode_sb, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<g723_40_encode_sb>>( + m, "g723_40_encode_sb", D(g723_40_encode_sb)) + + .def(py::init(&g723_40_encode_sb::make), D(g723_40_encode_sb, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/gsm_fr_decode_ps_python.cc b/gr-vocoder/python/vocoder/bindings/gsm_fr_decode_ps_python.cc new file mode 100644 index 0000000000..b99dcca3d2 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/gsm_fr_decode_ps_python.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/gsm_fr_decode_ps.h> +// pydoc.h is automatically generated in the build directory +#include <gsm_fr_decode_ps_pydoc.h> + +void bind_gsm_fr_decode_ps(py::module& m) +{ + + using gsm_fr_decode_ps = ::gr::vocoder::gsm_fr_decode_ps; + + + py::class_<gsm_fr_decode_ps, + gr::sync_interpolator, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<gsm_fr_decode_ps>>( + m, "gsm_fr_decode_ps", D(gsm_fr_decode_ps)) + + .def(py::init(&gsm_fr_decode_ps::make) D(gsm_fr_decode_ps, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/gsm_fr_encode_sp_python.cc b/gr-vocoder/python/vocoder/bindings/gsm_fr_encode_sp_python.cc new file mode 100644 index 0000000000..587d87f191 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/gsm_fr_encode_sp_python.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/gsm_fr_encode_sp.h> +// pydoc.h is automatically generated in the build directory +#include <gsm_fr_encode_sp_pydoc.h> + +void bind_gsm_fr_encode_sp(py::module& m) +{ + + using gsm_fr_encode_sp = ::gr::vocoder::gsm_fr_encode_sp; + + + py::class_<gsm_fr_encode_sp, + gr::sync_decimator, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<gsm_fr_encode_sp>>( + m, "gsm_fr_encode_sp", D(gsm_fr_encode_sp)) + + .def(py::init(&gsm_fr_encode_sp::make) D(gsm_fr_encode_sp, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/python_bindings.cc b/gr-vocoder/python/vocoder/bindings/python_bindings.cc new file mode 100644 index 0000000000..d98ef6e372 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/python_bindings.cc @@ -0,0 +1,88 @@ + +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +#include <pybind11/pybind11.h> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <numpy/arrayobject.h> + +namespace py = pybind11; + +void bind_alaw_decode_bs(py::module&); +void bind_alaw_encode_sb(py::module&); +#ifdef LIBCODEC2_FOUND +void bind_codec2(py::module&); +void bind_codec2_decode_ps(py::module&); +void bind_codec2_encode_sp(py::module&); +#endif +void bind_cvsd_decode_bs(py::module&); +void bind_cvsd_encode_sb(py::module&); +#ifdef LIBCODEC2_HAS_FREEDV_API +void bind_freedv_rx_ss(py::module&); +void bind_freedv_tx_ss(py::module&); +#endif +void bind_g721_decode_bs(py::module&); +void bind_g721_encode_sb(py::module&); +void bind_g723_24_decode_bs(py::module&); +void bind_g723_24_encode_sb(py::module&); +void bind_g723_40_decode_bs(py::module&); +void bind_g723_40_encode_sb(py::module&); +#ifdef LIBGSM_FOUND +void bind_gsm_fr_decode_ps(py::module&); +void bind_gsm_fr_encode_sp(py::module&); +#endif +void bind_ulaw_decode_bs(py::module&); +void bind_ulaw_encode_sb(py::module&); + +// We need this hack because import_array() returns NULL +// for newer Python versions. +// This function is also necessary because it ensures access to the C API +// and removes a warning. +void* init_numpy() +{ + import_array(); + return NULL; +} + +PYBIND11_MODULE(vocoder_python, m) +{ + // Initialize the numpy C API + // (otherwise we will see segmentation faults) + init_numpy(); + + // Allow access to base block methods + py::module::import("gnuradio.gr"); + + bind_alaw_decode_bs(m); + bind_alaw_encode_sb(m); +#ifdef LIBCODEC2_FOUND + bind_codec2(m); + bind_codec2_decode_ps(m); + bind_codec2_encode_sp(m); +#endif + bind_cvsd_decode_bs(m); + bind_cvsd_encode_sb(m); +#ifdef LIBCODEC2_HAS_FREEDV_API + bind_freedv_rx_ss(m); + bind_freedv_tx_ss(m); +#endif + bind_g721_decode_bs(m); + bind_g721_encode_sb(m); + bind_g723_24_decode_bs(m); + bind_g723_24_encode_sb(m); + bind_g723_40_decode_bs(m); + bind_g723_40_encode_sb(m); +#ifdef LIBGSM_FOUND + bind_gsm_fr_decode_ps(m); + bind_gsm_fr_encode_sp(m); +#endif + bind_ulaw_decode_bs(m); + bind_ulaw_encode_sb(m); +} diff --git a/gr-vocoder/python/vocoder/bindings/ulaw_decode_bs_python.cc b/gr-vocoder/python/vocoder/bindings/ulaw_decode_bs_python.cc new file mode 100644 index 0000000000..8e90eb8154 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/ulaw_decode_bs_python.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/ulaw_decode_bs.h> +// pydoc.h is automatically generated in the build directory +#include <ulaw_decode_bs_pydoc.h> + +void bind_ulaw_decode_bs(py::module& m) +{ + + using ulaw_decode_bs = ::gr::vocoder::ulaw_decode_bs; + + + py::class_<ulaw_decode_bs, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<ulaw_decode_bs>>(m, "ulaw_decode_bs", D(ulaw_decode_bs)) + + .def(py::init(&ulaw_decode_bs::make), D(ulaw_decode_bs, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/bindings/ulaw_encode_sb_python.cc b/gr-vocoder/python/vocoder/bindings/ulaw_encode_sb_python.cc new file mode 100644 index 0000000000..997f639e72 --- /dev/null +++ b/gr-vocoder/python/vocoder/bindings/ulaw_encode_sb_python.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/* This file is automatically generated using bindtool */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/vocoder/ulaw_encode_sb.h> +// pydoc.h is automatically generated in the build directory +#include <ulaw_encode_sb_pydoc.h> + +void bind_ulaw_encode_sb(py::module& m) +{ + + using ulaw_encode_sb = ::gr::vocoder::ulaw_encode_sb; + + + py::class_<ulaw_encode_sb, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<ulaw_encode_sb>>(m, "ulaw_encode_sb", D(ulaw_encode_sb)) + + .def(py::init(&ulaw_encode_sb::make), D(ulaw_encode_sb, make)) + + + ; +} diff --git a/gr-vocoder/python/vocoder/cvsd.py b/gr-vocoder/python/vocoder/cvsd.py index adc3d90242..20513d3239 100644 --- a/gr-vocoder/python/vocoder/cvsd.py +++ b/gr-vocoder/python/vocoder/cvsd.py @@ -11,7 +11,7 @@ from __future__ import division from __future__ import unicode_literals from gnuradio import gr, filter, blocks -from . import vocoder_swig +from . import vocoder_python class cvsd_encode_fb(gr.hier_block2): @@ -41,7 +41,7 @@ class cvsd_encode_fb(gr.hier_block2): taps = filter.firdes.low_pass(self.interp, self.interp, bw, 2*bw) interp = filter.interp_fir_filter_fff(self.interp, taps) f2s = blocks.float_to_short() - enc = vocoder_swig.cvsd_encode_sb() + enc = vocoder_python.cvsd_encode_sb() self.connect(self, src_scale, interp, f2s, enc, self) @@ -68,7 +68,7 @@ class cvsd_decode_bf(gr.hier_block2): scale_factor = 32000.0 self.decim = resample - dec = vocoder_swig.cvsd_decode_bs() + dec = vocoder_python.cvsd_decode_bs() s2f = blocks.short_to_float() taps = filter.firdes.low_pass(1, 1, bw, 2*bw) decim = filter.fir_filter_fff(self.decim, taps) |