| 1 | /* |
| 2 | * Copyright (C) 2015, Mike Walters <[email protected]> |
| 3 | * |
| 4 | * This file is part of inspectrum. |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include <QCache> |
| 23 | #include <QString> |
| 24 | #include <QWidget> |
| 25 | #include "fft.h"cxx . . $ `<file>/src/fft.h`/ |
| 26 | #include "inputsource.h"cxx . . $ `<file>/src/inputsource.h`/ |
| 27 | #include "plot.h"cxx . . $ `<file>/src/plot.h`/ |
| 28 | #include "tuner.h"cxx . . $ `<file>/src/tuner.h`/ |
| 29 | #include "tunertransform.h"cxx . . $ `<file>/src/tunertransform.h`/ |
| 30 | |
| 31 | #include <memory> |
| 32 | #include <array> |
| 33 | #include <math.h> |
| 34 | #include <vector> |
| 35 | |
| 36 | class AnnotationLocationcxx . . $ AnnotationLocation#; |
| 37 | |
| 38 | |
| 39 | class TileCacheKeycxx . . $ TileCacheKey# |
| 40 | { |
| 41 | |
| 42 | public: |
| 43 | TileCacheKeycxx . . $ TileCacheKey#TileCacheKey(6d6de46ed9adf1db).(int fftSize, int zoomLevel, size_t sample) { |
| 44 | this->fftSizecxx . . $ TileCacheKey#fftSize. = fftSize; |
| 45 | this->zoomLevelcxx . . $ TileCacheKey#zoomLevel. = zoomLevel; |
| 46 | this->samplecxx . . $ TileCacheKey#sample. = sample; |
| 47 | } |
| 48 | |
| 49 | bool operatorcxx . . $ TileCacheKey#`operator==`(bc45da6476d5ca6).==(const TileCacheKeycxx . . $ TileCacheKey# &k2) const { |
| 50 | return (this->fftSizecxx . . $ TileCacheKey#fftSize. == k2.fftSizecxx . . $ TileCacheKey#fftSize.) && |
| 51 | (this->zoomLevelcxx . . $ TileCacheKey#zoomLevel. == k2.zoomLevelcxx . . $ TileCacheKey#zoomLevel.) && |
| 52 | (this->samplecxx . . $ TileCacheKey#sample. == k2.samplecxx . . $ TileCacheKey#sample.); |
| 53 | } |
| 54 | |
| 55 | int fftSizecxx . . $ TileCacheKey#fftSize.; |
| 56 | int zoomLevelcxx . . $ TileCacheKey#zoomLevel.; |
| 57 | size_t samplecxx . . $ TileCacheKey#sample.; |
| 58 | }; |
| 59 | |
| 60 | class SpectrogramPlotcxx . . $ SpectrogramPlot# : public Plotcxx . . $ Plot# |
| 61 | { |
| 62 | Q_OBJECTcxx . . $ SpectrogramPlot#tr(75d9f1c324b4579d). |
| 63 | |
| 64 | public: |
| 65 | SpectrogramPlotcxx . . $ SpectrogramPlot#SpectrogramPlot(b44028109ee6b4a).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<SampleSourcecxx . . $ SampleSource#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>>> src); |
| 66 | void invalidateEventcxx . . $ SpectrogramPlot#invalidateEvent(49f6e7a06ebc5aa8).() override; |
| 67 | stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<AbstractSampleSourcecxx . . $ AbstractSampleSource#> outputcxx . . $ SpectrogramPlot#output(aad09d7b1d4b04e1).() override; |
| 68 | void paintFrontcxx . . $ SpectrogramPlot#paintFront(dba2c6533854c69f).(QPaintercxx . . $ QPainter# &painter, QRectcxx . . $ QRect# &rect, range_tcxx . . $ range_t#<size_t> sampleRange) override; |
| 69 | void paintMidcxx . . $ SpectrogramPlot#paintMid(dba2c6533854c69f).(QPaintercxx . . $ QPainter# &painter, QRectcxx . . $ QRect# &rect, range_tcxx . . $ range_t#<size_t> sampleRange) override; |
| 70 | bool mouseEventcxx . . $ SpectrogramPlot#mouseEvent(bf65bbe40893342c).(QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type# type, QMouseEventcxx . . $ QMouseEvent# *event) override; |
| 71 | void leaveEventcxx . . $ SpectrogramPlot#leaveEvent(49f6e7a06ebc5aa8).(); |
| 72 | stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<SampleSourcecxx . . $ SampleSource#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>>> inputcxx . . $ SpectrogramPlot#input(24423e5ec47f55b2).() { return inputSourcecxx . . $ std/shared_ptr#shared_ptr(c44ffe56f5110b84).; }; |
| 73 | void setSampleRatecxx . . $ SpectrogramPlot#setSampleRate(ba8836b59fb42830).(double sampleRate); |
| 74 | bool tunerEnabledcxx . . $ SpectrogramPlot#tunerEnabled(c9857a73d68e59ba).(); |
| 75 | void enableScalescxx . . $ SpectrogramPlot#enableScales(b45ddcbc8423892c).(bool enabled); |
| 76 | void enableAnnotationscxx . . $ SpectrogramPlot#enableAnnotations(b45ddcbc8423892c).(bool enabled); |
| 77 | bool isAnnotationsEnabledcxx . . $ SpectrogramPlot#isAnnotationsEnabled(c9857a73d68e59ba).(); |
| 78 | QStringcxx . . $ QString# *mouseAnnotationCommentcxx . . $ SpectrogramPlot#mouseAnnotationComment(4b6ae5eff941c8bb).(const QMouseEventcxx . . $ QMouseEvent# *event); |
| 79 | |
| 80 | public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 81 | void setFFTSizecxx . . $ SpectrogramPlot#setFFTSize(d4f767463ce0a6b3).(int size); |
| 82 | void setPowerMaxcxx . . $ SpectrogramPlot#setPowerMax(d4f767463ce0a6b3).(int power); |
| 83 | void setPowerMincxx . . $ SpectrogramPlot#setPowerMin(d4f767463ce0a6b3).(int power); |
| 84 | void setZoomLevelcxx . . $ SpectrogramPlot#setZoomLevel(d4f767463ce0a6b3).(int zoom); |
| 85 | void tunerMovedcxx . . $ SpectrogramPlot#tunerMoved(49f6e7a06ebc5aa8).(); |
| 86 | |
| 87 | private: |
| 88 | const int linesPerGraduationcxx . . $ SpectrogramPlot#linesPerGraduation. = 50; |
| 89 | static const int tileSizecxx . . $ SpectrogramPlot#tileSize. = 65536; // This must be a multiple of the maximum FFT size |
| 90 | |
| 91 | stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<SampleSourcecxx . . $ SampleSource#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>>> inputSourcecxx . . $ SpectrogramPlot#inputSource.; |
| 92 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<AnnotationLocationcxx . . $ AnnotationLocation#> visibleAnnotationLocationscxx . . $ SpectrogramPlot#visibleAnnotationLocations.; |
| 93 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<FFTcxx . . $ FFT#> fftcxx . . $ SpectrogramPlot#fft.; |
| 94 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<float[]> windowcxx . . $ SpectrogramPlot#window.; |
| 95 | QCachecxx . . $ QCache#<TileCacheKeycxx . . $ TileCacheKey#, QPixmapcxx . . $ QPixmap#> pixmapCachecxx . . $ SpectrogramPlot#pixmapCache.; |
| 96 | QCachecxx . . $ QCache#<TileCacheKeycxx . . $ TileCacheKey#, stdcxx . . $ std/::arraycxx . . $ std/array#<float, tileSizecxx . . $ SpectrogramPlot#tileSize.>> fftCachecxx . . $ SpectrogramPlot#fftCache.; |
| 97 | uintcxx . . $ uint# colormapcxx . . $ SpectrogramPlot#colormap.[256]; |
| 98 | |
| 99 | int fftSizecxx . . $ SpectrogramPlot#fftSize.; |
| 100 | int zoomLevelcxx . . $ SpectrogramPlot#zoomLevel.; |
| 101 | float powerMaxcxx . . $ SpectrogramPlot#powerMax.; |
| 102 | float powerMincxx . . $ SpectrogramPlot#powerMin.; |
| 103 | double sampleRatecxx . . $ SpectrogramPlot#sampleRate.; |
| 104 | bool frequencyScaleEnabledcxx . . $ SpectrogramPlot#frequencyScaleEnabled.; |
| 105 | bool sigmfAnnotationsEnabledcxx . . $ SpectrogramPlot#sigmfAnnotationsEnabled.; |
| 106 | |
| 107 | Tunercxx . . $ Tuner# tunercxx . . $ SpectrogramPlot#tuner.; |
| 108 | stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<TunerTransformcxx . . $ TunerTransform#> tunerTransformcxx . . $ SpectrogramPlot#tunerTransform.; |
| 109 | |
| 110 | QPixmapcxx . . $ QPixmap#* getPixmapTilecxx . . $ SpectrogramPlot#getPixmapTile(5036922bdbcf2913).(size_t tile); |
| 111 | float* getFFTTilecxx . . $ SpectrogramPlot#getFFTTile(391776d68d171a3c).(size_t tile); |
| 112 | void getLinecxx . . $ SpectrogramPlot#getLine(1eb030330e199770).(float *dest, size_t sample); |
| 113 | int getStridecxx . . $ SpectrogramPlot#getStride(b126dc7c1de90089).(); |
| 114 | float getTunerPhaseInccxx . . $ SpectrogramPlot#getTunerPhaseInc(9b8c9e39889c762c).(); |
| 115 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<float> getTunerTapscxx . . $ SpectrogramPlot#getTunerTaps(78bf79a61abe343f).(); |
| 116 | int linesPerTilecxx . . $ SpectrogramPlot#linesPerTile(b126dc7c1de90089).(); |
| 117 | void paintFrequencyScalecxx . . $ SpectrogramPlot#paintFrequencyScale(c6340ed8e020fc53).(QPaintercxx . . $ QPainter# &painter, QRectcxx . . $ QRect# &rect); |
| 118 | void paintAnnotationscxx . . $ SpectrogramPlot#paintAnnotations(dba2c6533854c69f).(QPaintercxx . . $ QPainter# &painter, QRectcxx . . $ QRect# &rect, range_tcxx . . $ range_t#<size_t> sampleRange); |
| 119 | }; |
| 120 | |
| 121 | class AnnotationLocationcxx . . $ AnnotationLocation# |
| 122 | { |
| 123 | public: |
| 124 | Annotationcxx . . $ Annotation# annotationcxx . . $ AnnotationLocation#annotation.; |
| 125 | |
| 126 | AnnotationLocationcxx . . $ AnnotationLocation#AnnotationLocation(121fbe3e6dd904f4).(Annotationcxx . . $ Annotation# annotation, int x, int y, int width, int height) |
| 127 | : annotationcxx . . $ AnnotationLocation#annotation.(annotation), xcxx . . $ AnnotationLocation#x.(x), ycxx . . $ AnnotationLocation#y.(y), widthcxx . . $ AnnotationLocation#width.(width), heightcxx . . $ AnnotationLocation#height.(height) {} |
| 128 | |
| 129 | bool isInsidecxx . . $ AnnotationLocation#isInside(cf9ef193275fa6d8).(int pos_x, int pos_y) { |
| 130 | return (xcxx . . $ AnnotationLocation#x. <= pos_x) && (pos_x <= xcxx . . $ AnnotationLocation#x. + widthcxx . . $ AnnotationLocation#width.) |
| 131 | && (ycxx . . $ AnnotationLocation#y. <= pos_y) && (pos_y <= ycxx . . $ AnnotationLocation#y. + heightcxx . . $ AnnotationLocation#height.); |
| 132 | } |
| 133 | |
| 134 | private: |
| 135 | int xcxx . . $ AnnotationLocation#x.; |
| 136 | int ycxx . . $ AnnotationLocation#y.; |
| 137 | int widthcxx . . $ AnnotationLocation#width.; |
| 138 | int heightcxx . . $ AnnotationLocation#height.; |
| 139 | }; |