sdrangel/wdsp/sender.cpp

103 wiersze
2.6 KiB
C++
Czysty Zwykły widok Historia

2024-06-16 09:31:13 +00: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 08:20:14 +00:00
#include "bufferprobe.hpp"
2024-06-16 09:31:13 +00:00
namespace WDSP {
2024-06-25 01:50:48 +00:00
SENDER* SENDER::create_sender (int run, int flag, int mode, int size, float* in)
2024-06-16 09:31:13 +00:00
{
SENDER *a = new SENDER;
a->run = run;
a->flag = flag;
a->mode = mode;
a->size = size;
a->in = in;
2024-06-24 08:20:14 +00:00
a->spectrumProbe = nullptr;
2024-06-16 09:31:13 +00:00
return a;
}
void SENDER::destroy_sender (SENDER *a)
{
delete (a);
}
2024-06-24 08:20:14 +00:00
void SENDER::flush_sender (SENDER *)
2024-06-16 09:31:13 +00:00
{
}
void SENDER::xsender (SENDER *a)
{
if (a->run && a->flag)
{
switch (a->mode)
{
case 0:
{
2024-06-24 08:20:14 +00:00
if (a->spectrumProbe) {
a->spectrumProbe->proceed(a->in, a->size);
2024-06-16 09:31:13 +00:00
}
break;
}
}
}
}
2024-06-25 01:50:48 +00:00
void SENDER::setBuffers_sender (SENDER *a, float* in)
2024-06-16 09:31:13 +00:00
{
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 08:20:14 +00:00
void SENDER::SetSpectrum (RXA& rxa, int flag, BufferProbe *spectrumProbe)
2024-06-16 09:31:13 +00:00
{
SENDER *a;
a = rxa.sender.p;
a->flag = flag;
2024-06-24 08:20:14 +00:00
a->spectrumProbe = spectrumProbe;
2024-06-16 09:31:13 +00:00
}
} // namespace WDSP