diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b1d193..fd59afa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ list(APPEND inspectrum_sources plot.cpp plots.cpp plotview.cpp + rotator_ex_cc.cpp samplebuffer.cpp samplesource.cpp spectrogramcontrols.cpp diff --git a/rotator_ex_cc.cpp b/rotator_ex_cc.cpp new file mode 100644 index 0000000..c164c0b --- /dev/null +++ b/rotator_ex_cc.cpp @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2014 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. + */ + +#include "rotator_ex_cc.h" +#include + +#include + +namespace gr { + namespace blocks { + + rotator_ex_cc::sptr + rotator_ex_cc::make(double phase_inc) + { + return gnuradio::get_initial_sptr + (new rotator_ex_cc(phase_inc)); + } + + rotator_ex_cc::rotator_ex_cc(double phase_inc) + : sync_block("rotator_ex_cc", + io_signature::make(1, 1, sizeof(gr_complex)), + io_signature::make(1, 1, sizeof(gr_complex))) + { + set_phase_inc(phase_inc); + } + + rotator_ex_cc::~rotator_ex_cc() + { + } + + void + rotator_ex_cc::set_phase_inc(double phase_inc) + { + d_r.set_phase_incr( exp(gr_complex(0, phase_inc)) ); + } + + int + rotator_ex_cc::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const gr_complex *in = (const gr_complex *)input_items[0]; + gr_complex *out = (gr_complex *)output_items[0]; + +#if 0 + for (int i=0; i +#include +#include + +namespace gr { + namespace blocks { + + /*! + * \brief Complex rotator + * \ingroup math_blk + */ + class rotator_ex_cc : virtual public sync_block + { + private: + rotator d_r; + + public: + // gr::blocks::rotator_cc::sptr + typedef boost::shared_ptr sptr; + + /*! + * \brief Make an complex rotator block + * \param phase_inc rotational velocity + */ + static sptr make(double phase_inc = 0.0); + + rotator_ex_cc(double phase_inc = 0.0); + ~rotator_ex_cc(); + + void set_phase_inc(double phase_inc); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_BLOCKS_ROTATOR_EX_CC_H */ diff --git a/spectrogramplot.cpp b/spectrogramplot.cpp index c1e2ea8..5d0c943 100644 --- a/spectrogramplot.cpp +++ b/spectrogramplot.cpp @@ -47,7 +47,7 @@ SpectrogramPlot::SpectrogramPlot(std::shared_ptrconnect(memSource, 0, tunerRotator, 0); diff --git a/spectrogramplot.h b/spectrogramplot.h index df18e03..9c862d2 100644 --- a/spectrogramplot.h +++ b/spectrogramplot.h @@ -19,7 +19,7 @@ #pragma once -#include +#include "rotator_ex_cc.h" #include #include #include @@ -72,7 +72,7 @@ private: Tuner tuner; std::shared_ptr, std::complex>> tunerOutput; - gr::blocks::rotator_cc::sptr tunerRotator; + gr::blocks::rotator_ex_cc::sptr tunerRotator; gr::filter::fir_filter_ccf::sptr tunerFilter; QPixmap* getPixmapTile(off_t tile);