mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-09-12 08:06:34 -04:00
Refactored WDSP initial commit
This commit is contained in:
parent
98baa03619
commit
cd4ad2cc95
8
.gitignore
vendored
8
.gitignore
vendored
@ -43,4 +43,10 @@ obj-x86_64-linux-gnu/*
|
||||
|
||||
/rescuesdriq/vendor/
|
||||
/rescuesdriq/Godeps/
|
||||
/.vs
|
||||
/.vs
|
||||
|
||||
# WDSP
|
||||
wdsp/*.o
|
||||
wdsp/*.h
|
||||
wdsp/*.c
|
||||
wdsp/Makefile
|
||||
|
@ -857,6 +857,7 @@ if (FFTW3F_FOUND)
|
||||
add_subdirectory(ft8)
|
||||
add_definitions(-DHAS_FT8)
|
||||
set(FT8_SUPPORT ON CACHE INTERNAL "")
|
||||
add_subdirectory(wdsp)
|
||||
endif()
|
||||
|
||||
add_subdirectory(sdrbench)
|
||||
|
@ -167,4 +167,16 @@
|
||||
# define FT8_API
|
||||
#endif
|
||||
|
||||
/* the 'WDSP_API' controls the import/export of 'wdsp' symbols
|
||||
*/
|
||||
#if !defined(sdrangel_STATIC)
|
||||
# ifdef wdsp_EXPORTS
|
||||
# define WDSP_API __SDR_EXPORT
|
||||
# else
|
||||
# define WDSP_API __SDR_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define WDSP_API
|
||||
#endif
|
||||
|
||||
#endif /* __SDRANGEL_EXPORT_H */
|
||||
|
135
wdsp/CMakeLists.txt
Normal file
135
wdsp/CMakeLists.txt
Normal file
@ -0,0 +1,135 @@
|
||||
project(wdsp)
|
||||
|
||||
set(wdsp_SOURCES
|
||||
../custom/apple/apple_compat.c
|
||||
amd.cpp
|
||||
ammod.cpp
|
||||
amsq.cpp
|
||||
anf.cpp
|
||||
anr.cpp
|
||||
bandpass.cpp
|
||||
bldr.cpp
|
||||
bps.cpp
|
||||
calculus.cpp
|
||||
cblock.cpp
|
||||
cfcomp.cpp
|
||||
cfir.cpp
|
||||
compress.cpp
|
||||
delay.cpp
|
||||
emnr.cpp
|
||||
emph.cpp
|
||||
eq.cpp
|
||||
fcurve.cpp
|
||||
fir.cpp
|
||||
firmin.cpp
|
||||
fmd.cpp
|
||||
fmmod.cpp
|
||||
fmsq.cpp
|
||||
gain.cpp
|
||||
gen.cpp
|
||||
icfir.cpp
|
||||
iir.cpp
|
||||
iqc.cpp
|
||||
lmath.cpp
|
||||
meter.cpp
|
||||
meterlog10.cpp
|
||||
nbp.cpp
|
||||
osctrl.cpp
|
||||
patchpanel.cpp
|
||||
resample.cpp
|
||||
rmatch.cpp
|
||||
RXA.cpp
|
||||
sender.cpp
|
||||
shift.cpp
|
||||
siphon.cpp
|
||||
slew.cpp
|
||||
snb.cpp
|
||||
ssql.cpp
|
||||
TXA.cpp
|
||||
varsamp.cpp
|
||||
wcpAGC.cpp
|
||||
)
|
||||
|
||||
set(wdsp_HEADERS
|
||||
amd.hpp
|
||||
ammod.hpp
|
||||
amsq.hpp
|
||||
anf.hpp
|
||||
anr.hpp
|
||||
bandpass.hpp
|
||||
bldr.hpp
|
||||
bps.hpp
|
||||
calculus.hpp
|
||||
cblock.hpp
|
||||
cfcomp.hpp
|
||||
cfir.hpp
|
||||
comm.hpp
|
||||
compress.hpp
|
||||
delay.hpp
|
||||
emnr.hpp
|
||||
emph.hpp
|
||||
eq.hpp
|
||||
fcurve.hpp
|
||||
fir.hpp
|
||||
firmin.hpp
|
||||
fmd.hpp
|
||||
fmmod.hpp
|
||||
fmsq.hpp
|
||||
gain.hpp
|
||||
gen.hpp
|
||||
icfir.hpp
|
||||
iir.hpp
|
||||
iqc.hpp
|
||||
lmath.hpp
|
||||
meter.hpp
|
||||
meterlog10.hpp
|
||||
nbp.hpp
|
||||
osctrl.hpp
|
||||
patchpanel.hpp
|
||||
resample.hpp
|
||||
rmatch.hpp
|
||||
RXA.hpp
|
||||
sender.hpp
|
||||
shift.hpp
|
||||
siphon.hpp
|
||||
slew.hpp
|
||||
snb.hpp
|
||||
ssql.hpp
|
||||
TXA.hpp
|
||||
varsamp.hpp
|
||||
wcpAGC.hpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/exports
|
||||
${CUSTOM_APPLE_INCLUDE}
|
||||
${FFTW3F_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_library(wdsp SHARED
|
||||
${wdsp_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(wdsp
|
||||
${FFTW3F_LIBRARIES}
|
||||
Qt::Core
|
||||
)
|
||||
|
||||
set_target_properties(wdsp PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true)
|
||||
if (MSVC)
|
||||
set_target_properties(wdsp PROPERTIES INTERPROCEDURAL_OPTIMIZATION false)
|
||||
endif()
|
||||
|
||||
install(TARGETS wdsp DESTINATION ${INSTALL_LIB_DIR})
|
||||
|
||||
if (LINUX)
|
||||
add_executable(wdsp_make_interface
|
||||
make_interface.cpp
|
||||
)
|
||||
|
||||
add_executable(wdsp_make_calculus
|
||||
make_calculus.cpp
|
||||
)
|
||||
install(TARGETS wdsp_make_interface wdsp_make_calculus DESTINATION ${INSTALL_BIN_DIR})
|
||||
endif()
|
||||
|
340
wdsp/COPYING
Normal file
340
wdsp/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
5
wdsp/README.md
Normal file
5
wdsp/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# wdsp
|
||||
WDSP by Warren Pratt, NR0V
|
||||
DSP Library originally written for Windows
|
||||
Ported to Linux and Android by John Melton g0orx/n6lyt
|
||||
Adapted to SDRangel by Edouard Griffiths, F4EXB
|
1045
wdsp/RXA.cpp
Normal file
1045
wdsp/RXA.cpp
Normal file
File diff suppressed because it is too large
Load Diff
243
wdsp/RXA.hpp
Normal file
243
wdsp/RXA.hpp
Normal file
@ -0,0 +1,243 @@
|
||||
/* RXA.h
|
||||
|
||||
This file is part of a program that implements a Software-Defined Radio.
|
||||
|
||||
Copyright (C) 2013, 2014, 2015, 2016 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
|
||||
|
||||
*/
|
||||
|
||||
#ifndef wdsp_rxa_h
|
||||
#define wdsp_rxa_h
|
||||
|
||||
#include <QRecursiveMutex>
|
||||
|
||||
#include "comm.hpp"
|
||||
#include "unit.hpp"
|
||||
#include "export.h"
|
||||
|
||||
namespace WDSP {
|
||||
|
||||
class METER;
|
||||
class SHIFT;
|
||||
class RESAMPLE;
|
||||
class GEN;
|
||||
class BANDPASS;
|
||||
class BPS;
|
||||
class SNB;
|
||||
class NOTCHDB;
|
||||
class NBP;
|
||||
class BPSNBA;
|
||||
class SNBA;
|
||||
class SENDER;
|
||||
class AMSQ;
|
||||
class AMD;
|
||||
class FMD;
|
||||
class FMSQ;
|
||||
class EQP;
|
||||
class ANF;
|
||||
class ANR;
|
||||
class EMNR;
|
||||
class WCPAGC;
|
||||
class SPEAK;
|
||||
class MPEAK;
|
||||
class PANEL;
|
||||
class SIPHON;
|
||||
class CBL;
|
||||
class SSQL;
|
||||
|
||||
class WDSP_API RXA : public Unit
|
||||
{
|
||||
public:
|
||||
enum rxaMode
|
||||
{
|
||||
RXA_LSB,
|
||||
RXA_USB,
|
||||
RXA_DSB,
|
||||
RXA_CWL,
|
||||
RXA_CWU,
|
||||
RXA_FM,
|
||||
RXA_AM,
|
||||
RXA_DIGU,
|
||||
RXA_SPEC,
|
||||
RXA_DIGL,
|
||||
RXA_SAM,
|
||||
RXA_DRM
|
||||
};
|
||||
|
||||
enum rxaMeterType
|
||||
{
|
||||
RXA_S_PK,
|
||||
RXA_S_AV,
|
||||
RXA_ADC_PK,
|
||||
RXA_ADC_AV,
|
||||
RXA_AGC_GAIN,
|
||||
RXA_AGC_PK,
|
||||
RXA_AGC_AV,
|
||||
RXA_METERTYPE_LAST
|
||||
};
|
||||
|
||||
double* inbuff;
|
||||
double* outbuff;
|
||||
double* midbuff;
|
||||
int mode;
|
||||
double meter[RXA_METERTYPE_LAST];
|
||||
QRecursiveMutex* pmtupdate[RXA_METERTYPE_LAST];
|
||||
struct
|
||||
{
|
||||
METER *p;
|
||||
} smeter, adcmeter, agcmeter;
|
||||
struct
|
||||
{
|
||||
SHIFT *p;
|
||||
} shift;
|
||||
struct
|
||||
{
|
||||
RESAMPLE *p;
|
||||
} rsmpin, rsmpout;
|
||||
struct
|
||||
{
|
||||
GEN *p;
|
||||
} gen0;
|
||||
struct
|
||||
{
|
||||
BANDPASS *p;
|
||||
} bp1;
|
||||
struct
|
||||
{
|
||||
BPS *p;
|
||||
} bps1;
|
||||
struct
|
||||
{
|
||||
NOTCHDB *p;
|
||||
} ndb;
|
||||
struct
|
||||
{
|
||||
NBP *p;
|
||||
} nbp0;
|
||||
struct
|
||||
{
|
||||
BPSNBA *p;
|
||||
} bpsnba;
|
||||
struct
|
||||
{
|
||||
SNBA *p;
|
||||
} snba;
|
||||
struct
|
||||
{
|
||||
SENDER *p;
|
||||
} sender;
|
||||
struct
|
||||
{
|
||||
AMSQ *p;
|
||||
} amsq;
|
||||
struct
|
||||
{
|
||||
AMD *p;
|
||||
} amd;
|
||||
struct
|
||||
{
|
||||
FMD *p;
|
||||
} fmd;
|
||||
struct
|
||||
{
|
||||
FMSQ *p;
|
||||
} fmsq;
|
||||
struct
|
||||
{
|
||||
EQP *p;
|
||||
} eqp;
|
||||
struct
|
||||
{
|
||||
ANF *p;
|
||||
} anf;
|
||||
struct
|
||||
{
|
||||
ANR *p;
|
||||
} anr;
|
||||
struct
|
||||
{
|
||||
EMNR *p;
|
||||
} emnr;
|
||||
struct
|
||||
{
|
||||
WCPAGC *p;
|
||||
} agc;
|
||||
struct
|
||||
{
|
||||
SPEAK *p;
|
||||
} speak;
|
||||
struct
|
||||
{
|
||||
MPEAK *p;
|
||||
} mpeak;
|
||||
struct
|
||||
{
|
||||
PANEL *p;
|
||||
} panel;
|
||||
struct
|
||||
{
|
||||
SIPHON *p;
|
||||
} sip1;
|
||||
struct
|
||||
{
|
||||
CBL *p;
|
||||
} cbl;
|
||||
struct
|
||||
{
|
||||
SSQL *p;
|
||||
} ssql;
|
||||
|
||||
static RXA* create_rxa (
|
||||
int in_rate, // input samplerate
|
||||
int out_rate, // output samplerate
|
||||
int in_size, // input buffsize (complex samples) in a fexchange() operation
|
||||
int dsp_rate, // sample rate for mainstream dsp processing
|
||||
int dsp_size, // number complex samples processed per buffer in mainstream dsp processing
|
||||
int dsp_insize, // size (complex samples) of the output of the r1 (input) buffer
|
||||
int dsp_outsize, // size (complex samples) of the input of the r2 (output) buffer
|
||||
int out_size // output buffsize (complex samples) in a fexchange() operation
|
||||
);
|
||||
static void destroy_rxa (RXA *rxa);
|
||||
static void flush_rxa (RXA *rxa);
|
||||
static void xrxa (RXA *rxa);
|
||||
static void setInputSamplerate (RXA *rxa, int dsp_insize, int in_rate);
|
||||
static void setOutputSamplerate (RXA *rxa, int dsp_outsize, int out_rate);
|
||||
static void setDSPSamplerate (RXA *rxa, int dsp_insize, int dsp_outsize, int dsp_rate);
|
||||
static void setDSPBuffsize (RXA *rxa, int dsp_insize, int dsp_size, int dsp_outsize);
|
||||
|
||||
// RXA Properties
|
||||
static void SetMode (RXA& rxa, int mode);
|
||||
static void ResCheck (RXA& rxa);
|
||||
static void bp1Check (RXA& rxa, int amd_run, int snba_run, int emnr_run, int anf_run, int anr_run);
|
||||
static void bp1Set (RXA& rxa);
|
||||
static void bpsnbaCheck (RXA& rxa, int mode, int notch_run);
|
||||
static void bpsnbaSet (RXA& rxa);
|
||||
|
||||
// Collectives
|
||||
static void SetPassband (RXA& rxa, double f_low, double f_high);
|
||||
static void SetNC (RXA& rxa, int nc);
|
||||
static void SetMP (RXA& rxa, int mp);
|
||||
};
|
||||
|
||||
} // namespace WDSP
|
||||
|
||||
#endif
|
998
wdsp/TXA.cpp
Normal file
998
wdsp/TXA.cpp
Normal file
@ -0,0 +1,998 @@
|
||||
/* TXA.c
|
||||
|
||||
This file is part of a program that implements a Software-Defined Radio.
|
||||
|
||||
Copyright (C) 2013, 2014, 2016, 2017, 2021, 2023 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 "ammod.hpp"
|
||||
#include "meter.hpp"
|
||||
#include "resample.hpp"
|
||||
#include "patchpanel.hpp"
|
||||
#include "amsq.hpp"
|
||||
#include "eq.hpp"
|
||||
#include "iir.hpp"
|
||||
#include "cfcomp.hpp"
|
||||
#include "compress.hpp"
|
||||
#include "bandpass.hpp"
|
||||
#include "bps.hpp"
|
||||
#include "osctrl.hpp"
|
||||
#include "wcpAGC.hpp"
|
||||
#include "emph.hpp"
|
||||
#include "fmmod.hpp"
|
||||
#include "siphon.hpp"
|
||||
#include "gen.hpp"
|
||||
#include "slew.hpp"
|
||||
#include "iqc.hpp"
|
||||
#include "cfir.hpp"
|
||||
#include "TXA.hpp"
|
||||
|
||||
namespace WDSP {
|
||||
|
||||
TXA* TXA::create_txa (
|
||||
int in_rate, // input samplerate
|
||||
int out_rate, // output samplerate
|
||||
int in_size, // input buffsize (complex samples) in a fexchange() operation
|
||||
int dsp_rate, // sample rate for mainstream dsp processing
|
||||
int dsp_size, // number complex samples processed per buffer in mainstream dsp processing
|
||||
int dsp_insize, // size (complex samples) of the output of the r1 (input) buffer
|
||||
int dsp_outsize, // size (complex samples) of the input of the r2 (output) buffer
|
||||
int out_size // output buffsize (complex samples) in a fexchange() operation
|
||||
)
|
||||
{
|
||||
TXA *txa = new TXA;
|
||||
|
||||
txa->in_rate = in_rate;
|
||||
txa->out_rate = out_rate;
|
||||
txa->in_size = in_size;
|
||||
txa->dsp_rate = dsp_rate;
|
||||
txa->dsp_size = dsp_size;
|
||||
txa->dsp_insize = dsp_insize;
|
||||
txa->dsp_outsize = dsp_outsize;
|
||||
txa->out_size = out_size;
|
||||
|
||||
txa->mode = TXA_LSB;
|
||||
txa->f_low = -5000.0;
|
||||
txa->f_high = - 100.0;
|
||||
txa->inbuff = new double[1 * txa->dsp_insize * 2]; // (double *) malloc0 (1 * txa->dsp_insize * sizeof (complex));
|
||||
txa->outbuff = new double[1 * txa->dsp_outsize * 2]; // (double *) malloc0 (1 * txa->dsp_outsize * sizeof (complex));
|
||||
txa->midbuff = new double[3 * txa->dsp_size * 2]; //(double *) malloc0 (2 * txa->dsp_size * sizeof (complex));
|
||||
|
||||
txa->rsmpin.p = RESAMPLE::create_resample (
|
||||
0, // run - will be turned on below if needed
|
||||
txa->dsp_insize, // input buffer size
|
||||
txa->inbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
txa->in_rate, // input sample rate
|
||||
txa->dsp_rate, // output sample rate
|
||||
0.0, // select cutoff automatically
|
||||
0, // select ncoef automatically
|
||||
1.0); // gain
|
||||
|
||||
txa->gen0.p = GEN::create_gen (
|
||||
0, // run
|
||||
txa->dsp_size, // buffer size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
txa->dsp_rate, // sample rate
|
||||
2); // mode
|
||||
|
||||
txa->panel.p = PANEL::create_panel (
|
||||
1, // run
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
1.0, // gain1
|
||||
1.0, // gain2I
|
||||
1.0, // gain2Q
|
||||
2, // 1 to use Q, 2 to use I for input
|
||||
0); // 0, no copy
|
||||
|
||||
txa->phrot.p = PHROT::create_phrot (
|
||||
0, // run
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
338.0, // 1/2 of phase frequency
|
||||
8); // number of stages
|
||||
|
||||
txa->micmeter.p = METER::create_meter (
|
||||
1, // run
|
||||
0, // optional pointer to another 'run'
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
0.100, // averaging time constant
|
||||
0.100, // peak decay time constant
|
||||
txa->meter, // result vector
|
||||
txa->pmtupdate, // locks for meter access
|
||||
TXA_MIC_AV, // index for average value
|
||||
TXA_MIC_PK, // index for peak value
|
||||
-1, // index for gain value
|
||||
0); // pointer for gain computation
|
||||
|
||||
txa->amsq.p = AMSQ::create_amsq (
|
||||
0, // run
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
txa->midbuff, // trigger buffer
|
||||
txa->dsp_rate, // sample rate
|
||||
0.010, // time constant for averaging signal
|
||||
0.004, // up-slew time
|
||||
0.004, // down-slew time
|
||||
0.180, // signal level to initiate tail
|
||||
0.200, // signal level to initiate unmute
|
||||
0.000, // minimum tail length
|
||||
0.025, // maximum tail length
|
||||
0.200); // muted gain
|
||||
|
||||
{
|
||||
double default_F[11] = {0.0, 32.0, 63.0, 125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0, 16000.0};
|
||||
double default_G[11] = {0.0, -12.0, -12.0, -12.0, -1.0, +1.0, +4.0, +9.0, +12.0, -10.0, -10.0};
|
||||
//double default_G[11] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
||||
txa->eqp.p = EQP::create_eqp (
|
||||
0, // run - OFF by default
|
||||
txa->dsp_size, // size
|
||||
std::max(2048, txa->dsp_size), // number of filter coefficients
|
||||
0, // minimum phase flag
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
10, // nfreqs
|
||||
default_F, // vector of frequencies
|
||||
default_G, // vector of gain values
|
||||
0, // cutoff mode
|
||||
0, // wintype
|
||||
txa->dsp_rate); // samplerate
|
||||
}
|
||||
|
||||
txa->eqmeter.p = METER::create_meter (
|
||||
1, // run
|
||||
&(txa->eqp.p->run), // pointer to eqp 'run'
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
0.100, // averaging time constant
|
||||
0.100, // peak decay time constant
|
||||
txa->meter, // result vector
|
||||
txa->pmtupdate, // locks for meter access
|
||||
TXA_EQ_AV, // index for average value
|
||||
TXA_EQ_PK, // index for peak value
|
||||
-1, // index for gain value
|
||||
0); // pointer for gain computation
|
||||
|
||||
txa->preemph.p = EMPHP::create_emphp (
|
||||
0, // run
|
||||
1, // position
|
||||
txa->dsp_size, // size
|
||||
std::max(2048, txa->dsp_size), // number of filter coefficients
|
||||
0, // minimum phase flag
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer,
|
||||
txa->dsp_rate, // sample rate
|
||||
0, // pre-emphasis type
|
||||
300.0, // f_low
|
||||
3000.0); // f_high
|
||||
|
||||
txa->leveler.p = WCPAGC::create_wcpagc (
|
||||
0, // run - OFF by default
|
||||
5, // mode
|
||||
0, // 0 for max(I,Q), 1 for envelope
|
||||
txa->midbuff, // input buff pointer
|
||||
txa->midbuff, // output buff pointer
|
||||
txa->dsp_size, // io_buffsize
|
||||
txa->dsp_rate, // sample rate
|
||||
0.001, // tau_attack
|
||||
0.500, // tau_decay
|
||||
6, // n_tau
|
||||
1.778, // max_gain
|
||||
1.0, // var_gain
|
||||
1.0, // fixed_gain
|
||||
1.0, // max_input
|
||||
1.05, // out_targ
|
||||
0.250, // tau_fast_backaverage
|
||||
0.005, // tau_fast_decay
|
||||
5.0, // pop_ratio
|
||||
0, // hang_enable
|
||||
0.500, // tau_hang_backmult
|
||||
0.500, // hangtime
|
||||
2.000, // hang_thresh
|
||||
0.100); // tau_hang_decay
|
||||
|
||||
txa->lvlrmeter.p = METER::create_meter (
|
||||
1, // run
|
||||
&(txa->leveler.p->run), // pointer to leveler 'run'
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
0.100, // averaging time constant
|
||||
0.100, // peak decay time constant
|
||||
txa->meter, // result vector
|
||||
txa->pmtupdate, // locks for meter access
|
||||
TXA_LVLR_AV, // index for average value
|
||||
TXA_LVLR_PK, // index for peak value
|
||||
TXA_LVLR_GAIN, // index for gain value
|
||||
&txa->leveler.p->gain); // pointer for gain computation
|
||||
|
||||
{
|
||||
double default_F[5] = {200.0, 1000.0, 2000.0, 3000.0, 4000.0};
|
||||
double default_G[5] = {0.0, 5.0, 10.0, 10.0, 5.0};
|
||||
double default_E[5] = {7.0, 7.0, 7.0, 7.0, 7.0};
|
||||
txa->cfcomp.p = CFCOMP::create_cfcomp(
|
||||
0, // run
|
||||
0, // position
|
||||
0, // post-equalizer run
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
2048, // fft size
|
||||
4, // overlap
|
||||
txa->dsp_rate, // samplerate
|
||||
1, // window type
|
||||
0, // compression method
|
||||
5, // nfreqs
|
||||
0.0, // pre-compression
|
||||
0.0, // pre-postequalization
|
||||
default_F, // frequency array
|
||||
default_G, // compression array
|
||||
default_E, // eq array
|
||||
0.25, // metering time constant
|
||||
0.50); // display time constant
|
||||
}
|
||||
|
||||
txa->cfcmeter.p = METER::create_meter (
|
||||
1, // run
|
||||
&(txa->cfcomp.p->run), // pointer to eqp 'run'
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
0.100, // averaging time constant
|
||||
0.100, // peak decay time constant
|
||||
txa->meter, // result vector
|
||||
txa->pmtupdate, // locks for meter access
|
||||
TXA_CFC_AV, // index for average value
|
||||
TXA_CFC_PK, // index for peak value
|
||||
TXA_CFC_GAIN, // index for gain value
|
||||
&txa->cfcomp.p->gain); // pointer for gain computation
|
||||
|
||||
txa->bp0.p = BANDPASS::create_bandpass (
|
||||
1, // always runs
|
||||
0, // position
|
||||
txa->dsp_size, // size
|
||||
std::max(2048, txa->dsp_size), // number of coefficients
|
||||
0, // flag for minimum phase
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
txa->f_low, // low freq cutoff
|
||||
txa->f_high, // high freq cutoff
|
||||
txa->dsp_rate, // samplerate
|
||||
1, // wintype
|
||||
2.0); // gain
|
||||
|
||||
txa->compressor.p = COMPRESSOR::create_compressor (
|
||||
0, // run - OFF by default
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
3.0); // gain
|
||||
|
||||
txa->bp1.p = BANDPASS::create_bandpass (
|
||||
0, // ONLY RUNS WHEN COMPRESSOR IS USED
|
||||
0, // position
|
||||
txa->dsp_size, // size
|
||||
std::max(2048, txa->dsp_size), // number of coefficients
|
||||
0, // flag for minimum phase
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
txa->f_low, // low freq cutoff
|
||||
txa->f_high, // high freq cutoff
|
||||
txa->dsp_rate, // samplerate
|
||||
1, // wintype
|
||||
2.0); // gain
|
||||
|
||||
txa->osctrl.p = OSCTRL::create_osctrl (
|
||||
0, // run
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
txa->dsp_rate, // sample rate
|
||||
1.95); // gain for clippings
|
||||
|
||||
txa->bp2.p = BANDPASS::create_bandpass (
|
||||
0, // ONLY RUNS WHEN COMPRESSOR IS USED
|
||||
0, // position
|
||||
txa->dsp_size, // size
|
||||
std::max(2048, txa->dsp_size), // number of coefficients
|
||||
0, // flag for minimum phase
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
txa->f_low, // low freq cutoff
|
||||
txa->f_high, // high freq cutoff
|
||||
txa->dsp_rate, // samplerate
|
||||
1, // wintype
|
||||
1.0); // gain
|
||||
|
||||
txa->compmeter.p = METER::create_meter (
|
||||
1, // run
|
||||
&(txa->compressor.p->run), // pointer to compressor 'run'
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
0.100, // averaging time constant
|
||||
0.100, // peak decay time constant
|
||||
txa->meter, // result vector
|
||||
txa->pmtupdate, // locks for meter access
|
||||
TXA_COMP_AV, // index for average value
|
||||
TXA_COMP_PK, // index for peak value
|
||||
-1, // index for gain value
|
||||
0); // pointer for gain computation
|
||||
|
||||
txa->alc.p = WCPAGC::create_wcpagc (
|
||||
1, // run - always ON
|
||||
5, // mode
|
||||
1, // 0 for max(I,Q), 1 for envelope
|
||||
txa->midbuff, // input buff pointer
|
||||
txa->midbuff, // output buff pointer
|
||||
txa->dsp_size, // io_buffsize
|
||||
txa->dsp_rate, // sample rate
|
||||
0.001, // tau_attack
|
||||
0.010, // tau_decay
|
||||
6, // n_tau
|
||||
1.0, // max_gain
|
||||
1.0, // var_gain
|
||||
1.0, // fixed_gain
|
||||
1.0, // max_input
|
||||
1.0, // out_targ
|
||||
0.250, // tau_fast_backaverage
|
||||
0.005, // tau_fast_decay
|
||||
5.0, // pop_ratio
|
||||
0, // hang_enable
|
||||
0.500, // tau_hang_backmult
|
||||
0.500, // hangtime
|
||||
2.000, // hang_thresh
|
||||
0.100); // tau_hang_decay
|
||||
|
||||
txa->ammod.p = AMMOD::create_ammod (
|
||||
0, // run - OFF by default
|
||||
0, // mode: 0=>AM, 1=>DSB
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to output buffer
|
||||
0.5); // carrier level
|
||||
|
||||
|
||||
txa->fmmod.p = FMMOD::create_fmmod (
|
||||
0, // run - OFF by default
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
5000.0, // deviation
|
||||
300.0, // low cutoff frequency
|
||||
3000.0, // high cutoff frequency
|
||||
1, // ctcss run control
|
||||
0.10, // ctcss level
|
||||
100.0, // ctcss frequency
|
||||
1, // run bandpass filter
|
||||
std::max(2048, txa->dsp_size), // number coefficients for bandpass filter
|
||||
0); // minimum phase flag
|
||||
|
||||
txa->gen1.p = GEN::create_gen (
|
||||
0, // run
|
||||
txa->dsp_size, // buffer size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
txa->dsp_rate, // sample rate
|
||||
0); // mode
|
||||
|
||||
txa->uslew.p = USLEW::create_uslew (
|
||||
txa,
|
||||
&(txa->upslew), // pointer to channel upslew flag
|
||||
txa->dsp_size, // buffer size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
txa->dsp_rate, // sample rate
|
||||
0.000, // delay time
|
||||
0.005); // upslew time
|
||||
|
||||
txa->alcmeter.p = METER::create_meter (
|
||||
1, // run
|
||||
0, // optional pointer to a 'run'
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // pointer to buffer
|
||||
txa->dsp_rate, // samplerate
|
||||
0.100, // averaging time constant
|
||||
0.100, // peak decay time constant
|
||||
txa->meter, // result vector
|
||||
txa->pmtupdate, // locks for meter access
|
||||
TXA_ALC_AV, // index for average value
|
||||
TXA_ALC_PK, // index for peak value
|
||||
TXA_ALC_GAIN, // index for gain value
|
||||
&txa->alc.p->gain); // pointer for gain computation
|
||||
|
||||
txa->sip1.p = SIPHON::create_siphon (
|
||||
1, // run
|
||||
0, // position
|
||||
0, // mode
|
||||
0, // disp
|
||||
txa->dsp_size, // input buffer size
|
||||
txa->midbuff, // input buffer
|
||||
16384, // number of samples to buffer
|
||||
16384, // fft size for spectrum
|
||||
1); // specmode
|
||||
|
||||
// txa->calcc.p = create_calcc (
|
||||
// channel, // channel number
|
||||
// 1, // run calibration
|
||||
// 1024, // input buffer size
|
||||
// txa->in_rate, // samplerate
|
||||
// 16, // ints
|
||||
// 256, // spi
|
||||
// (1.0 / 0.4072), // hw_scale
|
||||
// 0.1, // mox delay
|
||||
// 0.0, // loop delay
|
||||
// 0.8, // ptol
|
||||
// 0, // mox
|
||||
// 0, // solidmox
|
||||
// 1, // pin mode
|
||||
// 1, // map mode
|
||||
// 0, // stbl mode
|
||||
// 256, // pin samples
|
||||
// 0.9); // alpha
|
||||
|
||||
txa->iqc.p0 = txa->iqc.p1 = IQC::create_iqc (
|
||||
0, // run
|
||||
txa->dsp_size, // size
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
(double)txa->dsp_rate, // sample rate
|
||||
16, // ints
|
||||
0.005, // changeover time
|
||||
256); // spi
|
||||
|
||||
txa->cfir.p = CFIR::create_cfir(
|
||||
0, // run
|
||||
txa->dsp_size, // size
|
||||
std::max(2048, txa->dsp_size), // number of filter coefficients
|
||||
0, // minimum phase flag
|
||||
txa->midbuff, // input buffer
|
||||
txa->midbuff, // output buffer
|
||||
txa->dsp_rate, // input sample rate
|
||||
txa->out_rate, // CIC input sample rate
|
||||
1, // CIC differential delay
|
||||
640, // CIC interpolation factor
|
||||
5, // CIC integrator-comb pairs
|
||||
20000.0, // cutoff frequency
|
||||
2, // brick-wall windowed rolloff
|
||||
0.0, // raised-cosine transition width
|
||||
0); // window type
|
||||
|
||||
txa->rsmpout.p = RESAMPLE::create_resample (
|
||||
0, // run - will be turned ON below if needed
|
||||
txa->dsp_size, // input size
|
||||
txa->midbuff, // pointer to input buffer
|
||||
txa->outbuff, // pointer to output buffer
|
||||
txa->dsp_rate, // input sample rate
|
||||
txa->out_rate, // output sample rate
|
||||
0.0, // select cutoff automatically
|
||||
0, // select ncoef automatically
|
||||
0.980); // gain
|
||||
|
||||
txa->outmeter.p = METER::create_meter (
|
||||
1, // run
|
||||
0, // optional pointer to another 'run'
|
||||
txa->dsp_outsize, // size
|
||||
txa->outbuff, // pointer to buffer
|
||||
txa->out_rate, // samplerate
|
||||
0.100, // averaging time constant
|
||||
0.100, // peak decay time constant
|
||||
txa->meter, // result vector
|
||||
txa->pmtupdate, // locks for meter access
|
||||
TXA_OUT_AV, // index for average value
|
||||
TXA_OUT_PK, // index for peak value
|
||||
-1, // index for gain value
|
||||
0); // pointer for gain computation
|
||||
|
||||
// turn OFF / ON resamplers as needed
|
||||
ResCheck (*txa);
|
||||
return txa;
|
||||
}
|
||||
|
||||
void TXA::destroy_txa (TXA *txa)
|
||||
{
|
||||
// in reverse order, free each item we created
|
||||
METER::destroy_meter (txa->outmeter.p);
|
||||
RESAMPLE::destroy_resample (txa->rsmpout.p);
|
||||
CFIR::destroy_cfir(txa->cfir.p);
|
||||
// destroy_calcc (txa->calcc.p);
|
||||
IQC::destroy_iqc (txa->iqc.p0);
|
||||
SIPHON::destroy_siphon (txa->sip1.p);
|
||||
METER::destroy_meter (txa->alcmeter.p);
|
||||
USLEW::destroy_uslew (txa->uslew.p);
|
||||
GEN::destroy_gen (txa->gen1.p);
|
||||
FMMOD::destroy_fmmod (txa->fmmod.p);
|
||||
AMMOD::destroy_ammod (txa->ammod.p);
|
||||
WCPAGC::destroy_wcpagc (txa->alc.p);
|
||||
METER::destroy_meter (txa->compmeter.p);
|
||||
BANDPASS::destroy_bandpass (txa->bp2.p);
|
||||
OSCTRL::destroy_osctrl (txa->osctrl.p);
|
||||
BANDPASS::destroy_bandpass (txa->bp1.p);
|
||||
COMPRESSOR::destroy_compressor (txa->compressor.p);
|
||||
BANDPASS::destroy_bandpass (txa->bp0.p);
|
||||
METER::destroy_meter (txa->cfcmeter.p);
|
||||
CFCOMP::destroy_cfcomp (txa->cfcomp.p);
|
||||
METER::destroy_meter (txa->lvlrmeter.p);
|
||||
WCPAGC::destroy_wcpagc (txa->leveler.p);
|
||||
EMPHP::destroy_emphp (txa->preemph.p);
|
||||
METER::destroy_meter (txa->eqmeter.p);
|
||||
EQP::destroy_eqp (txa->eqp.p);
|
||||
AMSQ::destroy_amsq (txa->amsq.p);
|
||||
METER::destroy_meter (txa->micmeter.p);
|
||||
PHROT::destroy_phrot (txa->phrot.p);
|
||||
PANEL::destroy_panel (txa->panel.p);
|
||||
GEN::destroy_gen (txa->gen0.p);
|
||||
RESAMPLE::destroy_resample (txa->rsmpin.p);
|
||||
delete[] (txa->midbuff);
|
||||
delete[] (txa->outbuff);
|
||||
delete[] (txa->inbuff);
|
||||
delete txa;
|
||||
}
|
||||
|
||||
void flush_txa (TXA* txa)
|
||||
{
|
||||
memset (txa->inbuff, 0, 1 * txa->dsp_insize * sizeof (dcomplex));
|
||||
memset (txa->outbuff, 0, 1 * txa->dsp_outsize * sizeof (dcomplex));
|
||||
memset (txa->midbuff, 0, 2 * txa->dsp_size * sizeof (dcomplex));
|
||||
RESAMPLE::flush_resample (txa->rsmpin.p);
|
||||
GEN::flush_gen (txa->gen0.p);
|
||||
PANEL::flush_panel (txa->panel.p);
|
||||
PHROT::flush_phrot (txa->phrot.p);
|
||||
METER::flush_meter (txa->micmeter.p);
|
||||
AMSQ::flush_amsq (txa->amsq.p);
|
||||
EQP::flush_eqp (txa->eqp.p);
|
||||
METER::flush_meter (txa->eqmeter.p);
|
||||
EMPHP::flush_emphp (txa->preemph.p);
|
||||
WCPAGC::flush_wcpagc (txa->leveler.p);
|
||||
METER::flush_meter (txa->lvlrmeter.p);
|
||||
CFCOMP::flush_cfcomp (txa->cfcomp.p);
|
||||
METER::flush_meter (txa->cfcmeter.p);
|
||||
BANDPASS::flush_bandpass (txa->bp0.p);
|
||||
COMPRESSOR::flush_compressor (txa->compressor.p);
|
||||
BANDPASS::flush_bandpass (txa->bp1.p);
|
||||
OSCTRL::flush_osctrl (txa->osctrl.p);
|
||||
BANDPASS::flush_bandpass (txa->bp2.p);
|
||||
METER::flush_meter (txa->compmeter.p);
|
||||
WCPAGC::flush_wcpagc (txa->alc.p);
|
||||
AMMOD::flush_ammod (txa->ammod.p);
|
||||
FMMOD::flush_fmmod (txa->fmmod.p);
|
||||
GEN::flush_gen (txa->gen1.p);
|
||||
USLEW::flush_uslew (txa->uslew.p);
|
||||
METER::flush_meter (txa->alcmeter.p);
|
||||
SIPHON::flush_siphon (txa->sip1.p);
|
||||
IQC::flush_iqc (txa->iqc.p0);
|
||||
CFIR::flush_cfir(txa->cfir.p);
|
||||
RESAMPLE::flush_resample (txa->rsmpout.p);
|
||||
METER::flush_meter (txa->outmeter.p);
|
||||
}
|
||||
|
||||
void xtxa (TXA* txa)
|
||||
{
|
||||
RESAMPLE::xresample (txa->rsmpin.p); // input resampler
|
||||
GEN::xgen (txa->gen0.p); // input signal generator
|
||||
PANEL::xpanel (txa->panel.p); // includes MIC gain
|
||||
PHROT::xphrot (txa->phrot.p); // phase rotator
|
||||
METER::xmeter (txa->micmeter.p); // MIC meter
|
||||
AMSQ::xamsqcap (txa->amsq.p); // downward expander capture
|
||||
AMSQ::xamsq (txa->amsq.p); // downward expander action
|
||||
EQP::xeqp (txa->eqp.p); // pre-EQ
|
||||
METER::xmeter (txa->eqmeter.p); // EQ meter
|
||||
EMPHP::xemphp (txa->preemph.p, 0); // FM pre-emphasis (first option)
|
||||
WCPAGC::xwcpagc (txa->leveler.p); // Leveler
|
||||
METER::xmeter (txa->lvlrmeter.p); // Leveler Meter
|
||||
CFCOMP::xcfcomp (txa->cfcomp.p, 0); // Continuous Frequency Compressor with post-EQ
|
||||
METER::xmeter (txa->cfcmeter.p); // CFC+PostEQ Meter
|
||||
BANDPASS::xbandpass (txa->bp0.p, 0); // primary bandpass filter
|
||||
COMPRESSOR::xcompressor (txa->compressor.p); // COMP compressor
|
||||
BANDPASS::xbandpass (txa->bp1.p, 0); // aux bandpass (runs if COMP)
|
||||
OSCTRL::xosctrl (txa->osctrl.p); // CESSB Overshoot Control
|
||||
BANDPASS::xbandpass (txa->bp2.p, 0); // aux bandpass (runs if CESSB)
|
||||
METER::xmeter (txa->compmeter.p); // COMP meter
|
||||
WCPAGC::xwcpagc (txa->alc.p); // ALC
|
||||
AMMOD::xammod (txa->ammod.p); // AM Modulator
|
||||
EMPHP::xemphp (txa->preemph.p, 1); // FM pre-emphasis (second option)
|
||||
FMMOD::xfmmod (txa->fmmod.p); // FM Modulator
|
||||
GEN::xgen (txa->gen1.p); // output signal generator (TUN and Two-tone)
|
||||
USLEW::xuslew (txa->uslew.p); // up-slew for AM, FM, and gens
|
||||
METER::xmeter (txa->alcmeter.p); // ALC Meter
|
||||
SIPHON::xsiphon (txa->sip1.p, 0); // siphon data for display
|
||||
IQC::xiqc (txa->iqc.p0); // PureSignal correction
|
||||
CFIR::xcfir(txa->cfir.p); // compensating FIR filter (used Protocol_2 only)
|
||||
RESAMPLE::xresample (txa->rsmpout.p); // output resampler
|
||||
METER::xmeter (txa->outmeter.p); // output meter
|
||||
// print_peak_env ("env_exception.txt", txa->dsp_outsize, txa->outbuff, 0.7);
|
||||
}
|
||||
|
||||
void TXA::setInputSamplerate (TXA *txa, int dsp_insize, int in_rate)
|
||||
{
|
||||
txa->csDSP.lock();
|
||||
txa->dsp_insize = dsp_insize;
|
||||
txa->in_rate = in_rate;
|
||||
// buffers
|
||||
delete[] (txa->inbuff);
|
||||
txa->inbuff = new double[1 * txa->dsp_insize * 2]; //(double *)malloc0(1 * txa->dsp_insize * sizeof(complex));
|
||||
// input resampler
|
||||
RESAMPLE::setBuffers_resample (txa->rsmpin.p, txa->inbuff, txa->midbuff);
|
||||
RESAMPLE::setSize_resample (txa->rsmpin.p, txa->dsp_insize);
|
||||
RESAMPLE::setInRate_resample (txa->rsmpin.p, txa->in_rate);
|
||||
ResCheck (*txa);
|
||||
txa->csDSP.unlock();
|
||||
}
|
||||
|
||||
void TXA::setOutputSamplerate (TXA* txa, int dsp_outsize, int out_rate)
|
||||
{
|
||||
txa->csDSP.lock();
|
||||
txa->dsp_outsize = dsp_outsize;
|
||||
txa->out_rate = out_rate;
|
||||
// buffers
|
||||
delete[] (txa->outbuff);
|
||||
txa->outbuff = new double[1 * txa->dsp_outsize * 2]; // (double *)malloc0(1 * txa->dsp_outsize * sizeof(complex));
|
||||
// cfir - needs to know input rate of firmware CIC
|
||||
CFIR::setOutRate_cfir (txa->cfir.p, txa->out_rate);
|
||||
// output resampler
|
||||
RESAMPLE::setBuffers_resample (txa->rsmpout.p, txa->midbuff, txa->outbuff);
|
||||
RESAMPLE::setOutRate_resample (txa->rsmpout.p, txa->out_rate);
|
||||
ResCheck (*txa);
|
||||
// output meter
|
||||
METER::setBuffers_meter (txa->outmeter.p, txa->outbuff);
|
||||
METER::setSize_meter (txa->outmeter.p, txa->dsp_outsize);
|
||||
METER::setSamplerate_meter (txa->outmeter.p, txa->out_rate);
|
||||
txa->csDSP.unlock();
|
||||
}
|
||||
|
||||
void TXA::setDSPSamplerate (TXA *txa, int dsp_insize, int dsp_outsize, int dsp_rate)
|
||||
{
|
||||
txa->csDSP.lock();
|
||||
txa->dsp_insize = dsp_insize;
|
||||
txa->dsp_outsize = dsp_outsize;
|
||||
txa->dsp_rate = dsp_rate;
|
||||
// buffers
|
||||
delete[] (txa->inbuff);
|
||||
txa->inbuff = new double[1 * txa->dsp_insize * 2]; // (double *)malloc0(1 * txa->dsp_insize * sizeof(complex));
|
||||
delete[] (txa->outbuff);
|
||||
txa->outbuff = new double[1 * txa->dsp_outsize * 2]; // (double *)malloc0(1 * txa->dsp_outsize * sizeof(complex));
|
||||
// input resampler
|
||||
RESAMPLE::setBuffers_resample (txa->rsmpin.p, txa->inbuff, txa->midbuff);
|
||||
RESAMPLE::setSize_resample (txa->rsmpin.p, txa->dsp_insize);
|
||||
RESAMPLE::setOutRate_resample (txa->rsmpin.p, txa->dsp_rate);
|
||||
// dsp_rate blocks
|
||||
GEN::setSamplerate_gen (txa->gen0.p, txa->dsp_rate);
|
||||
PANEL::setSamplerate_panel (txa->panel.p, txa->dsp_rate);
|
||||
PHROT::setSamplerate_phrot (txa->phrot.p, txa->dsp_rate);
|
||||
METER::setSamplerate_meter (txa->micmeter.p, txa->dsp_rate);
|
||||
AMSQ::setSamplerate_amsq (txa->amsq.p, txa->dsp_rate);
|
||||
EQP::setSamplerate_eqp (txa->eqp.p, txa->dsp_rate);
|
||||
METER::setSamplerate_meter (txa->eqmeter.p, txa->dsp_rate);
|
||||
EMPHP::setSamplerate_emphp (txa->preemph.p, txa->dsp_rate);
|
||||
WCPAGC::setSamplerate_wcpagc (txa->leveler.p, txa->dsp_rate);
|
||||
METER::setSamplerate_meter (txa->lvlrmeter.p, txa->dsp_rate);
|
||||
CFCOMP::setSamplerate_cfcomp (txa->cfcomp.p, txa->dsp_rate);
|
||||
METER::setSamplerate_meter (txa->cfcmeter.p, txa->dsp_rate);
|
||||
BANDPASS::setSamplerate_bandpass (txa->bp0.p, txa->dsp_rate);
|
||||
COMPRESSOR::setSamplerate_compressor (txa->compressor.p, txa->dsp_rate);
|
||||
BANDPASS::setSamplerate_bandpass (txa->bp1.p, txa->dsp_rate);
|
||||
OSCTRL::setSamplerate_osctrl (txa->osctrl.p, txa->dsp_rate);
|
||||