summaryrefslogtreecommitdiff
path: root/gr-analog
diff options
context:
space:
mode:
authorMarcus Müller <marcus@hostalia.de>2018-03-22 22:29:21 +0100
committerMarcus Müller <marcus@hostalia.de>2018-03-22 22:32:12 +0100
commitd3aba0022c3317bc8856f05612cafcdca4b4d667 (patch)
tree9dd5ddbf8db2f357754a73b4eed4d0cc8924360a /gr-analog
parent9ae5d4cd3da84ce7e5a0c2abe7fec1ff8d229ae8 (diff)
parent886ce0f13b4135c1206c26786e06a524e92fc271 (diff)
Merge branch 'fix_cmake_cxx_standard' of https://github.com/noc0lour/gnuradio into noc0lour-fix_cmake_cxx_standard
Diffstat (limited to 'gr-analog')
-rw-r--r--gr-analog/lib/cpfsk_bc_impl.cc15
-rw-r--r--gr-analog/lib/cpm.cc15
-rw-r--r--gr-analog/lib/fmdet_cf_impl.cc4
-rw-r--r--gr-analog/lib/frequency_modulator_fc_impl.cc5
-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/sig_source_X_impl.cc.t49
-rw-r--r--gr-analog/lib/squelch_base_cc_impl.cc7
-rw-r--r--gr-analog/lib/squelch_base_ff_impl.cc7
10 files changed, 70 insertions, 80 deletions
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 ccac42cd0c..163588682d 100644
--- a/gr-analog/lib/cpm.cc
+++ b/gr-analog/lib/cpm.cc
@@ -25,17 +25,14 @@
#endif
#include <gnuradio/analog/cpm.h>
+#include <gnuradio/math.h>
+
#include <cmath>
#include <cfloat>
-
namespace gr {
namespace analog {
-#ifndef M_TWOPI
-# define M_TWOPI (2*M_PI)
-#endif
-
//! Normalised sinc function, sinc(x)=std::sin(pi*x)/pi*x
inline double
sinc(double x)
@@ -43,7 +40,7 @@ namespace gr {
if(x == 0) {
return 1.0;
}
- return std::sin(M_PI * x) / (M_PI * x);
+ return std::sin(GR_M_PI * x) / (GR_M_PI * x);
}
@@ -53,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 - std::cos(M_TWOPI * i / L / samples_per_sym);
+ taps[i] *= 1 - std::cos(GR_M_TWOPI * i / L / samples_per_sym);
}
return taps;
@@ -97,7 +94,7 @@ namespace gr {
}
else {
double tmp = 4.0 * beta * k / Ls;
- taps_d[i] *= std::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];
}
@@ -124,7 +121,7 @@ namespace gr {
}
const double pi2_24 = 0.411233516712057; // pi^2/24
- double f = M_PI * k / sps;
+ 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);
}
diff --git a/gr-analog/lib/fmdet_cf_impl.cc b/gr-analog/lib/fmdet_cf_impl.cc
index 38496d189b..5151f027d4 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
*
@@ -31,7 +31,7 @@
namespace gr {
namespace analog {
-#define M_TWOPI (2*M_PI)
+#define M_TWOPI (2*GR_M_PI)
fmdet_cf::sptr
fmdet_cf::make(float samplerate, float freq_low,
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/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/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t
index 017177eae0..18a45f5801 100644
--- a/gr-analog/lib/sig_source_X_impl.cc.t
+++ b/gr-analog/lib/sig_source_X_impl.cc.t
@@ -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,11 +27,12 @@
#endif
#include "@IMPL_NAME@.h"
-#include <algorithm>
#include <gnuradio/io_signature.h>
+#include <gnuradio/gr_complex.h>
+#include <gnuradio/math.h>
+
#include <stdexcept>
#include <algorithm>
-#include <gnuradio/gr_complex.h>
namespace gr {
namespace analog {
@@ -125,11 +126,11 @@ namespace gr {
*/
case GR_SQR_WAVE:
for(int i = 0; i < noutput_items; i++) {
- if(d_nco.get_phase() < -1*M_PI/2)
+ 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() < M_PI/2)
+ else if(d_nco.get_phase() < GR_M_PI/2)
optr[i] = gr_complex(0, d_ampl) + d_offset;
else
optr[i] = d_offset;
@@ -143,21 +144,21 @@ namespace gr {
*/
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;
+ 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()/M_PI + d_ampl,
- d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset;
+ 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() < 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 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()/M_PI + d_ampl,
- -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2) + d_offset;
+ 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();
}
@@ -168,13 +169,13 @@ namespace gr {
*/
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;
+ 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*M_PI) + d_ampl/2,
- d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4) + d_offset;
+ 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();
}
@@ -222,7 +223,7 @@ namespace gr {
/* 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;
+ double t = d_ampl*d_nco.get_phase()/GR_M_PI;
if (d_nco.get_phase() < 0)
optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset);
else
@@ -234,7 +235,7 @@ namespace gr {
/* 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)
+ t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*GR_M_PI)
+ d_ampl/2 + d_offset);
optr[i] = t;
d_nco.step();
@@ -254,7 +255,7 @@ namespace gr {
@NAME@::set_sampling_freq(double sampling_freq)
{
d_sampling_freq = sampling_freq;
- d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq);
+ d_nco.set_freq (2 * GR_M_PI * d_frequency / d_sampling_freq);
}
void
@@ -267,7 +268,7 @@ namespace gr {
@NAME@::set_frequency(double frequency)
{
d_frequency = frequency;
- d_nco.set_freq(2 * M_PI * d_frequency / d_sampling_freq);
+ d_nco.set_freq(2 * GR_M_PI * d_frequency / d_sampling_freq);
}
void
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);