diff --git a/include/gnuradio/m17/CMakeLists.txt b/include/gnuradio/m17/CMakeLists.txt index 65323a6..c7d7822 100644 --- a/include/gnuradio/m17/CMakeLists.txt +++ b/include/gnuradio/m17/CMakeLists.txt @@ -12,7 +12,7 @@ install(FILES api.h codec2_encoder.h - #codec2_decoder.h + codec2_decoder.h symbol_sync.h m17_coder.h m17_decoder.h DESTINATION include/gnuradio/m17 diff --git a/include/gnuradio/m17/codec2_decoder.h b/include/gnuradio/m17/codec2_decoder.h new file mode 100644 index 0000000..b23c6ed --- /dev/null +++ b/include/gnuradio/m17/codec2_decoder.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- */ +/* + * Copyright 2026 wkaczmarski. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#ifndef INCLUDED_M17_CODEC2_DECODER_H +#define INCLUDED_M17_CODEC2_DECODER_H + +#include +#include + +namespace gr +{ + namespace m17 + { + + /*! + * \brief <+description of block+> + * \ingroup m17 + * + */ + class M17_API codec2_decoder : virtual public gr::block + { + public: + typedef std::shared_ptr sptr; + + /*! + * \brief Return a shared_ptr to a new instance of m17::m17_coder. + * + * To avoid accidental use of raw pointers, m17::m17_coder's + * constructor is in a private implementation + * class. m17::m17_coder::make is the public interface for + * creating new instances. + */ + static sptr make(); + }; + + } // namespace m17 +} // namespace gr + +#endif /* INCLUDED_M17_CODEC2_DECODER_H */ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 3ab96ed..7694ff0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -15,7 +15,7 @@ list(APPEND m17_sources m17_coder_impl.cc m17_decoder_impl.cc codec2_encoder_impl.cc - #codec2_decoder_impl.cc + codec2_decoder_impl.cc #symbol_sync_impl.cc ../libm17/m17.c ../libm17/decode/symbols.c diff --git a/lib/m17_codec2_decoder_impl.cc b/lib/codec2_decoder_impl.cc similarity index 97% rename from lib/m17_codec2_decoder_impl.cc rename to lib/codec2_decoder_impl.cc index 6f6153e..d047cbe 100644 --- a/lib/m17_codec2_decoder_impl.cc +++ b/lib/codec2_decoder_impl.cc @@ -84,7 +84,7 @@ namespace gr return 0; // decode exactly one frame - codec2_decode(&c2, bits, const_cast(speech)); + codec2_decode(&c2, const_cast(speech), bits ); // consume 160 samples consume_each(CODEC2_SAMPLES_PER_FRAME); diff --git a/python/m17/bindings/CMakeLists.txt b/python/m17/bindings/CMakeLists.txt index eb8b34d..bc4b004 100644 --- a/python/m17/bindings/CMakeLists.txt +++ b/python/m17/bindings/CMakeLists.txt @@ -32,7 +32,7 @@ list(APPEND m17_python_files m17_coder_python.cc m17_decoder_python.cc codec2_encoder_python.cc - #codec2_decoder_python.cc + codec2_decoder_python.cc #symbol_sync_python.cc python_bindings.cc ) diff --git a/python/m17/bindings/codec2_decoder_python.cc b/python/m17/bindings/codec2_decoder_python.cc new file mode 100644 index 0000000..87f90c5 --- /dev/null +++ b/python/m17/bindings/codec2_decoder_python.cc @@ -0,0 +1,42 @@ +/* + * Copyright 2025 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 and can be manually + * edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. + */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(codec2_decoder.h) */ +/* BINDTOOL_HEADER_FILE_HASH(1b2f013e25a1c90973f41cab79e6251f) */ +/***********************************************************************************/ + +#include +#include +#include + +namespace py = pybind11; + +#include +// pydoc.h is automatically generated in the build directory +//#include + +void bind_codec2_decoder(py::module &m) { + + using codec2_decoder = ::gr::m17::codec2_decoder; + + py::class_>( + m, "codec2_decoder", "Codec2 decoder block") + + .def(py::init(&codec2_decoder::make), "Create a Codec2 decoder") + + ; +} diff --git a/python/m17/bindings/python_bindings.cc b/python/m17/bindings/python_bindings.cc index 124cebf..3796363 100644 --- a/python/m17/bindings/python_bindings.cc +++ b/python/m17/bindings/python_bindings.cc @@ -24,7 +24,7 @@ namespace py = pybind11; void bind_m17_coder(py::module& m); void bind_m17_decoder(py::module& m); void bind_codec2_encoder(py::module& m); - //void bind_codec2_decoder(py::module& m); + void bind_codec2_decoder(py::module& m); //void bind_symbol_sync(py::module& m); // ) END BINDING_FUNCTION_PROTOTYPES @@ -57,7 +57,7 @@ PYBIND11_MODULE(m17_python, m) bind_m17_coder(m); bind_m17_decoder(m); bind_codec2_encoder(m); - //bind_codec2_decoder(m); + bind_codec2_decoder(m); //bind_symbol_sync(m); // ) END BINDING_FUNCTION_CALLS } \ No newline at end of file