| 1 | /* |
| 2 | * Copyright (C) 2015, Mike Walters <[email protected]> |
| 3 | * Copyright (C) 2015, Jared Boone <[email protected]> |
| 4 | * |
| 5 | * This file is part of inspectrum. |
| 6 | * |
| 7 | * This program is free software: you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation, either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "inputsource.h"cxx . . $ `<file>/src/inputsource.h`/ |
| 22 | |
| 23 | #include <math.h> |
| 24 | #include <stdio.h> |
| 25 | #include <string.h> |
| 26 | |
| 27 | #include <stdexcept> |
| 28 | #include <algorithm> |
| 29 | |
| 30 | #include <QFileInfo> |
| 31 | |
| 32 | #include <QElapsedTimer> |
| 33 | #include <QPainter> |
| 34 | #include <QPaintEvent> |
| 35 | #include <QPixmapCache> |
| 36 | #include <QRect> |
| 37 | #include <QJsonDocument> |
| 38 | #include <QJsonObject> |
| 39 | #include <QJsonArray> |
| 40 | #include <QFile> |
| 41 | |
| 42 | |
| 43 | class ComplexF32SampleAdaptercxx . . $ ComplexF32SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 44 | public: |
| 45 | size_t sampleSizecxx . . $ ComplexF32SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 46 | return sizeof(stdcxx . . $ std/::complexcxx . . $ std/complex#<float>); |
| 47 | } |
| 48 | |
| 49 | void copyRangecxx . . $ ComplexF32SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 50 | auto s = reinterpret_cast<const stdcxx . . $ std/::complexcxx . . $ std/complex#<float>*>(src); |
| 51 | stdcxx . . $ std/::copycxx . . $ std/copy(88304b602929f6f4).(&s[start], &s[start + length], dest); |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | class ComplexF64SampleAdaptercxx . . $ ComplexF64SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 56 | public: |
| 57 | size_t sampleSizecxx . . $ ComplexF64SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 58 | return sizeof(stdcxx . . $ std/::complexcxx . . $ std/complex#<double>); |
| 59 | } |
| 60 | |
| 61 | void copyRangecxx . . $ ComplexF64SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 62 | auto s = reinterpret_cast<const stdcxx . . $ std/::complexcxx . . $ std/complex#<double>*>(src); |
| 63 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 64 | [](const stdcxx . . $ std/::complexcxx . . $ std/complex#<double>& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 65 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). static_cast<float>(v.realcxx . . $ std/complex#real(21b6c25e127938e2).()) , static_cast<float>(v.imagcxx . . $ std/complex#imag(21b6c25e127938e2).()) }; |
| 66 | } |
| 67 | ); |
| 68 | } |
| 69 | }; |
| 70 | |
| 71 | class ComplexS32SampleAdaptercxx . . $ ComplexS32SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 72 | public: |
| 73 | size_t sampleSizecxx . . $ ComplexS32SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 74 | return sizeof(stdcxx . . $ std/::complexcxx . . $ std/complex#<int32_t>); |
| 75 | } |
| 76 | |
| 77 | void copyRangecxx . . $ ComplexS32SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 78 | auto s = reinterpret_cast<const stdcxx . . $ std/::complexcxx . . $ std/complex#<int32_t>*>(src); |
| 79 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 80 | [](const stdcxx . . $ std/::complexcxx . . $ std/complex#<int32_t>& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 81 | const float k = 1.0f / 2147483648.0f; |
| 82 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). v.realcxx . . $ std/complex#real(8f5363d873dd4781).() * k, v.imagcxx . . $ std/complex#imag(8f5363d873dd4781).() * k }; |
| 83 | } |
| 84 | ); |
| 85 | } |
| 86 | }; |
| 87 | |
| 88 | class ComplexS16SampleAdaptercxx . . $ ComplexS16SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 89 | public: |
| 90 | size_t sampleSizecxx . . $ ComplexS16SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 91 | return sizeof(stdcxx . . $ std/::complexcxx . . $ std/complex#<int16_t>); |
| 92 | } |
| 93 | |
| 94 | void copyRangecxx . . $ ComplexS16SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 95 | auto s = reinterpret_cast<const stdcxx . . $ std/::complexcxx . . $ std/complex#<int16_t>*>(src); |
| 96 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 97 | [](const stdcxx . . $ std/::complexcxx . . $ std/complex#<int16_t>& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 98 | const float k = 1.0f / 32768.0f; |
| 99 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). v.realcxx . . $ std/complex#real(8f5363d873dd4781).() * k, v.imagcxx . . $ std/complex#imag(8f5363d873dd4781).() * k }; |
| 100 | } |
| 101 | ); |
| 102 | } |
| 103 | }; |
| 104 | |
| 105 | class ComplexS8SampleAdaptercxx . . $ ComplexS8SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 106 | public: |
| 107 | size_t sampleSizecxx . . $ ComplexS8SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 108 | return sizeof(stdcxx . . $ std/::complexcxx . . $ std/complex#<int8_t>); |
| 109 | } |
| 110 | |
| 111 | void copyRangecxx . . $ ComplexS8SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 112 | auto s = reinterpret_cast<const stdcxx . . $ std/::complexcxx . . $ std/complex#<int8_t>*>(src); |
| 113 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 114 | [](const stdcxx . . $ std/::complexcxx . . $ std/complex#<int8_t>& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 115 | const float k = 1.0f / 128.0f; |
| 116 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). v.realcxx . . $ std/complex#real(8f5363d873dd4781).() * k, v.imagcxx . . $ std/complex#imag(8f5363d873dd4781).() * k }; |
| 117 | } |
| 118 | ); |
| 119 | } |
| 120 | }; |
| 121 | |
| 122 | class ComplexU8SampleAdaptercxx . . $ ComplexU8SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 123 | public: |
| 124 | size_t sampleSizecxx . . $ ComplexU8SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 125 | return sizeof(stdcxx . . $ std/::complexcxx . . $ std/complex#<uint8_tcxx . . $ uint8_t#>); |
| 126 | } |
| 127 | |
| 128 | void copyRangecxx . . $ ComplexU8SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 129 | auto s = reinterpret_cast<const stdcxx . . $ std/::complexcxx . . $ std/complex#<uint8_tcxx . . $ uint8_t#>*>(src); |
| 130 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 131 | [](const stdcxx . . $ std/::complexcxx . . $ std/complex#<uint8_tcxx . . $ uint8_t#>& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 132 | const float k = 1.0f / 128.0f; |
| 133 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). (v.realcxx . . $ std/complex#real(8f5363d873dd4781).() - 127.4f) * k, (v.imagcxx . . $ std/complex#imag(8f5363d873dd4781).() - 127.4f) * k }; |
| 134 | } |
| 135 | ); |
| 136 | } |
| 137 | }; |
| 138 | |
| 139 | class RealF32SampleAdaptercxx . . $ RealF32SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 140 | public: |
| 141 | size_t sampleSizecxx . . $ RealF32SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 142 | return sizeof(float); |
| 143 | } |
| 144 | |
| 145 | void copyRangecxx . . $ RealF32SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 146 | auto s = reinterpret_cast<const float*>(src); |
| 147 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 148 | [](const float& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 149 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7).v, 0.0f}; |
| 150 | } |
| 151 | ); |
| 152 | } |
| 153 | }; |
| 154 | |
| 155 | class RealF64SampleAdaptercxx . . $ RealF64SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 156 | public: |
| 157 | size_t sampleSizecxx . . $ RealF64SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 158 | return sizeof(double); |
| 159 | } |
| 160 | |
| 161 | void copyRangecxx . . $ RealF64SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 162 | auto s = reinterpret_cast<const double*>(src); |
| 163 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 164 | [](const double& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 165 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7).static_cast<float>(v), 0.0f}; |
| 166 | } |
| 167 | ); |
| 168 | } |
| 169 | }; |
| 170 | |
| 171 | class RealS16SampleAdaptercxx . . $ RealS16SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 172 | public: |
| 173 | size_t sampleSizecxx . . $ RealS16SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 174 | return sizeof(int16_t); |
| 175 | } |
| 176 | |
| 177 | void copyRangecxx . . $ RealS16SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 178 | auto s = reinterpret_cast<const int16_t*>(src); |
| 179 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 180 | [](const int16_t& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 181 | const float k = 1.0f / 32768.0f; |
| 182 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). v * k, 0.0f }; |
| 183 | } |
| 184 | ); |
| 185 | } |
| 186 | }; |
| 187 | |
| 188 | class RealS8SampleAdaptercxx . . $ RealS8SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 189 | public: |
| 190 | size_t sampleSizecxx . . $ RealS8SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 191 | return sizeof(int8_t); |
| 192 | } |
| 193 | |
| 194 | void copyRangecxx . . $ RealS8SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 195 | auto s = reinterpret_cast<const int8_t*>(src); |
| 196 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 197 | [](const int8_t& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 198 | const float k = 1.0f / 128.0f; |
| 199 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). v * k, 0.0f }; |
| 200 | } |
| 201 | ); |
| 202 | } |
| 203 | }; |
| 204 | |
| 205 | class RealU8SampleAdaptercxx . . $ RealU8SampleAdapter# : public SampleAdaptercxx . . $ SampleAdapter# { |
| 206 | public: |
| 207 | size_t sampleSizecxx . . $ RealU8SampleAdapter#sampleSize(f708dce9a8856c70).() override { |
| 208 | return sizeof(uint8_tcxx . . $ uint8_t#); |
| 209 | } |
| 210 | |
| 211 | void copyRangecxx . . $ RealU8SampleAdapter#copyRange(cc8809b61c1fd643).(const void* const src, size_t start, size_t length, stdcxx . . $ std/::complexcxx . . $ std/complex#<float>* const dest) override { |
| 212 | auto s = reinterpret_cast<const uint8_tcxx . . $ uint8_t#*>(src); |
| 213 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(&s[start], &s[start + length], dest, |
| 214 | [](const uint8_tcxx . . $ uint8_t#& v) -> stdcxx . . $ std/::complexcxx . . $ std/complex#<float> { |
| 215 | const float k = 1.0f / 128.0f; |
| 216 | return {cxx . . $ std/complex#complex(5102ef758adc0ae7). (v - 127.4f) * k, 0 }; |
| 217 | } |
| 218 | ); |
| 219 | } |
| 220 | }; |
| 221 | |
| 222 | InputSourcecxx . . $ InputSource#::InputSourcecxx . . $ InputSource#InputSource(49f6e7a06ebc5aa8).() |
| 223 | { |
| 224 | } |
| 225 | |
| 226 | InputSourcecxx . . $ InputSource#::~cxx . . $ InputSource#`~InputSource`(49f6e7a06ebc5aa8).InputSourcecxx . . $ InputSource#() |
| 227 | { |
| 228 | cleanupcxx . . $ InputSource#cleanup(49f6e7a06ebc5aa8).(); |
| 229 | } |
| 230 | |
| 231 | void InputSourcecxx . . $ InputSource#::cleanupcxx . . $ InputSource#cleanup(49f6e7a06ebc5aa8).() |
| 232 | { |
| 233 | if (mmapDatacxx . . $ InputSource#mmapData. != nullptr) { |
| 234 | inputFilecxx . . $ InputSource#inputFile.->unmapcxx . . $ QFileDevice#unmap(8c2a43c3cf3cca3e).(mmapDatacxx . . $ InputSource#mmapData.); |
| 235 | mmapDatacxx . . $ InputSource#mmapData. = nullptr; |
| 236 | } |
| 237 | |
| 238 | if (inputFilecxx . . $ InputSource#inputFile. != nullptr) { |
| 239 | delete inputFilecxx . . $ InputSource#inputFile.; |
| 240 | inputFilecxx . . $ InputSource#inputFile. = nullptr; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | QJsonObjectcxx . . $ QJsonObject# InputSourcecxx . . $ InputSource#::readMetaDatacxx . . $ InputSource#readMetaData(2776c2cc5edc784).(const QStringcxx . . $ QString# &filename) |
| 245 | { |
| 246 | QFilecxx . . $ QFile# datafilecxx . . $ QFile#QFile(3520e46b33348bf6).(filename); |
| 247 | if (!datafile.opencxx . . $ QFile#open(dca164408be960c8).(QFilecxx . . $ QFile#::ReadOnlycxx . . $ QIODevice#ReadOnly. |cxx . . $ `operator|`(e858de6b2553445b). QIODevicecxx . . $ QIODevice#::Textcxx . . $ QIODevice#Text.)) { |
| 248 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#("Error while opening meta data file: " +cxx . . $ std/operator+(39ed2c165380f78e). datafile.errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).()); |
| 249 | } |
| 250 | |
| 251 | QJsonDocumentcxx . . $ QJsonDocument# d = QJsonDocumentcxx . . $ QJsonDocument#QJsonDocument(23bd420ebd985b52).::fromJsoncxx . . $ QJsonDocument#fromJson(731a4d2b2d08d93c).(datafile.readAllcxx . . $ QIODevice#readAll(b3c286cec66e09f4).()); |
| 252 | datafile.closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 253 | auto root = dcxx . . $ QJsonObject#QJsonObject(ea6cc9b2559123a7)..objectcxx . . $ QJsonDocument#object(ac8af9874357714b).(); |
| 254 | |
| 255 | if (!root.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("global"cxx . . $ QString#QString(85c52e162fed56f9).) || !root[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."global"cxx . . $ QString#QString(85c52e162fed56f9).].isObjectcxx . . $ QJsonValueRef#isObject(50ce9a9e25b4a850).()) { |
| 256 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#("SigMF meta data is invalid (no global object found)"); |
| 257 | } |
| 258 | |
| 259 | auto global = rootcxx . . $ QJsonObject#QJsonObject(ea6cc9b2559123a7).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."global"cxx . . $ QString#QString(85c52e162fed56f9).].toObjectcxx . . $ QJsonValueRef#toObject(ac8af9874357714b).(); |
| 260 | |
| 261 | if (!global.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("core:datatype"cxx . . $ QString#QString(85c52e162fed56f9).) || !global[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:datatype"cxx . . $ QString#QString(85c52e162fed56f9).].isStringcxx . . $ QJsonValueRef#isString(50ce9a9e25b4a850).()) { |
| 262 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#("SigMF meta data does not specify a valid datatype"); |
| 263 | } |
| 264 | |
| 265 | |
| 266 | auto datatype = globalcxx . . $ QString#QString(e1217c004a86c950).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:datatype"cxx . . $ QString#QString(85c52e162fed56f9).].toStringcxx . . $ QJsonValueRef#toString(6ef7b6c27b00b43d).(); |
| 267 | if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("cf32_le"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 268 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexF32SampleAdaptercxx . . $ ComplexF32SampleAdapter#>(); |
| 269 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("ci32_le"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 270 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexS32SampleAdaptercxx . . $ ComplexS32SampleAdapter#>(); |
| 271 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("ci16_le"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 272 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexS16SampleAdaptercxx . . $ ComplexS16SampleAdapter#>(); |
| 273 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("ci8"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 274 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexS8SampleAdaptercxx . . $ ComplexS8SampleAdapter#>(); |
| 275 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("cu8"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 276 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexU8SampleAdaptercxx . . $ ComplexU8SampleAdapter#>(); |
| 277 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("rf32_le"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 278 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealF32SampleAdaptercxx . . $ RealF32SampleAdapter#>(); |
| 279 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 280 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("ri16_le"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 281 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealS16SampleAdaptercxx . . $ RealS16SampleAdapter#>(); |
| 282 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 283 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("ri8"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 284 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealS8SampleAdaptercxx . . $ RealS8SampleAdapter#>(); |
| 285 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 286 | } else if (datatype.comparecxx . . $ QString#compare(38964227c2ffb4ec).("ru8"cxx . . $ QString#QString(85c52e162fed56f9).) == 0) { |
| 287 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealU8SampleAdaptercxx . . $ RealU8SampleAdapter#>(); |
| 288 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 289 | } else { |
| 290 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#("SigMF meta data specifies unsupported datatype"); |
| 291 | } |
| 292 | |
| 293 | if (global.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("core:sample_rate"cxx . . $ QString#QString(85c52e162fed56f9).) && global[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:sample_rate"cxx . . $ QString#QString(85c52e162fed56f9).].isDoublecxx . . $ QJsonValueRef#isDouble(50ce9a9e25b4a850).()) { |
| 294 | setSampleRatecxx . . $ InputSource#setSampleRate(ba8836b59fb42830).(global[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:sample_rate"cxx . . $ QString#QString(85c52e162fed56f9).].toDoublecxx . . $ QJsonValueRef#toDouble(21b6c25e127938e2).()); |
| 295 | } |
| 296 | |
| 297 | |
| 298 | if (root.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("captures"cxx . . $ QString#QString(85c52e162fed56f9).) && root[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."captures"cxx . . $ QString#QString(85c52e162fed56f9).].isArraycxx . . $ QJsonValueRef#isArray(50ce9a9e25b4a850).()) { |
| 299 | auto captures = rootcxx . . $ QJsonArray#QJsonArray(ea19e415519297b4).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."captures"cxx . . $ QString#QString(85c52e162fed56f9).].toArraycxx . . $ QJsonValueRef#toArray(98974f179f8308bf).(); |
| 300 | |
| 301 | for (auto capture_ref : captures) { |
| 302 | if (capture_ref.isObjectcxx . . $ QJsonValueRef#isObject(50ce9a9e25b4a850).()) { |
| 303 | auto capture = capture_refcxx . . $ QJsonObject#QJsonObject(ea6cc9b2559123a7)..toObjectcxx . . $ QJsonValueRef#toObject(ac8af9874357714b).(); |
| 304 | if (capture.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("core:frequency"cxx . . $ QString#QString(85c52e162fed56f9).) && capture[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:frequency"cxx . . $ QString#QString(85c52e162fed56f9).].isDoublecxx . . $ QJsonValueRef#isDouble(50ce9a9e25b4a850).()) { |
| 305 | frequencycxx . . $ SampleSource#frequency. = capture[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:frequency"cxx . . $ QString#QString(85c52e162fed56f9).].toDoublecxx . . $ QJsonValueRef#toDouble(21b6c25e127938e2).(); |
| 306 | } |
| 307 | } else { |
| 308 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#("SigMF meta data is invalid (invalid capture object)"); |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | if(root.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("annotations"cxx . . $ QString#QString(85c52e162fed56f9).) && root[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."annotations"cxx . . $ QString#QString(85c52e162fed56f9).].isArraycxx . . $ QJsonValueRef#isArray(50ce9a9e25b4a850).()) { |
| 314 | |
| 315 | size_t offset = 0; |
| 316 | |
| 317 | if (global.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("core:offset"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 318 | offset = global[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."offset"cxx . . $ QString#QString(85c52e162fed56f9).].toDoublecxx . . $ QJsonValueRef#toDouble(21b6c25e127938e2).(); |
| 319 | } |
| 320 | |
| 321 | auto annotations = rootcxx . . $ QJsonArray#QJsonArray(ea19e415519297b4).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."annotations"cxx . . $ QString#QString(85c52e162fed56f9).].toArraycxx . . $ QJsonValueRef#toArray(98974f179f8308bf).(); |
| 322 | |
| 323 | for (auto annotation_ref : annotations) { |
| 324 | if (annotation_ref.isObjectcxx . . $ QJsonValueRef#isObject(50ce9a9e25b4a850).()) { |
| 325 | auto sigmf_annotation = annotation_refcxx . . $ QJsonObject#QJsonObject(ea6cc9b2559123a7)..toObjectcxx . . $ QJsonValueRef#toObject(ac8af9874357714b).(); |
| 326 | |
| 327 | const size_t sample_start = sigmf_annotation[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:sample_start"cxx . . $ QString#QString(85c52e162fed56f9).].toDoublecxx . . $ QJsonValueRef#toDouble(21b6c25e127938e2).(); |
| 328 | |
| 329 | if (sample_start < offset) |
| 330 | continue; |
| 331 | |
| 332 | const size_t rel_sample_start = sample_start - offset; |
| 333 | |
| 334 | const size_t sample_count = sigmf_annotation[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:sample_count"cxx . . $ QString#QString(85c52e162fed56f9).].toDoublecxx . . $ QJsonValueRef#toDouble(21b6c25e127938e2).(); |
| 335 | auto sampleRange = range_tcxx . . $ range_t#<size_t>{rel_sample_start, rel_sample_start + sample_count - 1}; |
| 336 | |
| 337 | const double freq_lower_edge = sigmf_annotation[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:freq_lower_edge"cxx . . $ QString#QString(85c52e162fed56f9).].toDoublecxx . . $ QJsonValueRef#toDouble(21b6c25e127938e2).(); |
| 338 | const double freq_upper_edge = sigmf_annotation[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:freq_upper_edge"cxx . . $ QString#QString(85c52e162fed56f9).].toDoublecxx . . $ QJsonValueRef#toDouble(21b6c25e127938e2).(); |
| 339 | auto frequencyRange = range_tcxx . . $ range_t#<double>{freq_lower_edge, freq_upper_edge}; |
| 340 | |
| 341 | auto label = sigmf_annotationcxx . . $ QString#QString(e1217c004a86c950).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:label"cxx . . $ QString#QString(85c52e162fed56f9).].toStringcxx . . $ QJsonValueRef#toString(6ef7b6c27b00b43d).(); |
| 342 | if (label.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 343 | label =cxx . . $ QString#`operator=`(7b76e6691bca1027). sigmf_annotation[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:description"cxx . . $ QString#QString(85c52e162fed56f9).].toStringcxx . . $ QJsonValueRef#toString(6ef7b6c27b00b43d).(); |
| 344 | } |
| 345 | |
| 346 | auto comment = sigmf_annotationcxx . . $ QString#QString(e1217c004a86c950).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:comment"cxx . . $ QString#QString(85c52e162fed56f9).].toStringcxx . . $ QJsonValueRef#toString(6ef7b6c27b00b43d).(); |
| 347 | |
| 348 | annotationListcxx . . $ SampleSource#annotationList..emplace_backcxx . . $ std/vector#emplace_back(b3d147e3bb711c35).(sampleRange, frequencyRange, label, comment); |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | return rootcxx . . $ QJsonObject#QJsonObject(ea6cc9b2559123a7).; |
| 354 | } |
| 355 | |
| 356 | void InputSourcecxx . . $ InputSource#::openFilecxx . . $ InputSource#openFile(85c52e162fed56f9).(const char *filename) |
| 357 | { |
| 358 | QFileInfocxx . . $ QFileInfo# fileInfocxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(filenamecxx . . $ QString#QString(85c52e162fed56f9).); |
| 359 | stdcxx . . $ std/::stringcxx . . $ std/string# suffix = stdcxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).::stringcxx . . $ std/string#(fileInfo.suffixcxx . . $ QFileInfo#suffix(6ef7b6c27b00b43d).().toLowercxx . . $ QString#toLower(30b3b70527b1c61a).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 360 | if (_fmtcxx . . $ InputSource#_fmt. !=cxx . . $ std/`operator!=`(4b17aa87c9f300c6). "") { suffix =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). _fmtcxx . . $ InputSource#_fmt.; } // allow fmt override |
| 361 | if ((suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "cfile") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "cf32") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "fc32")) { |
| 362 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexF32SampleAdaptercxx . . $ ComplexF32SampleAdapter#>(); |
| 363 | } |
| 364 | else if ((suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "cf64") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "fc64")) { |
| 365 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexF64SampleAdaptercxx . . $ ComplexF64SampleAdapter#>(); |
| 366 | } |
| 367 | else if ((suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "cs32") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sc32") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "c32")) { |
| 368 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexS32SampleAdaptercxx . . $ ComplexS32SampleAdapter#>(); |
| 369 | } |
| 370 | else if ((suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "cs16") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sc16") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "c16")) { |
| 371 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexS16SampleAdaptercxx . . $ ComplexS16SampleAdapter#>(); |
| 372 | } |
| 373 | else if ((suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "cs8") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sc8") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "c8")) { |
| 374 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexS8SampleAdaptercxx . . $ ComplexS8SampleAdapter#>(); |
| 375 | } |
| 376 | else if ((suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "cu8") || (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "uc8")) { |
| 377 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexU8SampleAdaptercxx . . $ ComplexU8SampleAdapter#>(); |
| 378 | } |
| 379 | else if (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "f32") { |
| 380 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealF32SampleAdaptercxx . . $ RealF32SampleAdapter#>(); |
| 381 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 382 | } |
| 383 | else if (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "f64") { |
| 384 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealF64SampleAdaptercxx . . $ RealF64SampleAdapter#>(); |
| 385 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 386 | } |
| 387 | else if (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "s16") { |
| 388 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealS16SampleAdaptercxx . . $ RealS16SampleAdapter#>(); |
| 389 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 390 | } |
| 391 | else if (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "s8") { |
| 392 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealS8SampleAdaptercxx . . $ RealS8SampleAdapter#>(); |
| 393 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 394 | } |
| 395 | else if (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "u8") { |
| 396 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<RealU8SampleAdaptercxx . . $ RealU8SampleAdapter#>(); |
| 397 | _realSignalcxx . . $ InputSource#_realSignal. = true; |
| 398 | } |
| 399 | else { |
| 400 | sampleAdaptercxx . . $ InputSource#sampleAdapter. =cxx . . $ std/unique_ptr#`operator=`(6f36b57f4303fb07). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ComplexF32SampleAdaptercxx . . $ ComplexF32SampleAdapter#>(); |
| 401 | } |
| 402 | |
| 403 | QStringcxx . . $ QString# dataFilenamecxx . . $ QString#QString(49f6e7a06ebc5aa8).; |
| 404 | |
| 405 | annotationListcxx . . $ SampleSource#annotationList..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).(); |
| 406 | QStringcxx . . $ QString# metaFilenamecxx . . $ QString#QString(49f6e7a06ebc5aa8).; |
| 407 | |
| 408 | if (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sigmf-meta" || suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sigmf-data" || suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sigmf-") { |
| 409 | dataFilename =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). fileInfo.pathcxx . . $ QFileInfo#path(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(fab9b4f80031f353). fileInfo.completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). ".sigmf-data"; |
| 410 | metaFilename =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). fileInfo.pathcxx . . $ QFileInfo#path(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(fab9b4f80031f353). fileInfo.completeBaseNamecxx . . $ QFileInfo#completeBaseName(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). ".sigmf-meta"; |
| 411 | auto metaData = readMetaDatacxx . . $ QJsonObject#QJsonObject(ea6cc9b2559123a7).(metaFilename); |
| 412 | QFilecxx . . $ QFile# datafilecxx . . $ QFile#QFile(3520e46b33348bf6).(dataFilename); |
| 413 | if (!datafile.opencxx . . $ QFile#open(dca164408be960c8).(QFilecxx . . $ QFile#::ReadOnlycxx . . $ QIODevice#ReadOnly. |cxx . . $ `operator|`(e858de6b2553445b). QIODevicecxx . . $ QIODevice#::Textcxx . . $ QIODevice#Text.)) { |
| 414 | auto global = metaDatacxx . . $ QJsonObject#QJsonObject(ea6cc9b2559123a7).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."global"cxx . . $ QString#QString(85c52e162fed56f9).].toObjectcxx . . $ QJsonValueRef#toObject(ac8af9874357714b).(); |
| 415 | if (global.containscxx . . $ QJsonObject#contains(f3b39adf77d9c36c).("core:dataset"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 416 | auto datasetfilename = globalcxx . . $ QString#QString(e1217c004a86c950).[cxx . . $ QJsonObject#`operator[]`(6d95a036fce085b4)."core:dataset"cxx . . $ QString#QString(85c52e162fed56f9).].toStringcxx . . $ QJsonValueRef#toString(6ef7b6c27b00b43d).(); |
| 417 | if(QFileInfocxx . . $ QFileInfo#(datasetfilename).isAbsolutecxx . . $ QFileInfo#isAbsolute(50ce9a9e25b4a850).()){ |
| 418 | dataFilename =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). datasetfilename; |
| 419 | } |
| 420 | else{ |
| 421 | dataFilename =cxx . . $ QString#`operator=`(6a89d0b7f4d2681c). fileInfo.pathcxx . . $ QFileInfo#path(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). "/" +cxx . . $ operator+(fab9b4f80031f353). datasetfilename; |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | else if (suffix ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sigmf") { |
| 427 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#("SigMF archives are not supported. Consider extracting a recording."); |
| 428 | } |
| 429 | else { |
| 430 | dataFilename =cxx . . $ QString#`operator=`(d02845eef0c33901). filename; |
| 431 | } |
| 432 | |
| 433 | auto file = stdcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<QFilecxx . . $ QFile#>(dataFilename); |
| 434 | if (!file->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).opencxx . . $ QFile#open(dca164408be960c8).(QFilecxx . . $ QFlags#QFlags(9b289cee16747614).::ReadOnlycxx . . $ QIODevice#ReadOnly.)) { |
| 435 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#(file->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).errorStringcxx . . $ QIODevice#errorString(6ef7b6c27b00b43d).().toStdStringcxx . . $ QString#toStdString(219584694fe2b248).()); |
| 436 | } |
| 437 | |
| 438 | auto size = file->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).sizecxx . . $ QFile#size(98833e9ab7de59a4).(); |
| 439 | sampleCountcxx . . $ InputSource#sampleCount. = size / sampleAdaptercxx . . $ InputSource#sampleAdapter.->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).sampleSizecxx . . $ SampleAdapter#sampleSize(f708dce9a8856c70).(); |
| 440 | |
| 441 | auto data = file->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).mapcxx . . $ QFileDevice#map(cc68507cb16db87).(0, size); |
| 442 | if (data == nullptr) |
| 443 | throw stdcxx . . $ std/runtime_error#runtime_error(6be18eeaba0abf21).::runtime_errorcxx . . $ std/runtime_error#("Error mmapping file"); |
| 444 | |
| 445 | cleanupcxx . . $ InputSource#cleanup(49f6e7a06ebc5aa8).(); |
| 446 | |
| 447 | inputFilecxx . . $ InputSource#inputFile. = file.releasecxx . . $ std/unique_ptr#release(cbf335e921603824).(); |
| 448 | mmapDatacxx . . $ InputSource#mmapData. = data; |
| 449 | |
| 450 | invalidatecxx . . $ AbstractSampleSource#invalidate(49f6e7a06ebc5aa8).(); |
| 451 | } |
| 452 | |
| 453 | void InputSourcecxx . . $ InputSource#::setSampleRatecxx . . $ InputSource#setSampleRate(ba8836b59fb42830).(double rate) |
| 454 | { |
| 455 | sampleRatecxx . . $ InputSource#sampleRate. = rate; |
| 456 | invalidatecxx . . $ AbstractSampleSource#invalidate(49f6e7a06ebc5aa8).(); |
| 457 | } |
| 458 | |
| 459 | double InputSourcecxx . . $ InputSource#::ratecxx . . $ InputSource#rate(31fa7155c10fdd13).() |
| 460 | { |
| 461 | return sampleRatecxx . . $ InputSource#sampleRate.; |
| 462 | } |
| 463 | |
| 464 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>[]> InputSourcecxx . . $ InputSource#::getSamplescxx . . $ InputSource#getSamples(10a87ca57033614e).(size_t start, size_t length) |
| 465 | { |
| 466 | if (inputFilecxx . . $ InputSource#inputFile. == nullptr) |
| 467 | returncxx . . $ std/unique_ptr#unique_ptr(c72f3246697f2f97). nullptrcxx . . $ std/unique_ptr#unique_ptr(49b4c06ce5d54a60).; |
| 468 | |
| 469 | if (mmapDatacxx . . $ InputSource#mmapData. == nullptr) |
| 470 | returncxx . . $ std/unique_ptr#unique_ptr(c72f3246697f2f97). nullptrcxx . . $ std/unique_ptr#unique_ptr(49b4c06ce5d54a60).; |
| 471 | |
| 472 | if(start < 0 || length < 0) |
| 473 | returncxx . . $ std/unique_ptr#unique_ptr(c72f3246697f2f97). nullptrcxx . . $ std/unique_ptr#unique_ptr(49b4c06ce5d54a60).; |
| 474 | |
| 475 | if (start + length > sampleCountcxx . . $ InputSource#sampleCount.) |
| 476 | returncxx . . $ std/unique_ptr#unique_ptr(c72f3246697f2f97). nullptrcxx . . $ std/unique_ptr#unique_ptr(49b4c06ce5d54a60).; |
| 477 | |
| 478 | auto dest = stdcxx . . $ std/unique_ptr#unique_ptr(c72f3246697f2f97).::make_uniquecxx . . $ std/make_unique(dfd06a9f52fea874).<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>[]>(length); |
| 479 | sampleAdaptercxx . . $ InputSource#sampleAdapter.->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).copyRangecxx . . $ SampleAdapter#copyRange(cc8809b61c1fd643).(mmapDatacxx . . $ InputSource#mmapData., start, length, dest.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).()); |
| 480 | |
| 481 | return destcxx . . $ std/unique_ptr#unique_ptr(c72f3246697f2f97).; |
| 482 | } |
| 483 | |
| 484 | void InputSourcecxx . . $ InputSource#::setFormatcxx . . $ InputSource#setFormat(8d4ab0a187bf9331).(stdcxx . . $ std/::stringcxx . . $ std/string# fmt){ |
| 485 | _fmtcxx . . $ InputSource#_fmt. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). fmt; |
| 486 | } |