1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-11 02:46:12 -05:00
sdrangel/wdsp/sender.cpp

105 lines
2.6 KiB
C++
Raw Normal View History

2024-06-16 05:31:13 -04:00
/* sender.c
This file is part of a program that implements a Software-Defined Radio.
Copyright (C) 2013 Warren Pratt, NR0V
Copyright (C) 2024 Edouard Griffiths, F4EXB Adapted to SDRangel
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; either version 2
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 for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
The author can be reached by email at
warren@wpratt.com
*/
#include "comm.hpp"
#include "sender.hpp"
#include "RXA.hpp"
2024-06-24 04:20:14 -04:00
#include "bufferprobe.hpp"
2024-06-16 05:31:13 -04:00
namespace WDSP {
2024-06-24 04:20:14 -04:00
SENDER* SENDER::create_sender (int run, int flag, int mode, int size, double* in)
2024-06-16 05:31:13 -04:00
{
SENDER *a = new SENDER;
a->run = run;
a->flag = flag;
a->mode = mode;
a->size = size;
a->in = in;
2024-06-24 04:20:14 -04:00
a->spectrumProbe = nullptr;
2024-06-16 05:31:13 -04:00
return a;
}
void SENDER::destroy_sender (SENDER *a)
{
delete (a);
}
2024-06-24 04:20:14 -04:00
void SENDER::flush_sender (SENDER *)
2024-06-16 05:31:13 -04:00
{
}
void SENDER::xsender (SENDER *a)
{
if (a->run && a->flag)
{
switch (a->mode)
{
case 0:
{
2024-06-24 04:20:14 -04:00
if (a->spectrumProbe) {
a->spectrumProbe->proceed(a->in, a->size);
2024-06-16 05:31:13 -04:00
}
break;
}
}
}
}
void SENDER::setBuffers_sender (SENDER *a, double* in)
{
a->in = in;
}
void SENDER::setSamplerate_sender (SENDER *a, int)
{
flush_sender (a);
}
void SENDER::setSize_sender (SENDER *a, int size)
{
a->size = size;
}
/********************************************************************************************************
* *
* RXA Properties *
* *
********************************************************************************************************/
2024-06-24 04:20:14 -04:00
void SENDER::SetSpectrum (RXA& rxa, int flag, BufferProbe *spectrumProbe)
2024-06-16 05:31:13 -04:00
{
SENDER *a;
rxa.csDSP.lock();
a = rxa.sender.p;
a->flag = flag;
2024-06-24 04:20:14 -04:00
a->spectrumProbe = spectrumProbe;
2024-06-16 05:31:13 -04:00
rxa.csDSP.unlock();
}
} // namespace WDSP