pax_global_header00006660000000000000000000000064130451177460014522gustar00rootroot0000000000000052 comment=87d52d52742e3aa01ec93f87915dbce8cbe97806 inspectrum-0.2/000077500000000000000000000000001304511774600135545ustar00rootroot00000000000000inspectrum-0.2/.gitignore000066400000000000000000000000271304511774600155430ustar00rootroot00000000000000# Build outputs build/ inspectrum-0.2/.travis.yml000066400000000000000000000023751304511774600156740ustar00rootroot00000000000000language: c cache: apt sudo: required dist: trusty os: - linux - osx compiler: - gcc - clang matrix: exclude: # /usr/bin/gcc on OS X is clang, so it's not meaningful to build against both. - os: osx compiler: gcc addons: apt: sources: # - ubuntu-sdk-team packages: - qtbase5-dev - qtdeclarative5-dev - libfftw3-dev before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi # cmake and pkg-config are already installed, liquid-dsp is handled by before_script. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt5 fftw; fi before_script: - pushd /tmp - mkdir liquid-install - git clone https://github.com/jgaeddert/liquid-dsp.git - cd liquid-dsp - ./bootstrap.sh - ./configure --prefix=/tmp/liquid-install/ - make - make install - popd script: - mkdir build - cd build - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_PREFIX_PATH=$(brew --prefix qt5)/lib/cmake; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then DYLIB_SUFFIX=dylib; else DYLIB_SUFFIX=so; fi - CFLAGS="-g -Wall -Wextra -Werror -Wno-zero-length-array" cmake -DLIQUID_LIBRARIES=/tmp/liquid-install/lib/libliquid.$DYLIB_SUFFIX -DLIQUID_INCLUDES=/tmp/liquid-install/include/ .. - make inspectrum-0.2/CMakeLists.txt000066400000000000000000000040651304511774600163210ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8) project(inspectrum CXX) enable_testing() set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) # For OSX - don't clear RPATH on install set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) if (WIN32) find_library (MMAN mman) if(NOT(MMAN)) message(FATAL_ERROR "please install mman-win32") else(NOT(MMAN)) set (extraLibs ${extraLibs} ${MMAN}) endif(NOT(MMAN)) ENDIF (WIN32) if (NOT CMAKE_CXX_FLAGS) set(CMAKE_CXX_FLAGS "-O2") endif (NOT CMAKE_CXX_FLAGS) # This only works in cmake >3.1 #set_property(TARGET inspectrum PROPERTY CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") list(APPEND inspectrum_sources abstractsamplesource.cpp amplitudedemod.cpp cursor.cpp cursors.cpp main.cpp fft.cpp frequencydemod.cpp mainwindow.cpp inputsource.cpp phasedemod.cpp plot.cpp plots.cpp plotview.cpp samplebuffer.cpp samplesource.cpp spectrogramcontrols.cpp spectrogramplot.cpp threshold.cpp traceplot.cpp tuner.cpp tunertransform.cpp util.cpp ) INCLUDE(FindPkgConfig) find_package(Qt5Widgets REQUIRED) pkg_check_modules(FFTW REQUIRED fftw3f) find_package(Liquid REQUIRED) include_directories( ${QT_INCLUDES} ${FFTW_INCLUDEDIR} ${FFTW_INCLUDE_DIRS} ${LIQUID_INCLUDES} ) link_directories( ${FFTW_LIBRARY_DIRS} ) add_executable(inspectrum ${inspectrum_sources}) qt5_use_modules(inspectrum Widgets Concurrent) target_link_libraries(inspectrum ${QT_LIBRARIES} ${FFTW_LIBRARIES} ${LIQUID_LIBRARIES} ${extraLibs} ) set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX") install(TARGETS inspectrum RUNTIME DESTINATION ${INSTALL_DEFAULT_BINDIR}) # Create uninstall target configure_file( ${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ) inspectrum-0.2/LICENSE000066400000000000000000001045051304511774600145660ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state 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 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 for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: {project} Copyright (C) {year} {fullname} This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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. But first, please read . inspectrum-0.2/README.md000066400000000000000000000022111304511774600150270ustar00rootroot00000000000000# inspectrum inspectrum is a tool for analysing captured signals, primarily from software-defined radio receivers. ![inspectrum screenshot](/screenshot.jpg) ## Try it ### Prerequisites * cmake * fftw 3.x * [liquid-dsp](https://github.com/jgaeddert/liquid-dsp) >= v1.3.0 * pkg-config * qt5 ### Build instructions Build instructions can be found here: https://github.com/miek/inspectrum/wiki/Build ### Run ./inspectrum [filename] ## Input inspectrum supports the following file types: * `*.cf32`, `*.cfile` - Complex 32-bit floating point samples (GNURadio, osmocom_fft) * `*.cs16` - Complex 16-bit signed integer samples (BladeRF) * `*.cs8` - Complex 8-bit signed integer samples (HackRF) * `*.cu8` - Complex 8-bit unsigned integer samples (RTL-SDR) If an unknown file extension is loaded, inspectrum will default to `*.cf32`. ## Features * Large (100GB+) file support * Spectrogram with zoom/pan * Plots of amplitude, frequency, phase and IQ samples * Cursors for measuring period, symbol rate and extracting symbols * Export of selected time period, filtered samples and demodulated data ## Contact * #inspectrum on freenode IRC inspectrum-0.2/abstractsamplesource.cpp000066400000000000000000000022461304511774600205120ustar00rootroot00000000000000/* * Copyright (C) 2017, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "abstractsamplesource.h" void AbstractSampleSource::subscribe(Subscriber *subscriber) { subscribers.insert(subscriber); } void AbstractSampleSource::invalidate() { for (auto subscriber : subscribers) { subscriber->invalidateEvent(); } } int AbstractSampleSource::subscriberCount() { return subscribers.size(); } void AbstractSampleSource::unsubscribe(Subscriber *subscriber) { subscribers.erase(subscriber); }inspectrum-0.2/abstractsamplesource.h000066400000000000000000000022711304511774600201550ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include #include "subscriber.h" class AbstractSampleSource { public: virtual ~AbstractSampleSource() {}; virtual std::type_index sampleType() = 0; void subscribe(Subscriber *subscriber); int subscriberCount(); void unsubscribe(Subscriber *subscriber); protected: virtual void invalidate(); private: std::set subscribers; }; inspectrum-0.2/amplitudedemod.cpp000066400000000000000000000022751304511774600172630ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "amplitudedemod.h" AmplitudeDemod::AmplitudeDemod(std::shared_ptr>> src) : SampleBuffer(src) { } void AmplitudeDemod::work(void *input, void *output, int count, off_t sampleid) { auto in = static_cast*>(input); auto out = static_cast(output); std::transform(in, in + count, out, [](std::complex s) { return std::norm(s) * 2.0f - 1.0f; }); } inspectrum-0.2/amplitudedemod.h000066400000000000000000000020201304511774600167140ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "samplebuffer.h" class AmplitudeDemod : public SampleBuffer, float> { public: AmplitudeDemod(std::shared_ptr>> src); void work(void *input, void *output, int count, off_t sampleid) override; }; inspectrum-0.2/cmake/000077500000000000000000000000001304511774600146345ustar00rootroot00000000000000inspectrum-0.2/cmake/Modules/000077500000000000000000000000001304511774600162445ustar00rootroot00000000000000inspectrum-0.2/cmake/Modules/FindFFTW.cmake000066400000000000000000000012301304511774600206110ustar00rootroot00000000000000# - Find FFTW # Find the native FFTW includes and library # # FFTW_INCLUDES - where to find fftw3.h # FFTW_LIBRARIES - List of libraries when using FFTW. # FFTW_FOUND - True if FFTW found. if (FFTW_INCLUDES) # Already in cache, be silent set (FFTW_FIND_QUIETLY TRUE) endif (FFTW_INCLUDES) find_path (FFTW_INCLUDES fftw3.h) find_library (FFTW_LIBRARIES NAMES fftw3) # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if # all listed variables are TRUE include (FindPackageHandleStandardArgs) find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDES) mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDES) inspectrum-0.2/cmake/Modules/FindLiquid.cmake000066400000000000000000000013071304511774600212770ustar00rootroot00000000000000# - Find LIQUID # Find the native LIQUID includes and library # # LIQUID_INCLUDES - where to find LIQUID.h # LIQUID_LIBRARIES - List of libraries when using LIQUID. # LIQUID_FOUND - True if LIQUID found. if (LIQUID_INCLUDES) # Already in cache, be silent set (LIQUID_FIND_QUIETLY TRUE) endif (LIQUID_INCLUDES) find_path (LIQUID_INCLUDES liquid/liquid.h) find_library (LIQUID_LIBRARIES NAMES liquid) # handle the QUIETLY and REQUIRED arguments and set LIQUID_FOUND to TRUE if # all listed variables are TRUE include (FindPackageHandleStandardArgs) find_package_handle_standard_args (LIQUID DEFAULT_MSG LIQUID_LIBRARIES LIQUID_INCLUDES) #mark_as_advanced (LIQUID_LIBRARIES LIQUID_INCLUDES) inspectrum-0.2/cmake/cmake_uninstall.cmake.in000066400000000000000000000025321304511774600214160ustar00rootroot00000000000000# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) STRING(REGEX REPLACE "\n" ";" files "${files}") FOREACH(file ${files}) MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") IF(EXISTS "$ENV{DESTDIR}${file}") EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) IF(NOT "${rm_retval}" STREQUAL 0) MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") ENDIF(NOT "${rm_retval}" STREQUAL 0) ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") EXEC_PROGRAM( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) IF(NOT "${rm_retval}" STREQUAL 0) MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") ENDIF(NOT "${rm_retval}" STREQUAL 0) ELSE(EXISTS "$ENV{DESTDIR}${file}") MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") ENDIF(EXISTS "$ENV{DESTDIR}${file}") ENDFOREACH(file) inspectrum-0.2/cursor.cpp000066400000000000000000000052361304511774600156030ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include "cursor.h" Cursor::Cursor(Qt::Orientation orientation, Qt::CursorShape mouseCursorShape, QObject * parent) : QObject::QObject(parent), orientation(orientation), cursorShape(mouseCursorShape) { } int Cursor::fromPoint(QPoint point) { return (orientation == Qt::Vertical) ? point.x() : point.y(); } bool Cursor::pointOverCursor(QPoint point) { const int margin = 5; range_t range = {cursorPosition - margin, cursorPosition + margin}; return range.contains(fromPoint(point)); } bool Cursor::mouseEvent(QEvent::Type type, QMouseEvent event) { // If the mouse pointer moves over a cursor, display a resize pointer if (pointOverCursor(event.pos()) && type != QEvent::Leave) { if (!cursorOverrided) { cursorOverrided = true; QApplication::setOverrideCursor(QCursor(cursorShape)); } // Restore pointer if it moves off the cursor, or leaves the widget } else if (cursorOverrided) { cursorOverrided = false; QApplication::restoreOverrideCursor(); } // Start dragging on left mouse button press, if over a cursor if (type == QEvent::MouseButtonPress) { if (event.button() == Qt::LeftButton) { if (pointOverCursor(event.pos())) { dragging = true; return true; } } // Update current cursor positon if we're dragging } else if (type == QEvent::MouseMove) { if (dragging) { cursorPosition = fromPoint(event.pos()); emit posChanged(); } // Stop dragging on left mouse button release } else if (type == QEvent::MouseButtonRelease) { if (event.button() == Qt::LeftButton && dragging) { dragging = false; return true; } } return false; } int Cursor::pos() { return cursorPosition; } void Cursor::setPos(int newPos) { cursorPosition = newPos; } inspectrum-0.2/cursor.h000066400000000000000000000025431304511774600152460ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include "util.h" class Cursor : public QObject { Q_OBJECT public: Cursor(Qt::Orientation orientation, Qt::CursorShape mouseCursorShape, QObject * parent); int pos(); void setPos(int newPos); bool mouseEvent(QEvent::Type type, QMouseEvent event); signals: void posChanged(); private: int fromPoint(QPoint point); bool pointOverCursor(QPoint point); Qt::Orientation orientation; Qt::CursorShape cursorShape; bool dragging = false; bool cursorOverrided = false; int cursorPosition = 0; }; inspectrum-0.2/cursors.cpp000066400000000000000000000106341304511774600157640ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include "cursors.h" Cursors::Cursors(QObject * parent) : QObject::QObject(parent) { minCursor = new Cursor(Qt::Vertical, Qt::SizeHorCursor, this); maxCursor = new Cursor(Qt::Vertical, Qt::SizeHorCursor, this); connect(minCursor, &Cursor::posChanged, this, &Cursors::cursorMoved); connect(maxCursor, &Cursor::posChanged, this, &Cursors::cursorMoved); } void Cursors::cursorMoved() { // Swap cursors if one has been dragged past the other if (minCursor->pos() > maxCursor->pos()) { std::swap(minCursor, maxCursor); } emit cursorsMoved(); } bool Cursors::pointWithinDragRegion(QPoint point) { int margin = 10; range_t range = {minCursor->pos()+margin, maxCursor->pos()-margin}; return range.contains(point.x()); } bool Cursors::mouseEvent(QEvent::Type type, QMouseEvent event) { if (minCursor->mouseEvent(type, event)) return true; if (maxCursor->mouseEvent(type, event)) return true; // If the mouse pointer is between the cursors, display a resize pointer if (pointWithinDragRegion(event.pos()) && type != QEvent::Leave) { if (!cursorOverride) { cursorOverride = true; QApplication::setOverrideCursor(QCursor(Qt::SizeAllCursor)); } // Restore pointer otherwise } else { if (cursorOverride) { cursorOverride = false; QApplication::restoreOverrideCursor(); } } // Start dragging on left mouse button press, if between the cursors if (type == QEvent::MouseButtonPress) { if (event.button() == Qt::LeftButton) { if (pointWithinDragRegion(event.pos())) { dragging = true; dragPos = event.pos(); return true; } } // Update both cursor positons if we're dragging } else if (type == QEvent::MouseMove) { if (dragging) { int dx = event.pos().x() - dragPos.x(); minCursor->setPos(minCursor->pos() + dx); maxCursor->setPos(maxCursor->pos() + dx); dragPos = event.pos(); emit cursorsMoved(); } // Stop dragging on left mouse button release } else if (type == QEvent::MouseButtonRelease) { if (event.button() == Qt::LeftButton && dragging) { dragging = false; return true; } } return false; } void Cursors::paintFront(QPainter &painter, QRect &rect, range_t sampleRange) { painter.save(); QRect cursorRect(minCursor->pos(), rect.top(), maxCursor->pos() - minCursor->pos(), rect.height()); // Draw translucent white fill for highlight painter.fillRect( cursorRect, QBrush(QColor(255, 255, 255, 50)) ); // Draw vertical edges for individual segments painter.setPen(QPen(Qt::gray, 1, Qt::DashLine)); for (int i = 1; i < segmentCount; i++) { int pos = minCursor->pos() + (i * cursorRect.width() / segmentCount); painter.drawLine(pos, rect.top(), pos, rect.bottom()); } // Draw vertical edges painter.setPen(QPen(Qt::white, 1, Qt::SolidLine)); painter.drawLine(minCursor->pos(), rect.top(), minCursor->pos(), rect.bottom()); painter.drawLine(maxCursor->pos(), rect.top(), maxCursor->pos(), rect.bottom()); painter.restore(); } int Cursors::segments() { return segmentCount; } range_t Cursors::selection() { return {minCursor->pos(), maxCursor->pos()}; } void Cursors::setSegments(int segments) { segmentCount = std::max(segments, 1); } void Cursors::setSelection(range_t selection) { minCursor->setPos(selection.minimum); maxCursor->setPos(selection.maximum); } inspectrum-0.2/cursors.h000066400000000000000000000032211304511774600154230ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include #include "cursor.h" #include "util.h" class Cursors : public QObject { Q_OBJECT public: Cursors(QObject * parent); int segments(); bool mouseEvent(QEvent::Type type, QMouseEvent event); void paintFront(QPainter &painter, QRect &rect, range_t sampleRange); range_t selection(); void setSegments(int segments); void setSelection(range_t selection); public slots: void cursorMoved(); signals: void cursorsMoved(); private: bool pointWithinDragRegion(QPoint point); Cursor *minCursor; Cursor *maxCursor; int segmentCount = 1; QPoint dragPos; // keep track of dragging distance bool cursorOverride = false; // used to record if cursor is overridden bool dragging = false; // record if mouse is dragging }; inspectrum-0.2/fft.cpp000066400000000000000000000026161304511774600150440ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "fft.h" #include "string.h" FFT::FFT(int size) { fftSize = size; fftwIn = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSize); fftwOut = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSize); fftwPlan = fftwf_plan_dft_1d(fftSize, fftwIn, fftwOut, FFTW_FORWARD, FFTW_MEASURE); } FFT::~FFT() { if (fftwPlan) fftwf_destroy_plan(fftwPlan); if (fftwIn) fftwf_free(fftwIn); if (fftwOut) fftwf_free(fftwOut); } void FFT::process(void *dest, void *source) { memcpy(fftwIn, source, fftSize * sizeof(fftwf_complex)); fftwf_execute(fftwPlan); memcpy(dest, fftwOut, fftSize * sizeof(fftwf_complex)); } inspectrum-0.2/fft.h000066400000000000000000000020701304511774600145030ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include class FFT { public: FFT(int size); ~FFT(); void process(void *dest, void *source); int getSize() { return fftSize; } private: int fftSize; fftwf_complex *fftwIn = nullptr; fftwf_complex *fftwOut = nullptr; fftwf_plan fftwPlan = nullptr; }; inspectrum-0.2/frequencydemod.cpp000066400000000000000000000024171304511774600172760ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "frequencydemod.h" #include #include "util.h" FrequencyDemod::FrequencyDemod(std::shared_ptr>> src) : SampleBuffer(src) { } void FrequencyDemod::work(void *input, void *output, int count, off_t sampleid) { auto in = static_cast*>(input); auto out = static_cast(output); freqdem fdem = freqdem_create(0.05f); for (int i = 0; i < count; i++) { freqdem_demodulate(fdem, in[i], &out[i]); } freqdem_destroy(fdem); } inspectrum-0.2/frequencydemod.h000066400000000000000000000020201304511774600167310ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "samplebuffer.h" class FrequencyDemod : public SampleBuffer, float> { public: FrequencyDemod(std::shared_ptr>> src); void work(void *input, void *output, int count, off_t sampleid) override; }; inspectrum-0.2/inputsource.cpp000066400000000000000000000132771304511774600166520ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * Copyright (C) 2015, Jared Boone * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "inputsource.h" #include #include #include #include #include #include #include #include #include class ComplexF32SampleAdapter : public SampleAdapter { public: size_t sampleSize() override { return sizeof(std::complex); } void copyRange(const void* const src, off_t start, off_t length, std::complex* const dest) override { auto s = reinterpret_cast*>(src); std::copy(&s[start], &s[start + length], dest); } }; class ComplexS16SampleAdapter : public SampleAdapter { public: size_t sampleSize() override { return sizeof(std::complex); } void copyRange(const void* const src, off_t start, off_t length, std::complex* const dest) override { auto s = reinterpret_cast*>(src); std::transform(&s[start], &s[start + length], dest, [](const std::complex& v) -> std::complex { const float k = 1.0f / 32768.0f; return { v.real() * k, v.imag() * k }; } ); } }; class ComplexS8SampleAdapter : public SampleAdapter { public: size_t sampleSize() override { return sizeof(std::complex); } void copyRange(const void* const src, off_t start, off_t length, std::complex* const dest) override { auto s = reinterpret_cast*>(src); std::transform(&s[start], &s[start + length], dest, [](const std::complex& v) -> std::complex { const float k = 1.0f / 128.0f; return { v.real() * k, v.imag() * k }; } ); } }; class ComplexU8SampleAdapter : public SampleAdapter { public: size_t sampleSize() override { return sizeof(std::complex); } void copyRange(const void* const src, off_t start, off_t length, std::complex* const dest) override { auto s = reinterpret_cast*>(src); std::transform(&s[start], &s[start + length], dest, [](const std::complex& v) -> std::complex { const float k = 1.0f / 128.0f; return { v.real() * k - 1.0f, v.imag() * k - 1.0f }; } ); } }; InputSource::InputSource() { } InputSource::~InputSource() { cleanup(); } void InputSource::cleanup() { if (mmapData != nullptr) { munmap(mmapData, fileSize); mmapData = nullptr; fileSize = 0; } if (inputFile != nullptr) { fclose(inputFile); inputFile = nullptr; } } void InputSource::openFile(const char *filename) { QFileInfo fileInfo(filename); const auto suffix = fileInfo.suffix().toLower(); if ((suffix == "cfile") || (suffix == "cf32") || (suffix == "fc32")) { sampleAdapter = std::unique_ptr(new ComplexF32SampleAdapter()); } else if ((suffix == "cs16") || (suffix == "sc16") || (suffix == "c16")) { sampleAdapter = std::unique_ptr(new ComplexS16SampleAdapter()); } else if ((suffix == "cs8") || (suffix == "sc8") || (suffix == "c8")) { sampleAdapter = std::unique_ptr(new ComplexS8SampleAdapter()); } else if ((suffix == "cu8") || (suffix == "uc8")) { sampleAdapter = std::unique_ptr(new ComplexU8SampleAdapter()); } else { sampleAdapter = std::unique_ptr(new ComplexF32SampleAdapter()); } errno = 0; FILE *file = fopen(filename, "rb"); if (file == nullptr) { std::stringstream ss; ss << "Error opening file: " << strerror(errno) << " (" << errno << ")"; throw std::runtime_error(ss.str()); } struct stat sb; if (fstat(fileno(file), &sb) != 0) throw std::runtime_error("Error fstating file"); off_t size = sb.st_size; sampleCount = size / sampleAdapter->sampleSize(); auto data = mmap(NULL, size, PROT_READ, MAP_SHARED, fileno(file), 0); if (data == nullptr) throw std::runtime_error("Error mmapping file"); cleanup(); inputFile = file; fileSize = size; mmapData = data; invalidate(); } void InputSource::setSampleRate(off_t rate) { sampleRate = rate; invalidate(); } off_t InputSource::rate() { return sampleRate; } std::unique_ptr[]> InputSource::getSamples(off_t start, off_t length) { if (inputFile == nullptr) return nullptr; if (mmapData == nullptr) return nullptr; if(start < 0 || length < 0) return nullptr; if (start + length > sampleCount) return nullptr; std::unique_ptr[]> dest(new std::complex[length]); sampleAdapter->copyRange(mmapData, start, length, dest.get()); return dest; } inspectrum-0.2/inputsource.h000066400000000000000000000032271304511774600163110ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * Copyright (C) 2015, Jared Boone * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include "samplesource.h" class SampleAdapter { public: virtual size_t sampleSize() = 0; virtual void copyRange(const void* const src, off_t start, off_t length, std::complex* const dest) = 0; }; class InputSource : public SampleSource> { private: FILE *inputFile = nullptr; off_t fileSize = 0; off_t sampleCount = 0; off_t sampleRate = 0; void *mmapData = nullptr; std::unique_ptr sampleAdapter; public: InputSource(); ~InputSource(); void cleanup(); void openFile(const char *filename); std::unique_ptr[]> getSamples(off_t start, off_t length); off_t count() { return sampleCount; }; void setSampleRate(off_t rate); off_t rate(); float relativeBandwidth() { return 1; } }; inspectrum-0.2/main.cpp000066400000000000000000000040301304511774600152010ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setApplicationName("inspectrum"); a.setOrganizationName("inspectrum"); MainWindow mainWin; QCommandLineParser parser; parser.setApplicationDescription("spectrum viewer"); parser.addHelpOption(); parser.addPositionalArgument("file", QCoreApplication::translate("main", "File to view.")); // Add options QCommandLineOption rateOption(QStringList() << "r" << "rate", QCoreApplication::translate("main", "Set sample rate."), QCoreApplication::translate("main", "Hz")); parser.addOption(rateOption); // Process the actual command line parser.process(a); const QStringList args = parser.positionalArguments(); if (args.size()>=1) mainWin.openFile(args.at(0)); if (parser.isSet(rateOption)) { bool ok; // Use toDouble just for scientific notation support int rate = parser.value(rateOption).toDouble(&ok); if(!ok) { fputs("ERROR: could not parse rate\n", stderr); return 1; } mainWin.setSampleRate(rate); } mainWin.show(); return a.exec(); } inspectrum-0.2/mainwindow.cpp000066400000000000000000000072421304511774600164410ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include "mainwindow.h" #include "util.h" MainWindow::MainWindow() { setWindowTitle(tr("inspectrum")); QPixmapCache::setCacheLimit(40960); dock = new SpectrogramControls(tr("Controls"), this); dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::LeftDockWidgetArea, dock); input = new InputSource(); plots = new PlotView(input); setCentralWidget(plots); // Connect dock inputs connect(dock, SIGNAL(openFile(QString)), this, SLOT(openFile(QString))); connect(dock->sampleRate, SIGNAL(textChanged(QString)), this, SLOT(setSampleRate(QString))); connect(dock, SIGNAL(fftOrZoomChanged(int, int)), plots, SLOT(setFFTAndZoom(int, int))); connect(dock->powerMaxSlider, SIGNAL(valueChanged(int)), plots, SLOT(setPowerMax(int))); connect(dock->powerMinSlider, SIGNAL(valueChanged(int)), plots, SLOT(setPowerMin(int))); connect(dock->cursorsCheckBox, &QCheckBox::stateChanged, plots, &PlotView::enableCursors); connect(dock->scalesCheckBox, &QCheckBox::stateChanged, plots, &PlotView::enableScales); connect(dock->cursorSymbolsSpinBox, static_cast(&QSpinBox::valueChanged), plots, &PlotView::setCursorSegments); // Connect dock outputs connect(plots, SIGNAL(timeSelectionChanged(float)), dock, SLOT(timeSelectionChanged(float))); connect(plots, SIGNAL(zoomIn()), dock, SLOT(zoomIn())); connect(plots, SIGNAL(zoomOut()), dock, SLOT(zoomOut())); // Set defaults after making connections so everything is in sync dock->setDefaults(); } void MainWindow::openFile(QString fileName) { QString title="%1: %2"; this->setWindowTitle(title.arg(QApplication::applicationName(),fileName.section('/',-1,-1))); // Try to parse osmocom_fft filenames and extract the sample rate and center frequency. // Example file name: "name-f2.411200e+09-s5.000000e+06-t20160807180210.cfile" QRegExp rx("(.*)-f(.*)-s(.*)-.*\\.cfile"); QString basename = fileName.section('/',-1,-1); if (rx.exactMatch(basename)) { QString centerfreq = rx.cap(2); QString samplerate = rx.cap(3); std::stringstream ss(samplerate.toUtf8().constData()); // Needs to be a double as the number is in scientific format double rate; ss >> rate; if (!ss.fail()) { setSampleRate(rate); } } input->openFile(fileName.toUtf8().constData()); } void MainWindow::setSampleRate(QString rate) { int sampleRate = rate.toInt(); input->setSampleRate(sampleRate); plots->setSampleRate(sampleRate); // Save the sample rate in settings as we're likely to be opening the same file across multiple runs QSettings settings; settings.setValue("SampleRate", sampleRate); } void MainWindow::setSampleRate(int rate) { dock->sampleRate->setText(QString::number(rate)); } inspectrum-0.2/mainwindow.h000066400000000000000000000022671304511774600161100ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include "spectrogramcontrols.h" #include "plotview.h" class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(); void changeSampleRate(int rate); public slots: void openFile(QString fileName); void setSampleRate(QString rate); void setSampleRate(int rate); private: SpectrogramControls *dock; PlotView *plots; InputSource *input; }; inspectrum-0.2/phasedemod.cpp000066400000000000000000000022121304511774600163660ustar00rootroot00000000000000/* * Copyright (C) 2017, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "phasedemod.h" PhaseDemod::PhaseDemod(std::shared_ptr>> src) : SampleBuffer(src) { } void PhaseDemod::work(void *input, void *output, int count, off_t sampleid) { auto in = static_cast*>(input); auto out = static_cast(output); for (int i = 0; i < count; i++) { out[i] = std::arg(in[i]) * (1 / M_PI); } } inspectrum-0.2/phasedemod.h000066400000000000000000000020101304511774600160270ustar00rootroot00000000000000/* * Copyright (C) 2017, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "samplebuffer.h" class PhaseDemod : public SampleBuffer, float> { public: PhaseDemod(std::shared_ptr>> src); void work(void *input, void *output, int count, off_t sampleid) override; }; inspectrum-0.2/plot.cpp000066400000000000000000000030731304511774600152410ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "plot.h" Plot::Plot(std::shared_ptr src) : sampleSource(src) { sampleSource->subscribe(this); } Plot::~Plot() { sampleSource->unsubscribe(this); } void Plot::invalidateEvent() { } bool Plot::mouseEvent(QEvent::Type type, QMouseEvent event) { return false; } std::shared_ptr Plot::output() { return sampleSource; } void Plot::paintBack(QPainter &painter, QRect &rect, range_t sampleRange) { painter.save(); QPen pen(Qt::white, 1, Qt::DashLine); painter.setPen(pen); painter.drawLine(rect.left(), rect.center().y(), rect.right(), rect.center().y()); painter.restore(); } void Plot::paintMid(QPainter &painter, QRect &rect, range_t sampleRange) { } void Plot::paintFront(QPainter &painter, QRect &rect, range_t sampleRange) { } inspectrum-0.2/plot.h000066400000000000000000000032711304511774600147060ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include "abstractsamplesource.h" #include "util.h" class Plot : public QObject, public Subscriber { Q_OBJECT public: Plot(std::shared_ptr src); ~Plot(); void invalidateEvent() override; virtual bool mouseEvent(QEvent::Type type, QMouseEvent event); virtual std::shared_ptr output(); virtual void paintBack(QPainter &painter, QRect &rect, range_t sampleRange); virtual void paintMid(QPainter &painter, QRect &rect, range_t sampleRange); virtual void paintFront(QPainter &painter, QRect &rect, range_t sampleRange); int height() const { return _height; }; signals: void repaint(); protected: void setHeight(int height) { _height = height; }; std::shared_ptr sampleSource; private: // TODO: don't hardcode this int _height = 200; }; inspectrum-0.2/plots.cpp000066400000000000000000000042651304511774600154300ustar00rootroot00000000000000/* * Copyright (C) 2016-2017, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "amplitudedemod.h" #include "frequencydemod.h" #include "phasedemod.h" #include "threshold.h" #include "traceplot.h" #include "plots.h" std::multimap Plots::plots; Plots::_init Plots::_initializer; Plot* Plots::samplePlot(std::shared_ptr source) { return new TracePlot(source); } Plot* Plots::amplitudePlot(std::shared_ptr source) { typedef SampleSource> Source; std::shared_ptr concrete = std::dynamic_pointer_cast(source); return new TracePlot( std::make_shared(concrete) ); } Plot* Plots::frequencyPlot(std::shared_ptr source) { typedef SampleSource> Source; std::shared_ptr concrete = std::dynamic_pointer_cast(source); return new TracePlot( std::make_shared( concrete ) ); } Plot* Plots::phasePlot(std::shared_ptr source) { typedef SampleSource> Source; std::shared_ptr concrete = std::dynamic_pointer_cast(source); return new TracePlot(std::make_shared(concrete)); } Plot* Plots::thresholdPlot(std::shared_ptr source) { typedef SampleSource Source; std::shared_ptr concrete= std::dynamic_pointer_cast(source); return new TracePlot( std::make_shared( concrete ) ); } inspectrum-0.2/plots.h000066400000000000000000000037231304511774600150730ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include "plot.h" #include "samplesource.h" struct PlotInfo { const char *name; std::function)> creator; }; class Plots { public: static std::multimap plots; static Plot* samplePlot(std::shared_ptr source); static Plot* amplitudePlot(std::shared_ptr source); static Plot* frequencyPlot(std::shared_ptr source); static Plot* phasePlot(std::shared_ptr source); static Plot* thresholdPlot(std::shared_ptr source); static class _init { public: _init() { plots.emplace(typeid(std::complex), PlotInfo{"sample plot", samplePlot}); plots.emplace(typeid(std::complex), PlotInfo{"amplitude plot", amplitudePlot}); plots.emplace(typeid(std::complex), PlotInfo{"frequency plot", frequencyPlot}); plots.emplace(typeid(std::complex), PlotInfo{"phase plot", phasePlot}); plots.emplace(typeid(float), PlotInfo{"threshold plot", thresholdPlot}); }; } _initializer; };inspectrum-0.2/plotview.cpp000066400000000000000000000374531304511774600161450ustar00rootroot00000000000000/* * Copyright (C) 2015-2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "plotview.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "plots.h" PlotView::PlotView(InputSource *input) : cursors(this), viewRange({0, 0}) { mainSampleSource = input; setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setMouseTracking(true); enableCursors(false); connect(&cursors, SIGNAL(cursorsMoved()), this, SLOT(cursorsMoved())); spectrogramPlot = new SpectrogramPlot(std::shared_ptr>>(mainSampleSource)); auto tunerOutput = std::dynamic_pointer_cast>>(spectrogramPlot->output()); enableScales(true); addPlot(spectrogramPlot); mainSampleSource->subscribe(this); } void PlotView::addPlot(Plot *plot) { plots.emplace_back(plot); connect(plot, &Plot::repaint, this, &PlotView::repaint); } void PlotView::contextMenuEvent(QContextMenuEvent * event) { QMenu menu; // Get selected plot Plot *selectedPlot = nullptr; auto it = plots.begin(); int y = -verticalScrollBar()->value(); for (; it != plots.end(); it++) { auto&& plot = *it; if (range_t{y, y + plot->height()}.contains(event->pos().y())) { selectedPlot = plot.get(); break; } y += plot->height(); } if (selectedPlot == nullptr) return; // Add actions to add derived plots // that are compatible with selectedPlot's output QMenu *plotsMenu = menu.addMenu("Add derived plot"); auto src = selectedPlot->output(); auto compatiblePlots = as_range(Plots::plots.equal_range(src->sampleType())); for (auto p : compatiblePlots) { auto plotInfo = p.second; auto action = new QAction(QString("Add %1").arg(plotInfo.name), plotsMenu); auto plotCreator = plotInfo.creator; connect( action, &QAction::triggered, this, [=]() { addPlot(plotCreator(src)); } ); plotsMenu->addAction(action); } // Add action to extract symbols from selected plot auto extract = new QAction("Extract symbols (to stdout)...", &menu); connect( extract, &QAction::triggered, this, [=]() { extractSymbols(src); } ); extract->setEnabled(cursorsEnabled && (src->sampleType() == typeid(float))); menu.addAction(extract); // Add action to export the selected samples into a file auto save = new QAction("Export samples to file...", &menu); connect( save, &QAction::triggered, this, [=]() { if (selectedPlot == spectrogramPlot) { exportSamples(spectrogramPlot->tunerEnabled() ? spectrogramPlot->output() : spectrogramPlot->input()); } else { exportSamples(src); } } ); menu.addAction(save); // Add action to remove the selected plot auto rem = new QAction("Remove plot", &menu); connect( rem, &QAction::triggered, this, [=]() { plots.erase(it); } ); // Don't allow remove the first plot (the spectrogram) rem->setEnabled(it != plots.begin()); menu.addAction(rem); updateViewRange(false); if(menu.exec(event->globalPos())) updateView(false); } void PlotView::cursorsMoved() { selectedSamples = { horizontalScrollBar()->value() + cursors.selection().minimum * samplesPerLine(), horizontalScrollBar()->value() + cursors.selection().maximum * samplesPerLine() }; emitTimeSelection(); viewport()->update(); } void PlotView::emitTimeSelection() { off_t sampleCount = selectedSamples.length(); float selectionTime = sampleCount / (float)mainSampleSource->rate(); emit timeSelectionChanged(selectionTime); } void PlotView::enableCursors(bool enabled) { cursorsEnabled = enabled; if (enabled) { int margin = viewport()->rect().width() / 3; cursors.setSelection({viewport()->rect().left() + margin, viewport()->rect().right() - margin}); cursorsMoved(); } viewport()->update(); } bool PlotView::viewportEvent(QEvent *event) { // Handle wheel events for zooming (before the parent's handler to stop normal scrolling) if (event->type() == QEvent::Wheel) { QWheelEvent *wheelEvent = (QWheelEvent*)event; if (QApplication::keyboardModifiers() & Qt::ControlModifier) { if (wheelEvent->angleDelta().y() > 0) { emit zoomIn(); } else if (wheelEvent->angleDelta().y() < 0) { emit zoomOut(); } return true; } } // Handle parent eveents QAbstractScrollArea::viewportEvent(event); // Pass mouse events to individual plot objects if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseMove || event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::Leave) { QMouseEvent *mouseEvent = static_cast(event); int plotY = -verticalScrollBar()->value(); for (auto&& plot : plots) { bool result = plot->mouseEvent( event->type(), QMouseEvent( event->type(), QPoint(mouseEvent->pos().x(), mouseEvent->pos().y() - plotY), mouseEvent->button(), mouseEvent->buttons(), QApplication::keyboardModifiers() ) ); if (result) return true; plotY += plot->height(); } if (cursorsEnabled) if (cursors.mouseEvent(event->type(), *mouseEvent)) return true; } return false; } void PlotView::extractSymbols(std::shared_ptr src) { if (!cursorsEnabled) return; auto floatSrc = std::dynamic_pointer_cast>(src); if (!floatSrc) return; auto samples = floatSrc->getSamples(selectedSamples.minimum, selectedSamples.length()); auto step = (float)selectedSamples.length() / cursors.segments(); auto symbols = std::vector(); for (auto i = step / 2; i < selectedSamples.length(); i += step) { symbols.push_back(samples[i]); } for (auto f : symbols) std::cout << f << ", "; std::cout << std::endl << std::flush; } void PlotView::exportSamples(std::shared_ptr src) { if (src->sampleType() == typeid(std::complex)) { exportSamples>(src); } else { exportSamples(src); } } template void PlotView::exportSamples(std::shared_ptr src) { auto sampleSrc = std::dynamic_pointer_cast>(src); if (!sampleSrc) { return; } QFileDialog dialog(this); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setFileMode(QFileDialog::AnyFile); dialog.setNameFilter(getFileNameFilter()); dialog.setOption(QFileDialog::DontUseNativeDialog, true); QGroupBox groupBox("Selection To Export", &dialog); QVBoxLayout vbox(&groupBox); QRadioButton cursorSelection("Cursor Selection", &groupBox); QRadioButton currentView("Current View", &groupBox); QRadioButton completeFile("Complete File (Experimental)", &groupBox); if (cursorsEnabled) { cursorSelection.setChecked(true); } else { currentView.setChecked(true); cursorSelection.setEnabled(false); } vbox.addWidget(&cursorSelection); vbox.addWidget(¤tView); vbox.addWidget(&completeFile); vbox.addStretch(1); groupBox.setLayout(&vbox); QGridLayout *l = dialog.findChild(); l->addWidget(&groupBox, 4, 1); QGroupBox groupBox2("Decimation"); QSpinBox decimation(&groupBox2); decimation.setValue(1 / sampleSrc->relativeBandwidth()); QVBoxLayout vbox2; vbox2.addWidget(&decimation); groupBox2.setLayout(&vbox2); l->addWidget(&groupBox2, 4, 2); if (dialog.exec()) { QStringList fileNames = dialog.selectedFiles(); off_t start, end; if (cursorSelection.isChecked()) { start = selectedSamples.minimum; end = start + selectedSamples.length(); } else if(currentView.isChecked()) { start = viewRange.minimum; end = start + viewRange.length(); } else { start = 0; end = sampleSrc->count(); } std::ofstream os (fileNames[0].toStdString(), std::ios::binary); off_t index; // viewRange.length() is used as some less arbitrary step value off_t step = viewRange.length(); for (index = start; index < end; index += step) { off_t length = std::min(step, end - index); auto samples = sampleSrc->getSamples(index, length); if (samples != nullptr) { for (auto i = 0; i < length; i += decimation.value()) { os.write((const char*)&samples[i], sizeof(SOURCETYPE)); } } } } } void PlotView::invalidateEvent() { horizontalScrollBar()->setMinimum(0); horizontalScrollBar()->setMaximum(mainSampleSource->count()); } void PlotView::repaint() { viewport()->update(); } void PlotView::setCursorSegments(int segments) { // Calculate number of samples per segment float sampPerSeg = (float)selectedSamples.length() / cursors.segments(); // Alter selection to keep samples per segment the same selectedSamples.maximum = selectedSamples.minimum + (segments * sampPerSeg + 0.5f); cursors.setSegments(segments); updateView(); emitTimeSelection(); } void PlotView::setFFTAndZoom(int size, int zoom) { // Set new FFT size fftSize = size; if (spectrogramPlot != nullptr) spectrogramPlot->setFFTSize(size); // Set new zoom level zoomLevel = zoom; if (spectrogramPlot != nullptr) spectrogramPlot->setZoomLevel(zoom); // Update horizontal (time) scrollbar horizontalScrollBar()->setSingleStep(size * 10 / zoomLevel); horizontalScrollBar()->setPageStep(size * 100 / zoomLevel); updateView(true); } void PlotView::setPowerMin(int power) { powerMin = power; if (spectrogramPlot != nullptr) spectrogramPlot->setPowerMin(power); updateView(); } void PlotView::setPowerMax(int power) { powerMax = power; if (spectrogramPlot != nullptr) spectrogramPlot->setPowerMax(power); updateView(); } void PlotView::paintEvent(QPaintEvent *event) { if (mainSampleSource == nullptr) return; QRect rect = QRect(0, 0, width(), height()); QPainter painter(viewport()); painter.fillRect(rect, Qt::black); #define PLOT_LAYER(paintFunc) \ { \ int y = -verticalScrollBar()->value(); \ for (auto&& plot : plots) { \ QRect rect = QRect(0, y, width(), plot->height()); \ plot->paintFunc(painter, rect, viewRange); \ y += plot->height(); \ } \ } PLOT_LAYER(paintBack); PLOT_LAYER(paintMid); PLOT_LAYER(paintFront); if (cursorsEnabled) cursors.paintFront(painter, rect, viewRange); if (timeScaleEnabled) { paintTimeScale(painter, rect, viewRange); } #undef PLOT_LAYER } void PlotView::paintTimeScale(QPainter &painter, QRect &rect, range_t sampleRange) { float startTime = (float)sampleRange.minimum / sampleRate; float stopTime = (float)sampleRange.maximum / sampleRate; float duration = stopTime - startTime; if (duration <= 0) return; painter.save(); QPen pen(Qt::white, 1, Qt::SolidLine); painter.setPen(pen); QFontMetrics fm(painter.font()); int tickWidth = 80; int maxTicks = rect.width() / tickWidth; double durationPerTick = 10 * pow(10, floor(log(duration / maxTicks) / log(10))); double firstTick = int(startTime / durationPerTick) * durationPerTick; double tick = firstTick; while (tick <= stopTime) { off_t tickSample = tick * sampleRate; int tickLine = (tickSample - sampleRange.minimum) / samplesPerLine(); char buf[128]; snprintf(buf, sizeof(buf), "%.06f", tick); painter.drawLine(tickLine, 0, tickLine, 30); painter.drawText(tickLine + 2, 25, buf); tick += durationPerTick; } // Draw small ticks durationPerTick /= 10; firstTick = int(startTime / durationPerTick) * durationPerTick; tick = firstTick; while (tick <= stopTime) { off_t tickSample = tick * sampleRate; int tickLine = (tickSample - sampleRange.minimum) / samplesPerLine(); painter.drawLine(tickLine, 0, tickLine, 10); tick += durationPerTick; } painter.restore(); } int PlotView::plotsHeight() { int height = 0; for (auto&& plot : plots) { height += plot->height(); } return height; } void PlotView::resizeEvent(QResizeEvent * event) { updateView(); } off_t PlotView::samplesPerLine() { return fftSize / zoomLevel; } void PlotView::scrollContentsBy(int dx, int dy) { updateView(); } void PlotView::updateViewRange(bool reCenter) { // Store old view for recentering auto oldViewRange = viewRange; // Update current view viewRange = { horizontalScrollBar()->value(), std::min(horizontalScrollBar()->value() + width() * samplesPerLine(), mainSampleSource->count()) }; // Adjust time offset to zoom around central sample if (reCenter) { horizontalScrollBar()->setValue( horizontalScrollBar()->value() + (oldViewRange.length() - viewRange.length()) / 2 ); } } void PlotView::updateView(bool reCenter) { updateViewRange(reCenter); horizontalScrollBar()->setMaximum(std::max(off_t(0), mainSampleSource->count() - ((width() - 1) * samplesPerLine()))); verticalScrollBar()->setMaximum(std::max(0, plotsHeight() - viewport()->height())); // Update cursors range_t newSelection = { (int)((selectedSamples.minimum - horizontalScrollBar()->value()) / samplesPerLine()), (int)((selectedSamples.maximum - horizontalScrollBar()->value()) / samplesPerLine()) }; cursors.setSelection(newSelection); // Re-paint viewport()->update(); } void PlotView::setSampleRate(off_t rate) { sampleRate = rate; if (spectrogramPlot != nullptr) spectrogramPlot->setSampleRate(rate); emitTimeSelection(); } void PlotView::enableScales(bool enabled) { timeScaleEnabled = enabled; if (spectrogramPlot != nullptr) spectrogramPlot->enableScales(enabled); viewport()->update(); } inspectrum-0.2/plotview.h000066400000000000000000000052531304511774600156030ustar00rootroot00000000000000/* * Copyright (C) 2015-2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include "cursors.h" #include "inputsource.h" #include "plot.h" #include "samplesource.h" #include "spectrogramplot.h" #include "traceplot.h" class PlotView : public QAbstractScrollArea, Subscriber { Q_OBJECT public: PlotView(InputSource *input); void setSampleRate(off_t rate); signals: void timeSelectionChanged(float time); void zoomIn(); void zoomOut(); public slots: void cursorsMoved(); void enableCursors(bool enabled); void enableScales(bool enabled); void invalidateEvent(); void repaint(); void setCursorSegments(int segments); void setFFTAndZoom(int fftSize, int zoomLevel); void setPowerMin(int power); void setPowerMax(int power); protected: void contextMenuEvent(QContextMenuEvent * event) override; void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent * event); void scrollContentsBy(int dx, int dy); bool viewportEvent(QEvent *event) override; private: Cursors cursors; SampleSource> *mainSampleSource = nullptr; SpectrogramPlot *spectrogramPlot = nullptr; std::vector> plots; range_t viewRange; range_t selectedSamples; int fftSize = 1024; int zoomLevel = 0; int powerMin; int powerMax; bool cursorsEnabled; off_t sampleRate = 0; bool timeScaleEnabled; void addPlot(Plot *plot); void emitTimeSelection(); void extractSymbols(std::shared_ptr src); void exportSamples(std::shared_ptr src); template void exportSamples(std::shared_ptr src); int plotsHeight(); off_t samplesPerLine(); void updateViewRange(bool reCenter); void updateView(bool reCenter = false); void paintTimeScale(QPainter &painter, QRect &rect, range_t sampleRange); }; inspectrum-0.2/samplebuffer.cpp000066400000000000000000000037711304511774600167430ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include "samplebuffer.h" template SampleBuffer::SampleBuffer(std::shared_ptr> src) : src(src) { src->subscribe(this); } template SampleBuffer::~SampleBuffer() { src->unsubscribe(this); } template std::unique_ptr SampleBuffer::getSamples(off_t start, off_t length) { // TODO: base this on the actual history required auto history = std::min(start, (off_t)256); auto samples = src->getSamples(start - history, length + history); if (samples == nullptr) return nullptr; std::unique_ptr temp(new Tout[history + length]); std::unique_ptr dest(new Tout[length]); QMutexLocker ml(&mutex); work(samples.get(), temp.get(), history + length, start); memcpy(dest.get(), temp.get() + history, length * sizeof(Tout)); return dest; } template void SampleBuffer::invalidateEvent() { SampleSource::invalidate(); } template class SampleBuffer, std::complex>; template class SampleBuffer, float>; template class SampleBuffer; inspectrum-0.2/samplebuffer.h000066400000000000000000000027151304511774600164050ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include "samplesource.h" template class SampleBuffer : public SampleSource, public Subscriber { private: std::shared_ptr> src; QMutex mutex; public: SampleBuffer(std::shared_ptr> src); ~SampleBuffer(); void invalidateEvent(); virtual std::unique_ptr getSamples(off_t start, off_t length); virtual void work(void *input, void *output, int count, off_t sampleid) = 0; virtual off_t count() { return src->count(); }; off_t rate() { return src->rate(); }; float relativeBandwidth() { return 1; } }; inspectrum-0.2/samplesource.cpp000066400000000000000000000017101304511774600167610ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "samplesource.h" template std::type_index SampleSource::sampleType() { return typeid(T); } template class SampleSource>; template class SampleSource; inspectrum-0.2/samplesource.h000066400000000000000000000023131304511774600164260ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include "abstractsamplesource.h" template class SampleSource : public AbstractSampleSource { public: virtual ~SampleSource() {}; virtual std::unique_ptr getSamples(off_t start, off_t length) = 0; virtual void invalidateEvent() { }; virtual off_t count() = 0; virtual off_t rate() = 0; virtual float relativeBandwidth() = 0; std::type_index sampleType() override; }; inspectrum-0.2/screenshot.jpg000066400000000000000000002431161304511774600164420ustar00r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SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iu?)Ѿ%SM iv^>}?.ײ#<~D5U䰛J[4o)qǹ a.Eͬ r8"6,]TZlYF~?RI䚿@TR@inspectrum-0.2/spectrogramcontrols.cpp000066400000000000000000000170361304511774600204010ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * Copyright (C) 2015, Jared Boone * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "spectrogramcontrols.h" #include #include #include #include #include #include "util.h" SpectrogramControls::SpectrogramControls(const QString & title, QWidget * parent) : QDockWidget::QDockWidget(title, parent) { widget = new QWidget(this); layout = new QFormLayout(widget); fileOpenButton = new QPushButton("Open file...", widget); layout->addRow(fileOpenButton); sampleRate = new QLineEdit(); sampleRate->setValidator(new QIntValidator(this)); layout->addRow(new QLabel(tr("Sample rate:")), sampleRate); // Spectrogram settings layout->addRow(new QLabel()); // TODO: find a better way to add an empty row? layout->addRow(new QLabel(tr("Spectrogram"))); fftSizeSlider = new QSlider(Qt::Horizontal, widget); fftSizeSlider->setRange(7, 13); fftSizeSlider->setPageStep(1); layout->addRow(new QLabel(tr("FFT size:")), fftSizeSlider); zoomLevelSlider = new QSlider(Qt::Horizontal, widget); zoomLevelSlider->setRange(0, 10); zoomLevelSlider->setPageStep(1); layout->addRow(new QLabel(tr("Zoom:")), zoomLevelSlider); powerMaxSlider = new QSlider(Qt::Horizontal, widget); powerMaxSlider->setRange(-140, 10); layout->addRow(new QLabel(tr("Power max:")), powerMaxSlider); powerMinSlider = new QSlider(Qt::Horizontal, widget); powerMinSlider->setRange(-140, 10); layout->addRow(new QLabel(tr("Power min:")), powerMinSlider); scalesCheckBox = new QCheckBox(widget); scalesCheckBox->setCheckState(Qt::Checked); layout->addRow(new QLabel(tr("Scales:")), scalesCheckBox); // Time selection settings layout->addRow(new QLabel()); // TODO: find a better way to add an empty row? layout->addRow(new QLabel(tr("Time selection"))); cursorsCheckBox = new QCheckBox(widget); layout->addRow(new QLabel(tr("Enable cursors:")), cursorsCheckBox); cursorSymbolsSpinBox = new QSpinBox(); cursorSymbolsSpinBox->setMinimum(1); cursorSymbolsSpinBox->setMaximum(9999); layout->addRow(new QLabel(tr("Symbols:")), cursorSymbolsSpinBox); rateLabel = new QLabel(); layout->addRow(new QLabel(tr("Rate:")), rateLabel); periodLabel = new QLabel(); layout->addRow(new QLabel(tr("Period:")), periodLabel); symbolRateLabel = new QLabel(); layout->addRow(new QLabel(tr("Symbol rate:")), symbolRateLabel); symbolPeriodLabel = new QLabel(); layout->addRow(new QLabel(tr("Symbol period:")), symbolPeriodLabel); widget->setLayout(layout); setWidget(widget); connect(fftSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(fftSizeChanged(int))); connect(zoomLevelSlider, SIGNAL(valueChanged(int)), this, SLOT(zoomLevelChanged(int))); connect(fileOpenButton, SIGNAL(clicked()), this, SLOT(fileOpenButtonClicked())); connect(cursorsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(cursorsStateChanged(int))); connect(powerMinSlider, SIGNAL(valueChanged(int)), this, SLOT(powerMinChanged(int))); connect(powerMaxSlider, SIGNAL(valueChanged(int)), this, SLOT(powerMaxChanged(int))); } void SpectrogramControls::clearCursorLabels() { periodLabel->setText(""); rateLabel->setText(""); symbolPeriodLabel->setText(""); symbolRateLabel->setText(""); } void SpectrogramControls::cursorsStateChanged(int state) { if (state == Qt::Unchecked) { clearCursorLabels(); } } void SpectrogramControls::setDefaults() { fftOrZoomChanged(); cursorsCheckBox->setCheckState(Qt::Unchecked); cursorSymbolsSpinBox->setValue(1); // Try to set the sample rate from the last-used value QSettings settings; int savedSampleRate = settings.value("SampleRate", 8000000).toInt(); sampleRate->setText(QString::number(savedSampleRate)); fftSizeSlider->setValue(settings.value("FFTSize", 9).toInt()); powerMaxSlider->setValue(settings.value("PowerMax", 0).toInt()); powerMinSlider->setValue(settings.value("PowerMin", -100).toInt()); zoomLevelSlider->setValue(settings.value("ZoomLevel", 0).toInt()); } void SpectrogramControls::fftOrZoomChanged(void) { int fftSize = pow(2, fftSizeSlider->value()); int zoomLevel = std::min(fftSize, (int)pow(2, zoomLevelSlider->value())); emit fftOrZoomChanged(fftSize, zoomLevel); } void SpectrogramControls::fftSizeChanged(int value) { QSettings settings; settings.setValue("FFTSize", value); fftOrZoomChanged(); } void SpectrogramControls::zoomLevelChanged(int value) { QSettings settings; settings.setValue("ZoomLevel", value); fftOrZoomChanged(); } void SpectrogramControls::powerMinChanged(int value) { QSettings settings; settings.setValue("PowerMin", value); } void SpectrogramControls::powerMaxChanged(int value) { QSettings settings; settings.setValue("PowerMax", value); } void SpectrogramControls::fileOpenButtonClicked() { QSettings settings; QString fileName; QFileDialog fileSelect(this); fileSelect.setNameFilter(tr("All files (*);;" "complex file (*.cfile *.cf32 *.fc32);;" "complex HackRF file (*.cs8 *.sc8 *.c8);;" "complex Fancy file (*.cs16 *.sc16 *.c16);;" "complex RTL-SDR file (*.cu8 *.uc8)")); // Try and load a saved state { QByteArray savedState = settings.value("OpenFileState").toByteArray(); fileSelect.restoreState(savedState); // Filter doesn't seem to be considered part of the saved state QString lastUsedFilter = settings.value("OpenFileFilter").toString(); if(lastUsedFilter.size()) fileSelect.selectNameFilter(lastUsedFilter); } if(fileSelect.exec()) { fileName = fileSelect.selectedFiles()[0]; // Remember the state of the dialog for the next time QByteArray dialogState = fileSelect.saveState(); settings.setValue("OpenFileState", dialogState); settings.setValue("OpenFileFilter", fileSelect.selectedNameFilter()); } if (!fileName.isEmpty()) emit openFile(fileName); } void SpectrogramControls::timeSelectionChanged(float time) { if (cursorsCheckBox->checkState() == Qt::Checked) { periodLabel->setText(QString::fromStdString(formatSIValue(time)) + "s"); rateLabel->setText(QString::fromStdString(formatSIValue(1 / time)) + "Hz"); int symbols = cursorSymbolsSpinBox->value(); symbolPeriodLabel->setText(QString::fromStdString(formatSIValue(time / symbols)) + "s"); symbolRateLabel->setText(QString::fromStdString(formatSIValue(symbols / time)) + "Hz"); } } void SpectrogramControls::zoomIn() { zoomLevelSlider->setValue(zoomLevelSlider->value() + 1); } void SpectrogramControls::zoomOut() { zoomLevelSlider->setValue(zoomLevelSlider->value() - 1); } inspectrum-0.2/spectrogramcontrols.h000066400000000000000000000040111304511774600200330ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include #include #include #include #include class SpectrogramControls : public QDockWidget { Q_OBJECT public: SpectrogramControls(const QString & title, QWidget * parent); void setDefaults(); signals: void fftOrZoomChanged(int fftSize, int zoomLevel); void openFile(QString fileName); public slots: void timeSelectionChanged(float time); void zoomIn(); void zoomOut(); private slots: void fftSizeChanged(int value); void zoomLevelChanged(int value); void powerMinChanged(int value); void powerMaxChanged(int value); void fileOpenButtonClicked(); void cursorsStateChanged(int state); private: QWidget *widget; QFormLayout *layout; void clearCursorLabels(); void fftOrZoomChanged(void); public: QPushButton *fileOpenButton; QLineEdit *sampleRate; QSlider *fftSizeSlider; QSlider *zoomLevelSlider; QSlider *powerMaxSlider; QSlider *powerMinSlider; QCheckBox *cursorsCheckBox; QSpinBox *cursorSymbolsSpinBox; QLabel *rateLabel; QLabel *periodLabel; QLabel *symbolRateLabel; QLabel *symbolPeriodLabel; QCheckBox *scalesCheckBox; }; inspectrum-0.2/spectrogramplot.cpp000066400000000000000000000226221304511774600175110ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "spectrogramplot.h" #include #include #include #include #include #include #include #include #include "util.h" SpectrogramPlot::SpectrogramPlot(std::shared_ptr>> src) : Plot(src), inputSource(src), fftSize(512), tuner(fftSize, this) { setFFTSize(fftSize); zoomLevel = 1; powerMax = 0.0f; powerMin = -50.0f; sampleRate = 0; frequencyScaleEnabled = false; for (int i = 0; i < 256; i++) { float p = (float)i / 256; colormap[i] = QColor::fromHsvF(p * 0.83f, 1.0, 1.0 - p).rgba(); } tunerTransform = std::make_shared(src); connect(&tuner, &Tuner::tunerMoved, this, &SpectrogramPlot::tunerMoved); } void SpectrogramPlot::invalidateEvent() { pixmapCache.clear(); fftCache.clear(); emit repaint(); } void SpectrogramPlot::paintFront(QPainter &painter, QRect &rect, range_t sampleRange) { if (tunerEnabled()) tuner.paintFront(painter, rect, sampleRange); if (frequencyScaleEnabled) paintFrequencyScale(painter, rect); } void SpectrogramPlot::paintFrequencyScale(QPainter &painter, QRect &rect) { // At which pixel is F_+sampleRate/2 int y = rect.y(); int plotHeight = rect.height(); double bwPerPixel = (double)sampleRate / plotHeight; int tickHeight = 50; int bwPerTick = 10 * pow(10, floor(log(bwPerPixel * tickHeight) / log(10))); if (bwPerTick < 1) { return; } painter.save(); QPen pen(Qt::white, 1, Qt::SolidLine); painter.setPen(pen); QFontMetrics fm(painter.font()); int tick = 0; while (tick <= sampleRate / 2) { int tickpy = plotHeight / 2 - tick / bwPerPixel + y; int tickny = plotHeight / 2 + tick / bwPerPixel + y; painter.drawLine(0, tickny, 30, tickny); painter.drawLine(0, tickpy, 30, tickpy); if (tick != 0) { char buf[128]; if (bwPerTick % 1000000 == 0) { snprintf(buf, sizeof(buf), "-%d MHz", (int)tick / 1000000); } else if(bwPerTick % 1000 == 0) { snprintf(buf, sizeof(buf), "-%d kHz", tick / 1000); } else { snprintf(buf, sizeof(buf), "-%d Hz", tick); } painter.drawText(5, tickny - 5, buf); buf[0] = ' '; painter.drawText(5, tickpy + 15, buf); } tick += bwPerTick; } // Draw small ticks bwPerTick /= 10; if (bwPerTick >= 1 ) { tick = 0; while (tick <= sampleRate / 2) { int tickpy = plotHeight / 2 - tick / bwPerPixel + y; int tickny = plotHeight / 2 + tick / bwPerPixel + y; painter.drawLine(0, tickny, 3, tickny); painter.drawLine(0, tickpy, 3, tickpy); tick += bwPerTick; } } painter.restore(); } void SpectrogramPlot::paintMid(QPainter &painter, QRect &rect, range_t sampleRange) { if (!inputSource || inputSource->count() == 0) return; off_t sampleOffset = sampleRange.minimum % (getStride() * linesPerTile()); off_t tileID = sampleRange.minimum - sampleOffset; int xoffset = sampleOffset / getStride(); // Paint first (possibly partial) tile painter.drawPixmap(QRect(rect.left(), rect.y(), linesPerTile() - xoffset, fftSize), *getPixmapTile(tileID), QRect(xoffset, 0, linesPerTile() - xoffset, fftSize)); tileID += getStride() * linesPerTile(); // Paint remaining tiles for (int x = linesPerTile() - xoffset; x < rect.right(); x += linesPerTile()) { // TODO: don't draw past rect.right() // TODO: handle partial final tile painter.drawPixmap(QRect(x, rect.y(), linesPerTile(), fftSize), *getPixmapTile(tileID)); tileID += getStride() * linesPerTile(); } } QPixmap* SpectrogramPlot::getPixmapTile(off_t tile) { QPixmap *obj = pixmapCache.object(TileCacheKey(fftSize, zoomLevel, tile)); if (obj != 0) return obj; float *fftTile = getFFTTile(tile); obj = new QPixmap(linesPerTile(), fftSize); QImage image(linesPerTile(), fftSize, QImage::Format_RGB32); float powerRange = -1.0f / std::abs(int(powerMin - powerMax)); for (int y = 0; y < fftSize; y++) { auto scanLine = (QRgb*)image.scanLine(fftSize - y - 1); for (int x = 0; x < linesPerTile(); x++) { float *fftLine = &fftTile[x * fftSize]; float normPower = (fftLine[y] - powerMax) * powerRange; normPower = clamp(normPower, 0.0f, 1.0f); scanLine[x] = colormap[(uint8_t)(normPower * (256 - 1))]; } } obj->convertFromImage(image); pixmapCache.insert(TileCacheKey(fftSize, zoomLevel, tile), obj); return obj; } float* SpectrogramPlot::getFFTTile(off_t tile) { std::array* obj = fftCache.object(TileCacheKey(fftSize, zoomLevel, tile)); if (obj != nullptr) return obj->data(); std::array* destStorage = new std::array; float *ptr = destStorage->data(); off_t sample = tile; while ((ptr - destStorage->data()) < tileSize) { getLine(ptr, sample); sample += getStride(); ptr += fftSize; } fftCache.insert(TileCacheKey(fftSize, zoomLevel, tile), destStorage); return destStorage->data(); } void SpectrogramPlot::getLine(float *dest, off_t sample) { if (inputSource && fft) { auto buffer = inputSource->getSamples(sample, fftSize); if (buffer == nullptr) return; for (int i = 0; i < fftSize; i++) { buffer[i] *= window[i]; } fft->process(buffer.get(), buffer.get()); const float invFFTSize = 1.0f / fftSize; const float logMultiplier = 10.0f / log2f(10.0f); for (int i = 0; i < fftSize; i++) { // Start from the middle of the FFTW array and wrap // to rearrange the data int k = i ^ (fftSize >> 1); auto s = buffer[k] * invFFTSize; float power = s.real() * s.real() + s.imag() * s.imag(); float logPower = log2f(power) * logMultiplier; *dest = logPower; dest++; } } } int SpectrogramPlot::getStride() { return fftSize / zoomLevel; } float SpectrogramPlot::getTunerPhaseInc() { auto freq = 0.5f - tuner.centre() / (float)fftSize; return freq * Tau; } std::vector SpectrogramPlot::getTunerTaps() { float cutoff = tuner.deviation() / (float)fftSize; float gain = pow(10.0f, powerMax / -10.0f); auto atten = 60.0f; auto len = estimate_req_filter_len(0.05f, atten); auto taps = std::vector(len); liquid_firdes_kaiser(len, cutoff, atten, 0.0f, taps.data()); std::transform(taps.begin(), taps.end(), taps.begin(), std::bind1st(std::multiplies(), gain)); return taps; } int SpectrogramPlot::linesPerTile() { return tileSize / fftSize; } bool SpectrogramPlot::mouseEvent(QEvent::Type type, QMouseEvent event) { if (tunerEnabled()) return tuner.mouseEvent(type, event); return false; } std::shared_ptr SpectrogramPlot::output() { return tunerTransform; } void SpectrogramPlot::setFFTSize(int size) { float sizeScale = float(size) / float(fftSize); fftSize = size; fft.reset(new FFT(fftSize)); window.reset(new float[fftSize]); for (int i = 0; i < fftSize; i++) { window[i] = 0.5f * (1.0f - cos(Tau * i / (fftSize - 1))); } setHeight(fftSize); auto dev = tuner.deviation(); auto centre = tuner.centre(); tuner.setHeight(fftSize); tuner.setDeviation( dev * sizeScale ); tuner.setCentre( centre * sizeScale ); } void SpectrogramPlot::setPowerMax(int power) { powerMax = power; pixmapCache.clear(); tunerMoved(); } void SpectrogramPlot::setPowerMin(int power) { powerMin = power; pixmapCache.clear(); } void SpectrogramPlot::setZoomLevel(int zoom) { zoomLevel = zoom; } void SpectrogramPlot::setSampleRate(off_t rate) { sampleRate = rate; } void SpectrogramPlot::enableScales(bool enabled) { frequencyScaleEnabled = enabled; } bool SpectrogramPlot::tunerEnabled() { return (tunerTransform->subscriberCount() > 0); } void SpectrogramPlot::tunerMoved() { tunerTransform->setFrequency(getTunerPhaseInc()); tunerTransform->setTaps(getTunerTaps()); tunerTransform->setRelativeBandwith(tuner.deviation() * 2.0 / getStride()); // TODO: for invalidating traceplot cache, this shouldn't really go here QPixmapCache::clear(); emit repaint(); } uint qHash(const TileCacheKey &key, uint seed) { return key.fftSize ^ key.zoomLevel ^ key.sample ^ seed; } inspectrum-0.2/spectrogramplot.h000066400000000000000000000062071304511774600171570ustar00rootroot00000000000000/* * Copyright (C) 2015, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include "fft.h" #include "inputsource.h" #include "plot.h" #include "tuner.h" #include "tunertransform.h" #include #include #include class TileCacheKey; class SpectrogramPlot : public Plot { Q_OBJECT public: SpectrogramPlot(std::shared_ptr>> src); void invalidateEvent() override; std::shared_ptr output() override; void paintFront(QPainter &painter, QRect &rect, range_t sampleRange) override; void paintMid(QPainter &painter, QRect &rect, range_t sampleRange) override; bool mouseEvent(QEvent::Type type, QMouseEvent event) override; std::shared_ptr>> input() { return inputSource; }; void setSampleRate(off_t sampleRate); bool tunerEnabled(); void enableScales(bool enabled); public slots: void setFFTSize(int size); void setPowerMax(int power); void setPowerMin(int power); void setZoomLevel(int zoom); void tunerMoved(); private: const int linesPerGraduation = 50; static const int tileSize = 65536; // This must be a multiple of the maximum FFT size std::shared_ptr>> inputSource; std::unique_ptr fft; std::unique_ptr window; QCache pixmapCache; QCache> fftCache; uint colormap[256]; int fftSize; int zoomLevel; float powerMax; float powerMin; off_t sampleRate; bool frequencyScaleEnabled; Tuner tuner; std::shared_ptr tunerTransform; QPixmap* getPixmapTile(off_t tile); float* getFFTTile(off_t tile); void getLine(float *dest, off_t sample); int getStride(); float getTunerPhaseInc(); std::vector getTunerTaps(); int linesPerTile(); void paintFrequencyScale(QPainter &painter, QRect &rect); }; class TileCacheKey { public: TileCacheKey(int fftSize, int zoomLevel, off_t sample) { this->fftSize = fftSize; this->zoomLevel = zoomLevel; this->sample = sample; } bool operator==(const TileCacheKey &k2) const { return (this->fftSize == k2.fftSize) && (this->zoomLevel == k2.zoomLevel) && (this->sample == k2.sample); } int fftSize; int zoomLevel; off_t sample; }; inspectrum-0.2/subscriber.h000066400000000000000000000015161304511774600160730ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once class Subscriber { public: virtual void invalidateEvent() = 0; }; inspectrum-0.2/threshold.cpp000066400000000000000000000021721304511774600162560ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "threshold.h" Threshold::Threshold(std::shared_ptr> src) : SampleBuffer(src) { } void Threshold::work(void *input, void *output, int count, off_t sampleid) { auto in = static_cast(input); auto out = static_cast(output); std::transform(in, in + count, out, [](float s) { return (s > 0) ? 1.0f : 0.0f; }); } inspectrum-0.2/threshold.h000066400000000000000000000017521304511774600157260ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "samplebuffer.h" class Threshold : public SampleBuffer { public: Threshold(std::shared_ptr> src); void work(void *input, void *output, int count, off_t sampleid) override; }; inspectrum-0.2/traceplot.cpp000066400000000000000000000112011304511774600162500ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include "samplesource.h" #include "traceplot.h" TracePlot::TracePlot(std::shared_ptr source) : Plot(source) { connect(this, &TracePlot::imageReady, this, &TracePlot::handleImage); } void TracePlot::paintMid(QPainter &painter, QRect &rect, range_t sampleRange) { int samplesPerColumn = sampleRange.length() / rect.width(); int samplesPerTile = tileWidth * samplesPerColumn; off_t tileID = sampleRange.minimum / samplesPerTile; off_t tileOffset = sampleRange.minimum % samplesPerTile; // Number of samples to skip from first image tile int xOffset = tileOffset / samplesPerColumn; // Number of columns to skip from first image tile // Paint first (possibly partial) tile painter.drawPixmap( QRect(rect.x(), rect.y(), tileWidth - xOffset, height()), getTile(tileID++, samplesPerTile), QRect(xOffset, 0, tileWidth - xOffset, height()) ); // Paint remaining tiles for (int x = tileWidth - xOffset; x < rect.right(); x += tileWidth) { painter.drawPixmap( QRect(x, rect.y(), tileWidth, height()), getTile(tileID++, samplesPerTile) ); } } QPixmap TracePlot::getTile(off_t tileID, off_t sampleCount) { QPixmap pixmap(tileWidth, height()); QString key; QTextStream(&key) << "traceplot_" << this << "_" << tileID << "_" << sampleCount; if (QPixmapCache::find(key, &pixmap)) return pixmap; if (!tasks.contains(key)) { range_t sampleRange{tileID * sampleCount, (tileID + 1) * sampleCount}; QtConcurrent::run(this, &TracePlot::drawTile, key, QRect(0, 0, tileWidth, height()), sampleRange); tasks.insert(key); } pixmap.fill(Qt::transparent); return pixmap; } void TracePlot::drawTile(QString key, const QRect &rect, range_t sampleRange) { QImage image(rect.size(), QImage::Format_ARGB32); image.fill(Qt::transparent); QPainter painter(&image); painter.setRenderHint(QPainter::Antialiasing, true); auto firstSample = sampleRange.minimum; auto length = sampleRange.length(); // Is it a 2-channel (complex) trace? if (auto src = dynamic_cast>*>(sampleSource.get())) { auto samples = src->getSamples(firstSample, length); if (samples == nullptr) return; painter.setPen(Qt::red); plotTrace(painter, rect, reinterpret_cast(samples.get()), length, 2); painter.setPen(Qt::blue); plotTrace(painter, rect, reinterpret_cast(samples.get())+1, length, 2); // Otherwise is it single channel? } else if (auto src = dynamic_cast*>(sampleSource.get())) { auto samples = src->getSamples(firstSample, length); if (samples == nullptr) return; painter.setPen(Qt::green); plotTrace(painter, rect, samples.get(), length, 1); } else { throw std::runtime_error("TracePlot::paintMid: Unsupported source type"); } emit imageReady(key, image); } void TracePlot::handleImage(QString key, QImage image) { auto pixmap = QPixmap::fromImage(image); QPixmapCache::insert(key, pixmap); tasks.remove(key); emit repaint(); } void TracePlot::plotTrace(QPainter &painter, const QRect &rect, float *samples, off_t count, int step = 1) { QPainterPath path; range_t xRange{0, rect.width() - 2.f}; range_t yRange{0, rect.height() - 2.f}; const float xStep = 1.0 / count * rect.width(); for (off_t i = 0; i < count; i++) { float sample = samples[i*step]; float x = i * xStep; float y = (1 - sample) * (rect.height() / 2); x = xRange.clip(x) + rect.x(); y = yRange.clip(y) + rect.y(); if (i == 0) path.moveTo(x, y); else path.lineTo(x, y); } painter.drawPath(path); } inspectrum-0.2/traceplot.h000066400000000000000000000027731304511774600157330ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include "abstractsamplesource.h" #include "plot.h" #include "util.h" class TracePlot : public Plot { Q_OBJECT public: TracePlot(std::shared_ptr source); void paintMid(QPainter &painter, QRect &rect, range_t sampleRange); std::shared_ptr source() { return sampleSource; }; signals: void imageReady(QString key, QImage image); public slots: void handleImage(QString key, QImage image); private: QSet tasks; const int tileWidth = 1000; QPixmap getTile(off_t tileID, off_t sampleCount); void drawTile(QString key, const QRect &rect, range_t sampleRange); void plotTrace(QPainter &painter, const QRect &rect, float *samples, off_t count, int step); }; inspectrum-0.2/tuner.cpp000066400000000000000000000071711304511774600154230ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include "tuner.h" Tuner::Tuner(int height, QObject * parent) : height(height), QObject::QObject(parent) { minCursor = new Cursor(Qt::Horizontal, Qt::SizeVerCursor, this); cfCursor = new Cursor(Qt::Horizontal, Qt::SizeAllCursor, this); maxCursor = new Cursor(Qt::Horizontal, Qt::SizeVerCursor, this); connect(minCursor, &Cursor::posChanged, this, &Tuner::cursorMoved); connect(cfCursor, &Cursor::posChanged, this, &Tuner::cursorMoved); connect(maxCursor, &Cursor::posChanged, this, &Tuner::cursorMoved); cfCursor->setPos(100); _deviation = 10; updateCursors(); } int Tuner::centre() { return cfCursor->pos(); } void Tuner::cursorMoved() { Cursor *sender = static_cast(QObject::sender()); if (sender != cfCursor) { // Limit cursor positions to within plot auto posRange = range_t{0, height}; sender->setPos(posRange.clip(sender->pos())); // Limit deviation range to half of total BW (either side of centre) auto deviationRange = range_t{2, height / 2}; _deviation = deviationRange.clip(std::abs(sender->pos() - cfCursor->pos())); } else { auto cfRange = range_t{_deviation, height - _deviation}; sender->setPos(cfRange.clip(sender->pos())); } updateCursors(); } int Tuner::deviation() { return _deviation; } bool Tuner::mouseEvent(QEvent::Type type, QMouseEvent event) { if (cfCursor->mouseEvent(type, event)) return true; if (minCursor->mouseEvent(type, event)) return true; if (maxCursor->mouseEvent(type, event)) return true; return false; } void Tuner::paintFront(QPainter &painter, QRect &rect, range_t sampleRange) { painter.save(); QRect cursorRect(rect.left(), rect.top() + minCursor->pos(), rect.right(), maxCursor->pos() - minCursor->pos()); // Draw translucent white fill for highlight painter.fillRect( cursorRect, QBrush(QColor(255, 255, 255, 50)) ); // Draw tuner edges painter.setPen(QPen(Qt::white, 1, Qt::SolidLine)); painter.drawLine(rect.left(), rect.top() + minCursor->pos(), rect.right(), rect.top() + minCursor->pos()); painter.drawLine(rect.left(), rect.top() + maxCursor->pos(), rect.right(), rect.top() + maxCursor->pos()); // Draw centre freq painter.setPen(QPen(Qt::red, 1, Qt::SolidLine)); painter.drawLine(rect.left(), rect.top() + cfCursor->pos(), rect.right(), rect.top() + cfCursor->pos()); painter.restore(); } void Tuner::setCentre(int centre) { cfCursor->setPos(centre); updateCursors(); } void Tuner::setDeviation(int dev) { _deviation = dev; updateCursors(); } void Tuner::setHeight(int height) { this->height = height; } void Tuner::updateCursors() { minCursor->setPos(cfCursor->pos() - _deviation); maxCursor->setPos(cfCursor->pos() + _deviation); emit tunerMoved(); } inspectrum-0.2/tuner.h000066400000000000000000000027021304511774600150630ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include #include "cursor.h" #include "util.h" class Tuner : public QObject { Q_OBJECT public: Tuner(int height, QObject * parent); int centre(); int deviation(); bool mouseEvent(QEvent::Type, QMouseEvent event); void paintFront(QPainter &painter, QRect &rect, range_t sampleRange); void setCentre(int centre); void setDeviation(int dev); void setHeight(int height); public slots: void cursorMoved(); signals: void tunerMoved(); private: void updateCursors(); Cursor *minCursor; Cursor *cfCursor; Cursor *maxCursor; int _deviation; int height; }; inspectrum-0.2/tunertransform.cpp000066400000000000000000000042141304511774600173520ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "tunertransform.h" #include #include "util.h" TunerTransform::TunerTransform(std::shared_ptr>> src) : SampleBuffer(src), frequency(0), bandwidth(1.), taps{1.0f} { } void TunerTransform::work(void *input, void *output, int count, off_t sampleid) { auto out = static_cast*>(output); std::unique_ptr[]> temp(new std::complex[count]); // Mix down nco_crcf mix = nco_crcf_create(LIQUID_NCO); nco_crcf_set_phase(mix, fmodf(frequency * sampleid, Tau)); nco_crcf_set_frequency(mix, frequency); nco_crcf_mix_block_down(mix, static_cast*>(input), temp.get(), count); nco_crcf_destroy(mix); // Filter firfilt_crcf filter = firfilt_crcf_create(taps.data(), taps.size()); for (int i = 0; i < count; i++) { firfilt_crcf_push(filter, temp[i]); firfilt_crcf_execute(filter, &out[i]); } firfilt_crcf_destroy(filter); } void TunerTransform::setFrequency(float frequency) { this->frequency = frequency; } void TunerTransform::setTaps(std::vector taps) { this->taps = taps; } float TunerTransform::relativeBandwidth() { return bandwidth; } void TunerTransform::setRelativeBandwith(float bandwidth) { this->bandwidth = bandwidth; } inspectrum-0.2/tunertransform.h000066400000000000000000000024421304511774600170200ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "samplebuffer.h" #include class TunerTransform : public SampleBuffer, std::complex> { private: float frequency; float bandwidth; std::vector taps; public: TunerTransform(std::shared_ptr>> src); void work(void *input, void *output, int count, off_t sampleid) override; void setFrequency(float frequency); void setTaps(std::vector taps); void setRelativeBandwith(float bandwidth); float relativeBandwidth(); }; inspectrum-0.2/util.cpp000066400000000000000000000027461304511774600152460ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "util.h" std::string formatSIValue(float value) { std::map prefixes = { { 9, "G" }, { 6, "M" }, { 3, "k" }, { 0, "" }, { -3, "m" }, { -6, "µ" }, { -9, "n" }, }; int power = 0; while (value < 1.0f && power > -9) { value *= 1e3; power -= 3; } while (value >= 1e3 && power < 9) { value *= 1e-3; power += 3; } std::stringstream ss; ss << value << prefixes[power]; return ss.str(); } template<> const char* getFileNameFilter>() { return "complex file (*.fc32)"; }; template<> const char* getFileNameFilter() { return "float file (*.f32)"; }; inspectrum-0.2/util.h000066400000000000000000000053611304511774600147070ustar00rootroot00000000000000/* * Copyright (C) 2016, Mike Walters * Copyright (C) 2016, Jared Boone, ShareBrained Technology, Inc. * * This file is part of inspectrum. * * 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 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 for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include #include #include static const double Tau = M_PI * 2.0; template const T& clamp (const T& value, const T& min, const T& max) { return std::min(max, std::max(min, value)); } template struct iter_pair_range : std::pair { iter_pair_range(std::pair const& x) : std::pair(x) { } Iter begin() const { return this->first; } Iter end() const { return this->second; } }; template inline iter_pair_range as_range(std::pair const& x) { return iter_pair_range(x); } template struct range_t { T minimum; T maximum; range_t& operator=(const range_t &other) { minimum = other.minimum; maximum = other.maximum; } range_t& operator=(const std::initializer_list &other) { if (other.size() == 2) { minimum = *other.begin(); maximum = *(other.begin() + 1); } return *this; } const T length() { return maximum - minimum; } const T& clip(const T& value) const { return clamp(value, minimum, maximum); } void reset_if_outside(T& value, const T& reset_value) const { if( (value < minimum ) || (value > maximum ) ) { value = reset_value; } } bool below_range(const T& value) const { return value < minimum; } bool contains(const T& value) const { // TODO: Subtle gotcha here! Range test doesn't include maximum! return (value >= minimum) && (value < maximum); } bool out_of_range(const T& value) const { // TODO: Subtle gotcha here! Range test in contains() doesn't include maximum! return !contains(value); } }; std::string formatSIValue(float value); template const char* getFileNameFilter();