1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-11-17 05:33:33 -05:00
sdrangel/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.cpp
2019-12-29 06:04:02 +01:00

49 lines
2.1 KiB
C++

///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Edouard Griffiths, F4EXB //
// //
// This program 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 as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program 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 V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "beamsteeringcwmodstreamsource.h"
BeamSteeringCWModStreamSource::BeamSteeringCWModStreamSource() :
m_amp(0.5f)
{
m_real = m_amp;
m_imag = 0.0f;
}
BeamSteeringCWModStreamSource::~BeamSteeringCWModStreamSource()
{}
void BeamSteeringCWModStreamSource::setPhase(float phase)
{
float normPhase = phase < -M_PI ? -M_PI : phase > M_PI ? M_PI : phase;
m_real = m_amp * cos(normPhase);
m_imag = m_amp * sin(normPhase);
}
void BeamSteeringCWModStreamSource::pull(SampleVector::iterator begin, unsigned int nbSamples)
{
std::fill(begin, begin + nbSamples, Sample{m_real, m_imag});
}
void BeamSteeringCWModStreamSource::pullOne(Sample& sample)
{
sample.setReal(m_real);
sample.setImag(m_imag);
}
void BeamSteeringCWModStreamSource::reset()
{}