root / gnuradio-core / src / lib / hier / gr_cpmmod_bc.cc @ 5155713e
History | View | Annotate | Download (2 kB)
| 1 | /* -*- c++ -*- */
|
|---|---|
| 2 | /*
|
| 3 | * Copyright 2010 Free Software Foundation, Inc. |
| 4 | * |
| 5 | * GNU Radio is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3, or (at your option) |
| 8 | * any later version. |
| 9 | * |
| 10 | * GNU Radio is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with GNU Radio; see the file COPYING. If not, write to |
| 17 | * the Free Software Foundation, Inc., 51 Franklin Street, |
| 18 | * Boston, MA 02110-1301, USA. |
| 19 | */ |
| 20 | |
| 21 | #ifdef HAVE_CONFIG_H
|
| 22 | #include "config.h" |
| 23 | #endif
|
| 24 | |
| 25 | #include <gr_cpmmod_bc.h> |
| 26 | #include <gr_io_signature.h> |
| 27 | |
| 28 | |
| 29 | // Shared pointer constructor
|
| 30 | gr_cpmmod_bc_sptr |
| 31 | gr_make_cpmmod_bc(int type, float h, unsigned samples_per_sym, unsigned L, double beta) |
| 32 | {
|
| 33 | return gnuradio::get_initial_sptr(new gr_cpmmod_bc((gr_cpm::cpm_type)type, h, samples_per_sym, L, beta)); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | gr_cpmmod_bc::gr_cpmmod_bc(gr_cpm::cpm_type type, float h, unsigned samples_per_sym, |
| 38 | unsigned L, double beta) |
| 39 | : gr_hier_block2("gr_cpmmod_bc",
|
| 40 | gr_make_io_signature(1, 1, sizeof(char)), |
| 41 | gr_make_io_signature2(1, 2, sizeof(gr_complex), sizeof(float))), |
| 42 | d_taps(gr_cpm::phase_response(type, samples_per_sym, L, beta)), |
| 43 | d_char_to_float(gr_make_char_to_float()), |
| 44 | d_pulse_shaper(gr_make_interp_fir_filter_fff(samples_per_sym, d_taps)), |
| 45 | d_fm(gr_make_frequency_modulator_fc(M_TWOPI * h / samples_per_sym)) |
| 46 | {
|
| 47 | switch (type) {
|
| 48 | case gr_cpm::LRC:
|
| 49 | case gr_cpm::LSRC:
|
| 50 | case gr_cpm::LREC:
|
| 51 | case gr_cpm::TFM:
|
| 52 | case gr_cpm::GAUSSIAN:
|
| 53 | break;
|
| 54 | |
| 55 | default:
|
| 56 | throw std::invalid_argument("invalid CPM type"); |
| 57 | } |
| 58 | |
| 59 | connect(self(), 0, d_char_to_float, 0); |
| 60 | connect(d_char_to_float, 0, d_pulse_shaper, 0); |
| 61 | connect(d_pulse_shaper, 0, d_fm, 0); |
| 62 | connect(d_fm, 0, self(), 0); |
| 63 | } |
| 64 |