Formatted the entire codebase and added a CI check for formatting

This commit is contained in:
AlexandreRouma 2021-12-19 22:11:44 +01:00
parent 8644957881
commit ea587db0cb
161 changed files with 3302 additions and 3393 deletions

View File

@ -17,7 +17,7 @@ AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: false
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false

View File

@ -359,3 +359,12 @@ jobs:
- name: Running codespell
run: cd $GITHUB_WORKSPACE && codespell -q 2 || true
check_formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run check_clang_format
run: cd $GITHUB_WORKSPACE && ./check_clang_format.sh || true

View File

@ -5,7 +5,6 @@
#include <filesystem>
ConfigManager::ConfigManager() {
}
ConfigManager::~ConfigManager() {

View File

@ -33,5 +33,4 @@ private:
std::mutex termMtx;
std::condition_variable termCond;
volatile bool termFlag = false;
};

View File

@ -370,15 +370,24 @@ int sdrpp_main(int argc, char *argv[]) {
GLFWimage icons[10];
icons[0].pixels = stbi_load(((std::string)(resDir + "/icons/sdrpp.png")).c_str(), &icons[0].width, &icons[0].height, 0, 4);
icons[1].pixels = (unsigned char*)malloc(16 * 16 * 4); icons[1].width = icons[1].height = 16;
icons[2].pixels = (unsigned char*)malloc(24 * 24 * 4); icons[2].width = icons[2].height = 24;
icons[3].pixels = (unsigned char*)malloc(32 * 32 * 4); icons[3].width = icons[3].height = 32;
icons[4].pixels = (unsigned char*)malloc(48 * 48 * 4); icons[4].width = icons[4].height = 48;
icons[5].pixels = (unsigned char*)malloc(64 * 64 * 4); icons[5].width = icons[5].height = 64;
icons[6].pixels = (unsigned char*)malloc(96 * 96 * 4); icons[6].width = icons[6].height = 96;
icons[7].pixels = (unsigned char*)malloc(128 * 128 * 4); icons[7].width = icons[7].height = 128;
icons[8].pixels = (unsigned char*)malloc(196 * 196 * 4); icons[8].width = icons[8].height = 196;
icons[9].pixels = (unsigned char*)malloc(256 * 256 * 4); icons[9].width = icons[9].height = 256;
icons[1].pixels = (unsigned char*)malloc(16 * 16 * 4);
icons[1].width = icons[1].height = 16;
icons[2].pixels = (unsigned char*)malloc(24 * 24 * 4);
icons[2].width = icons[2].height = 24;
icons[3].pixels = (unsigned char*)malloc(32 * 32 * 4);
icons[3].width = icons[3].height = 32;
icons[4].pixels = (unsigned char*)malloc(48 * 48 * 4);
icons[4].width = icons[4].height = 48;
icons[5].pixels = (unsigned char*)malloc(64 * 64 * 4);
icons[5].width = icons[5].height = 64;
icons[6].pixels = (unsigned char*)malloc(96 * 96 * 4);
icons[6].width = icons[6].height = 96;
icons[7].pixels = (unsigned char*)malloc(128 * 128 * 4);
icons[7].width = icons[7].height = 128;
icons[8].pixels = (unsigned char*)malloc(196 * 196 * 4);
icons[8].width = icons[8].height = 196;
icons[9].pixels = (unsigned char*)malloc(256 * 256 * 4);
icons[9].width = icons[9].height = 256;
stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[1].pixels, 16, 16, 16 * 4, 4);
stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[2].pixels, 24, 24, 24 * 4, 4);
stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[3].pixels, 32, 32, 32 * 4, 4);
@ -403,7 +412,8 @@ int sdrpp_main(int argc, char *argv[]) {
// Setup Dear ImGui context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGuiIO& io = ImGui::GetIO();
(void)io;
io.IniFilename = NULL;
// Setup Platform/Renderer bindings

View File

@ -40,7 +40,6 @@ namespace dsp {
private:
stream<float>* _in;
};
class ChannelsToStereo : public generic_block<ChannelsToStereo> {
@ -98,7 +97,6 @@ namespace dsp {
stream<float>* _in_right;
float* nullbuf;
};
class StereoToMono : public generic_block<StereoToMono> {
@ -153,7 +151,6 @@ namespace dsp {
private:
float *l_buf, *r_buf;
stream<stereo_t>* _in;
};
class StereoToChannels : public generic_block<StereoToChannels> {
@ -197,6 +194,5 @@ namespace dsp {
private:
stream<stereo_t>* _in;
};
}

View File

@ -76,7 +76,7 @@ namespace dsp {
private:
void workerLoop() {
while (run() >= 0);
while (run() >= 0) {}
}
void acquire() {
@ -139,7 +139,6 @@ namespace dsp {
bool running = false;
bool tempStopped = false;
std::thread workerThread;
};
template <class BLOCK>
@ -224,6 +223,5 @@ namespace dsp {
protected:
bool _block_init = false;
std::mutex ctrlMtx;
};
}

View File

@ -173,7 +173,10 @@ namespace dsp {
assert(_init);
if (lock) { _writable_mtx.lock(); };
int _w = writable;
if (lock) { _writable_mtx.unlock(); _readable_mtx.lock(); };
if (lock) {
_writable_mtx.unlock();
_readable_mtx.lock();
};
int _r = readable;
if (lock) { _readable_mtx.unlock(); };
return std::max<int>(std::min<int>(_w, maxLatency - _r), 0);
@ -354,6 +357,5 @@ namespace dsp {
int sizes[TEST_BUFFER_SIZE];
bool stopWorker = false;
};
};

View File

@ -203,6 +203,5 @@ namespace dsp {
stream<T>* _input;
std::vector<ChainLinkAny<T>*> links;
bool running = false;
};
}

View File

@ -65,7 +65,6 @@ namespace dsp {
int counter = 0;
float lastVal = 0;
stream<float>* _in;
};
template <class T>
@ -195,7 +194,9 @@ namespace dsp {
// TODO: Branchless clamp
_dynOmega = _dynOmega + (_gainOmega * phaseError);
if (_dynOmega > omegaMax) { _dynOmega = omegaMax; }
else if (_dynOmega < omegaMin) { _dynOmega = omegaMin; }
else if (_dynOmega < omegaMin) {
_dynOmega = omegaMin;
}
// Adjust the symbol phase according to the phase error approximation
// It will now contain the phase delta needed to jump to the next symbol
@ -250,6 +251,5 @@ namespace dsp {
complex_t _c_0T = { 0, 0 }, _c_1T = { 0, 0 }, _c_2T = { 0, 0 };
stream<T>* _in;
};
}

View File

@ -92,7 +92,6 @@ namespace dsp {
private:
stream<complex_t>* _in;
PCMType _pcmType;
};
class DynamicRangeDecompressor : public generic_block<DynamicRangeDecompressor> {
@ -156,6 +155,5 @@ namespace dsp {
private:
stream<uint8_t>* _in;
};
}

View File

@ -42,7 +42,6 @@ namespace dsp {
private:
stream<complex_t>* _in;
};
class ComplexToReal : public generic_block<ComplexToReal> {
@ -83,7 +82,6 @@ namespace dsp {
private:
stream<complex_t>* _in;
};
class ComplexToImag : public generic_block<ComplexToImag> {
@ -124,7 +122,6 @@ namespace dsp {
private:
stream<complex_t>* _in;
};
@ -176,7 +173,6 @@ namespace dsp {
private:
float* nullBuffer;
stream<float>* _in;
};
class Int16CToComplex : public generic_block<Int16CToComplex> {
@ -217,7 +213,6 @@ namespace dsp {
private:
stream<int16_t>* _in;
};
class ComplexToInt16C : public generic_block<ComplexToInt16C> {
@ -258,7 +253,6 @@ namespace dsp {
private:
stream<complex_t>* _in;
};
class Int16ToFloat : public generic_block<Int16ToFloat> {
@ -299,7 +293,6 @@ namespace dsp {
private:
stream<int16_t>* _in;
};
class FloatToInt16 : public generic_block<FloatToInt16> {
@ -340,6 +333,5 @@ namespace dsp {
private:
stream<float>* _in;
};
}

View File

@ -70,8 +70,6 @@ namespace dsp {
private:
stream<complex_t>* _in;
float correctionRate = 0.00001;
};
class DCBlocker : public generic_block<DCBlocker> {
@ -138,8 +136,6 @@ namespace dsp {
private:
stream<float>* _in;
float correctionRate = 0.00001;
};

View File

@ -102,6 +102,5 @@ namespace dsp {
int tapCount;
float* taps;
int _inIndex = 0;
};
}

View File

@ -87,13 +87,13 @@ namespace dsp {
bitsRead = 0;
continue;
}
}
else { i++; }
else {
i++;
}
nextBitIsStartOfFrame = false;
}
// Keep last _syncLen4 symbols
@ -125,7 +125,6 @@ namespace dsp {
int callcount = 0;
stream<uint8_t>* _in;
};
inline int MachesterHammingDistance(float* data, uint8_t* syncBits, int n) {
@ -208,7 +207,6 @@ namespace dsp {
}
i++;
}
// Keep last _syncLen symbols
@ -230,7 +228,6 @@ namespace dsp {
int bitsRead = -1;
stream<float>* _in;
};
class SymbolDeframer : public generic_block<SymbolDeframer> {
@ -297,7 +294,6 @@ namespace dsp {
}
i++;
}
// Keep last _syncLen symbols
@ -319,7 +315,6 @@ namespace dsp {
int bitsRead = -1;
stream<uint8_t>* _in;
};
class ManchesterDecoder : public generic_block<ManchesterDecoder> {
@ -371,7 +366,6 @@ namespace dsp {
private:
stream<float>* _in;
bool _inverted;
};
class BitPacker : public generic_block<BitPacker> {
@ -415,8 +409,6 @@ namespace dsp {
stream<uint8_t> out;
private:
stream<uint8_t>* _in;
};
}

View File

@ -99,7 +99,9 @@ namespace dsp {
currentPhase = fast_arctan2(_in->readBuf[i].im, _in->readBuf[i].re);
diff = currentPhase - phase;
if (diff > 3.1415926535f) { diff -= 2 * 3.1415926535f; }
else if (diff <= -3.1415926535f) { diff += 2 * 3.1415926535f; }
else if (diff <= -3.1415926535f) {
diff += 2 * 3.1415926535f;
}
out.writeBuf[i] = diff / phasorSpeed;
phase = currentPhase;
}
@ -115,7 +117,6 @@ namespace dsp {
float phase = 0;
float phasorSpeed, _sampleRate, _deviation;
stream<complex_t>* _in;
};
class FMDemod : public generic_block<FMDemod> {
@ -180,7 +181,9 @@ namespace dsp {
currentPhase = fast_arctan2(_in->readBuf[i].im, _in->readBuf[i].re);
diff = currentPhase - phase;
if (diff > 3.1415926535f) { diff -= 2 * 3.1415926535f; }
else if (diff <= -3.1415926535f) { diff += 2 * 3.1415926535f; }
else if (diff <= -3.1415926535f) {
diff += 2 * 3.1415926535f;
}
out.writeBuf[i].l = diff / phasorSpeed;
out.writeBuf[i].r = diff / phasorSpeed;
phase = currentPhase;
@ -197,7 +200,6 @@ namespace dsp {
float phase = 0;
float phasorSpeed, _sampleRate, _deviation;
stream<complex_t>* _in;
};
class AMDemod : public generic_block<AMDemod> {
@ -245,7 +247,6 @@ namespace dsp {
private:
stream<complex_t>* _in;
float avg = 0;
};
class SSBDemod : public generic_block<SSBDemod> {
@ -369,7 +370,6 @@ namespace dsp {
lv_32fc_t* buffer;
lv_32fc_t phase;
lv_32fc_t phaseDelta;
};
class FSKDemod : public generic_hier_block<FSKDemod> {

View File

@ -3,8 +3,7 @@
#include <inttypes.h>
// WTF???
extern "C"
{
extern "C" {
#include <correct.h>
}
@ -99,15 +98,30 @@ namespace dsp {
// Reed the solomon :weary:
int result = 0;
result = correct_reed_solomon_decode(rs, buffers[0], 255, outBuffers[0]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[1], 255, outBuffers[1]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[2], 255, outBuffers[2]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[3], 255, outBuffers[3]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[4], 255, outBuffers[4]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
// Reinterleave
for (int i = 0; i < 255 * 5; i++) {
@ -129,6 +143,5 @@ namespace dsp {
correct_reed_solomon* rs;
stream<uint8_t>* _in;
};
}

View File

@ -92,8 +92,7 @@ namespace dsp {
break;
}
uint64_t pktId = ((uint64_t)data[i + 2] << 56) | ((uint64_t)data[i + 3] << 48) | ((uint64_t)data[i + 4] << 40) | ((uint64_t)data[i + 5] << 32)
| ((uint64_t)data[i + 6] << 24) | ((uint64_t)data[i + 7] << 16) | ((uint64_t)data[i + 8] << 8) | data[i + 9];
uint64_t pktId = ((uint64_t)data[i + 2] << 56) | ((uint64_t)data[i + 3] << 48) | ((uint64_t)data[i + 4] << 40) | ((uint64_t)data[i + 5] << 32) | ((uint64_t)data[i + 6] << 24) | ((uint64_t)data[i + 7] << 16) | ((uint64_t)data[i + 8] << 8) | data[i + 9];
// If the packet doesn't fit the frame, save and go to next frame
if (dataLen - i < length) {
@ -106,7 +105,6 @@ namespace dsp {
memcpy(out.writeBuf, &data[i], length);
out.swap(length);
i += length;
}
_in->flush();
@ -123,6 +121,5 @@ namespace dsp {
uint8_t packet[0x4008];
stream<uint8_t>* _in;
};
}

View File

@ -95,7 +95,6 @@ namespace dsp {
T* buffer;
int tapCount;
float* taps;
};
class ComplexFIR : public generic_block<ComplexFIR> {
@ -180,7 +179,6 @@ namespace dsp {
complex_t* buffer;
int tapCount;
complex_t* taps;
};
class BFMDeemp : public generic_block<BFMDeemp> {
@ -267,6 +265,5 @@ namespace dsp {
float _tau;
float _sampleRate;
stream<stereo_t>* _in;
};
}

View File

@ -82,7 +82,6 @@ namespace dsp {
private:
stream<T>* _a;
stream<T>* _b;
};
template <class T>
@ -163,7 +162,6 @@ namespace dsp {
private:
stream<T>* _a;
stream<T>* _b;
};
template <class T>
@ -244,6 +242,5 @@ namespace dsp {
private:
stream<T>* _a;
stream<T>* _b;
};
}

View File

@ -77,6 +77,5 @@ namespace dsp {
float lvlR = -90.0f;
stream<stereo_t>* _in;
std::mutex lvlMtx;
};
}

View File

@ -61,7 +61,6 @@ namespace dsp {
private:
stream<uint8_t>* _in;
};
}
}

View File

@ -72,7 +72,6 @@ namespace dsp {
private:
stream<uint8_t>* _in;
};
}
}

View File

@ -105,7 +105,6 @@ namespace dsp {
private:
stream<uint8_t>* _in;
};
}
}

View File

@ -132,7 +132,6 @@ namespace dsp {
private:
stream<uint8_t>* _in;
};
inline uint16_t HIRSSignedToUnsigned(uint16_t n) {
@ -236,7 +235,6 @@ namespace dsp {
stream<uint8_t>* _in;
int lastElement = 0;
bool newImageData = false;
};
}
}

View File

@ -189,7 +189,6 @@ namespace dsp {
complex_t* fft_fcout;
int _tapCount;
};
class FFTNoiseReduction : public generic_block<FFTNoiseReduction> {
@ -312,7 +311,6 @@ namespace dsp {
float* delay_start;
complex_t* fft_cout;
float* fft_fout;
};
class NoiseBlanker : public generic_block<NoiseBlanker> {
@ -329,7 +327,8 @@ namespace dsp {
void init(stream<complex_t>* in, float level) {
_in = in;
_level = powf(10.0f, level / 10.0f);;
_level = powf(10.0f, level / 10.0f);
;
ampBuf = (float*)volk_malloc(STREAM_BUFFER_SIZE * sizeof(float), volk_get_alignment());
@ -379,7 +378,6 @@ namespace dsp {
float _level;
stream<complex_t>* _in;
};
class NotchFilter : public generic_block<NotchFilter> {
@ -460,6 +458,5 @@ namespace dsp {
float _offset;
float _sampleRate;
float correctionRate;
};
}

View File

@ -76,19 +76,24 @@ namespace dsp {
if (fabsf(outVal.re) >= fabsf(outVal.im)) {
error = ((outVal.re > 0.0f ? 1.0f : -1.0f) * outVal.im -
(outVal.im > 0.0f ? 1.0f : -1.0f) * outVal.re * K);
} else {
}
else {
error = ((outVal.re > 0.0f ? 1.0f : -1.0f) * outVal.im * K -
(outVal.im > 0.0f ? 1.0f : -1.0f) * outVal.re);
}
}
if (error > 1.0f) { error = 1.0f; }
else if (error < -1.0f) { error = -1.0f; }
else if (error < -1.0f) {
error = -1.0f;
}
// Integrate frequency and clamp it
vcoFrequency += _beta * error;
if (vcoFrequency > 1.0f) { vcoFrequency = 1.0f; }
else if (vcoFrequency < -1.0f) { vcoFrequency = -1.0f; }
else if (vcoFrequency < -1.0f) {
vcoFrequency = -1.0f;
}
// Calculate new phase and wrap it
vcoPhase += vcoFrequency + (_alpha * error);
@ -98,7 +103,6 @@ namespace dsp {
// Calculate output
lastVCO.re = cosf(-vcoPhase);
lastVCO.im = sinf(-vcoPhase);
}
_in->flush();
@ -118,7 +122,6 @@ namespace dsp {
complex_t lastVCO;
stream<complex_t>* _in;
};
template <class T>
@ -188,7 +191,9 @@ namespace dsp {
// TODO: Figure out why fastPhase doesn't work
error = _in->readBuf[i].phase() - vcoPhase;
if (error > 3.1415926535f) { error -= 2.0f * 3.1415926535f; }
else if (error <= -3.1415926535f) { error += 2.0f * 3.1415926535f; }
else if (error <= -3.1415926535f) {
error += 2.0f * 3.1415926535f;
}
// if (error > 1.0f) { error = 1.0f; }
// else if (error < -1.0f) { error = -1.0f; }
@ -196,7 +201,9 @@ namespace dsp {
// Integrate frequency and clamp it
vcoFrequency += _beta * error;
if (vcoFrequency > 1.0f) { vcoFrequency = 1.0f; }
else if (vcoFrequency < -1.0f) { vcoFrequency = -1.0f; }
else if (vcoFrequency < -1.0f) {
vcoFrequency = -1.0f;
}
// Calculate new phase and wrap it
vcoPhase += vcoFrequency + (_alpha * error);
@ -206,7 +213,6 @@ namespace dsp {
// Calculate output
lastVCO.re = cosf(vcoPhase);
lastVCO.im = sinf(vcoPhase);
}
_in->flush();
@ -226,7 +232,6 @@ namespace dsp {
complex_t lastVCO;
stream<complex_t>* _in;
};
class PLL : public generic_block<PLL> {
@ -285,12 +290,16 @@ namespace dsp {
// TODO: Figure out why fastPhase doesn't work
error = _in->readBuf[i].phase() - vcoPhase;
if (error > 3.1415926535f) { error -= 2.0f * 3.1415926535f; }
else if (error <= -3.1415926535f) { error += 2.0f * 3.1415926535f; }
else if (error <= -3.1415926535f) {
error += 2.0f * 3.1415926535f;
}
// Integrate frequency and clamp it
vcoFrequency += _beta * error;
if (vcoFrequency > 1.0f) { vcoFrequency = 1.0f; }
else if (vcoFrequency < -1.0f) { vcoFrequency = -1.0f; }
else if (vcoFrequency < -1.0f) {
vcoFrequency = -1.0f;
}
// Calculate new phase and wrap it
vcoPhase += vcoFrequency + (_alpha * error);
@ -300,7 +309,6 @@ namespace dsp {
// Calculate output
lastVCO.re = cosf(vcoPhase);
lastVCO.im = sinf(vcoPhase);
}
_in->flush();
@ -320,6 +328,5 @@ namespace dsp {
complex_t lastVCO;
stream<complex_t>* _in;
};
}

View File

@ -82,7 +82,6 @@ namespace dsp {
lv_32fc_t phaseDelta;
lv_32fc_t phase;
stream<complex_t>* _in;
};
class AGC : public generic_block<AGC> {
@ -155,7 +154,6 @@ namespace dsp {
float _CorrectedFallRate;
float _sampleRate;
stream<float>* _in;
};
class ComplexAGC : public generic_block<ComplexAGC> {
@ -225,7 +223,6 @@ namespace dsp {
float _rate = 10e-4;
stream<complex_t>* _in;
};
class DelayImag : public generic_block<DelayImag> {
@ -273,11 +270,9 @@ namespace dsp {
private:
float lastIm = 0.0f;
stream<complex_t>* _in;
};
template <class T>
class Volume : public generic_block<Volume<T>> {
public:
@ -358,7 +353,6 @@ namespace dsp {
float _volume = 1.0f;
bool _muted = false;
stream<T>* _in;
};
class Squelch : public generic_block<Squelch> {
@ -431,7 +425,6 @@ namespace dsp {
float* normBuffer;
float _level = -50.0f;
stream<complex_t>* _in;
};
template <class T>
@ -497,7 +490,6 @@ namespace dsp {
int samples = 1;
int read = 0;
stream<T>* _in;
};
class Threshold : public generic_block<Threshold> {
@ -561,7 +553,6 @@ namespace dsp {
float* normBuffer;
float _level = -50.0f;
stream<float>* _in;
};
class BFMPilotToStereo : public generic_block<BFMPilotToStereo> {
@ -614,6 +605,5 @@ namespace dsp {
stream<complex_t>* _in;
complex_t* buffer;
};
}

View File

@ -214,6 +214,5 @@ namespace dsp {
int tapsPerPhase;
std::vector<float*> tapPhases;
};
}

View File

@ -62,7 +62,6 @@ namespace dsp {
stream<T>* _in;
std::vector<stream<T>*> out;
};
template <class T>
@ -110,7 +109,6 @@ namespace dsp {
}
stream<T>* _in;
};
@ -183,7 +181,8 @@ namespace dsp {
}
void loop() {
while (run() >= 0);
while (run() >= 0)
;
}
void doStop() override {
@ -240,6 +239,5 @@ namespace dsp {
std::thread bufferWorkerThread;
std::thread workThread;
int _keep, _skip;
};
}

View File

@ -50,7 +50,6 @@ namespace dsp {
stream<T>* _in;
void (*_handler)(T* data, int count, void* ctx);
void* _ctx;
};
template <class T>
@ -99,7 +98,6 @@ namespace dsp {
}
stream<T>* _in;
};
template <class T>
@ -134,7 +132,6 @@ namespace dsp {
private:
stream<T>* _in;
};
template <class T>
@ -188,6 +185,5 @@ namespace dsp {
private:
stream<T>* _in;
std::ofstream file;
};
}

View File

@ -73,7 +73,6 @@ namespace dsp {
lv_32fc_t phaseDelta;
lv_32fc_t phase;
lv_32fc_t* zeroPhase;
};
template <class T>
@ -111,6 +110,5 @@ namespace dsp {
private:
int (*_handler)(T* data, void* ctx);
void* _ctx;
};
}

View File

@ -98,7 +98,6 @@ namespace dsp {
complex_t* buffer;
int tapCount;
complex_t* taps;
};
class FMStereoDemux : public generic_block<FMStereoDemux> {
@ -169,12 +168,16 @@ namespace dsp {
// Calculate the phase error estimation
error = _pilot->readBuf[i].phase() - vcoPhase;
if (error > 3.1415926535f) { error -= 2.0f * 3.1415926535f; }
else if (error <= -3.1415926535f) { error += 2.0f * 3.1415926535f; }
else if (error <= -3.1415926535f) {
error += 2.0f * 3.1415926535f;
}
// Integrate frequency and clamp it
vcoFrequency += _beta * error;
if (vcoFrequency > upperLimit) { vcoFrequency = upperLimit; }
else if (vcoFrequency < lowerLimit) { vcoFrequency = lowerLimit; }
else if (vcoFrequency < lowerLimit) {
vcoFrequency = lowerLimit;
}
// Calculate new phase and wrap it
vcoPhase += vcoFrequency + (_alpha * error);
@ -284,6 +287,5 @@ namespace dsp {
float* leftBuf;
float* rightBuf;
};
}

View File

@ -109,7 +109,6 @@ namespace dsp {
bool _dualBasis;
int _rsBlockSize;
int _rsParitySize;
};
inline void descramble(uint8_t* in, uint8_t* out, int count) {

View File

@ -60,7 +60,10 @@ namespace dsp {
void setInSampleRate(float inSampleRate) {
assert(_init);
_inSampleRate = inSampleRate;
if (running) { xlator.stop(); resamp.stop(); }
if (running) {
xlator.stop();
resamp.stop();
}
xlator.setSampleRate(_inSampleRate);
resamp.setInSampleRate(_inSampleRate);
float realCutoff = std::min<float>(_bandWidth, std::min<float>(_inSampleRate, _outSampleRate)) / 2.0f;
@ -68,7 +71,10 @@ namespace dsp {
win.setCutoff(realCutoff);
win.setTransWidth(realCutoff);
resamp.updateWindow(&win);
if (running) { xlator.start(); resamp.start(); }
if (running) {
xlator.start();
resamp.start();
}
}
void setOutSampleRate(float outSampleRate) {
@ -123,6 +129,5 @@ namespace dsp {
stream<complex_t>* _in;
FrequencyXlator<complex_t> xlator;
PolyphaseResampler<complex_t> resamp;
};
}

View File

@ -81,7 +81,6 @@ namespace dsp {
private:
float _cutoff, _transWidth, _sampleRate;
};
class BandPassBlackmanWindow : public filter_window::generic_complex_window {
@ -225,8 +224,7 @@ namespace dsp {
double spb = _sampleRate / _baudRate; // samples per bit/symbol
double scale = 0;
for (int i = 0; i < tapCount; i++)
{
for (int i = 0; i < tapCount; i++) {
double x1, x2, x3, num, den;
double xindx = i - tapCount / 2;
x1 = FL_M_PI * xindx / spb;
@ -243,8 +241,7 @@ namespace dsp {
den = x3 * FL_M_PI;
}
else {
if (_alpha == 1)
{
if (_alpha == 1) {
taps[i] = -1;
scale += taps[i];
continue;
@ -268,7 +265,6 @@ namespace dsp {
private:
int _tapCount;
float _sampleRate, _baudRate, _alpha;
};
// class NotchWindow : public filter_window::generic_complex_window {
@ -419,6 +415,5 @@ namespace dsp {
private:
float _frequency, _sampleRate;
int _tapCount;
};
}

View File

@ -10,7 +10,6 @@ namespace credits {
ImFont* bigFont;
void init() {
}
void show() {

File diff suppressed because it is too large Load Diff

View File

@ -49,10 +49,22 @@ void MainWindow::init() {
// Load menu elements
gui::menu.order.clear();
for (auto& elem : menuElements) {
if (!elem.contains("name")) { spdlog::error("Menu element is missing name key"); continue; }
if (!elem["name"].is_string()) { spdlog::error("Menu element name isn't a string"); continue; }
if (!elem.contains("open")) { spdlog::error("Menu element is missing open key"); continue; }
if (!elem["open"].is_boolean()) { spdlog::error("Menu element name isn't a string"); continue; }
if (!elem.contains("name")) {
spdlog::error("Menu element is missing name key");
continue;
}
if (!elem["name"].is_string()) {
spdlog::error("Menu element name isn't a string");
continue;
}
if (!elem.contains("open")) {
spdlog::error("Menu element is missing open key");
continue;
}
if (!elem["open"].is_boolean()) {
spdlog::error("Menu element name isn't a string");
continue;
}
Menu::MenuOption_t opt;
opt.name = elem["name"];
opt.open = elem["open"];
@ -264,8 +276,6 @@ void MainWindow::vfoAddedHandler(VFOManager::VFO* vfo, void* ctx) {
double newOffset = std::clamp<double>(offset, viewLower, viewUpper);
sigpath::vfoManager.setCenterOffset(name, _this->initComplete ? newOffset : offset);
}
void MainWindow::draw() {

View File

@ -64,5 +64,4 @@ private:
bool initComplete = false;
EventHandler<VFOManager::VFO*> vfoCreatedHandler;
};

View File

@ -153,7 +153,5 @@ namespace displaymenu {
}
ImGui::Text("Color map Author: %s", colorMapAuthor.c_str());
}
}
}

View File

@ -51,12 +51,24 @@ namespace sourecmenu {
void updateOffset() {
if (offsetMode == OFFSET_MODE_CUSTOM) { effectiveOffset = customOffset; }
else if (offsetMode == OFFSET_MODE_SPYVERTER) { effectiveOffset = 120000000; } // 120MHz Up-conversion
else if (offsetMode == OFFSET_MODE_HAM_IT_UP) { effectiveOffset = 125000000; } // 125MHz Up-conversion
else if (offsetMode == OFFSET_MODE_DK5AV_XB) { effectiveOffset = -6800000000; } // 6.8GHz Down-conversion
else if (offsetMode == OFFSET_MODE_KU_LNB_9750) { effectiveOffset = -9750000000; } // 9.750GHz Down-conversion
else if (offsetMode == OFFSET_MODE_KU_LNB_10700) { effectiveOffset = -10700000000; } // 10.7GHz Down-conversion
else { effectiveOffset = 0; }
else if (offsetMode == OFFSET_MODE_SPYVERTER) {
effectiveOffset = 120000000;
} // 120MHz Up-conversion
else if (offsetMode == OFFSET_MODE_HAM_IT_UP) {
effectiveOffset = 125000000;
} // 125MHz Up-conversion
else if (offsetMode == OFFSET_MODE_DK5AV_XB) {
effectiveOffset = -6800000000;
} // 6.8GHz Down-conversion
else if (offsetMode == OFFSET_MODE_KU_LNB_9750) {
effectiveOffset = -9750000000;
} // 9.750GHz Down-conversion
else if (offsetMode == OFFSET_MODE_KU_LNB_10700) {
effectiveOffset = -10700000000;
} // 10.7GHz Down-conversion
else {
effectiveOffset = 0;
}
sigpath::sourceManager.setTuningOffset(effectiveOffset);
}

View File

@ -20,7 +20,8 @@ public:
std::vector<std::string> getThemeNames();
ImVec4 waterfallBg = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);;
ImVec4 waterfallBg = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
;
ImVec4 clearColor = ImVec4(0.0666f, 0.0666f, 0.0666f, 1.0f);
private:
@ -29,5 +30,4 @@ private:
static std::map<std::string, int> IMGUI_COL_IDS;
std::map<std::string, Theme> themes;
};

View File

@ -20,6 +20,5 @@ namespace ImGui {
private:
std::mutex bufferMtx;
dsp::complex_t buffer[1024];
};
}

View File

@ -15,13 +15,11 @@ bool isInArea(ImVec2 val, ImVec2 min, ImVec2 max) {
}
FrequencySelect::FrequencySelect() {
}
void FrequencySelect::init() {
for (int i = 0; i < 12; i++) {
digits[i] = 0;
}
}
@ -45,7 +43,6 @@ void FrequencySelect::onPosChange() {
}
void FrequencySelect::onResize() {
}
void FrequencySelect::incrementDigit(int i) {

View File

@ -28,6 +28,5 @@ namespace ImGui {
GLuint textureId;
bool newData = false;
};
}

View File

@ -37,7 +37,5 @@ namespace ImGui {
GLuint textureId;
bool newData = false;
};
}

View File

@ -4,7 +4,6 @@
#include <gui/style.h>
Menu::Menu() {
}
void Menu::registerEntry(std::string name, void (*drawHandler)(void* ctx), void* ctx, ModuleManager::Instance* inst) {

View File

@ -25,6 +25,5 @@ namespace ImGui {
float* buffer;
float _scale;
int sampleCount = 0;
};
}

View File

@ -268,11 +268,15 @@ namespace ImGui {
bool resizing = false;
if (_vfo->reference != REF_LOWER) {
if (IS_IN_AREA(mousePos, _vfo->lbwSelMin, _vfo->lbwSelMax)) { resizing = true; }
else if (IS_IN_AREA(mousePos, _vfo->wfLbwSelMin, _vfo->wfLbwSelMax)) { resizing = true; }
else if (IS_IN_AREA(mousePos, _vfo->wfLbwSelMin, _vfo->wfLbwSelMax)) {
resizing = true;
}
}
if (_vfo->reference != REF_UPPER) {
if (IS_IN_AREA(mousePos, _vfo->rbwSelMin, _vfo->rbwSelMax)) { resizing = true; }
else if (IS_IN_AREA(mousePos, _vfo->wfRbwSelMin, _vfo->wfRbwSelMax)) { resizing = true; }
else if (IS_IN_AREA(mousePos, _vfo->wfRbwSelMin, _vfo->wfRbwSelMax)) {
resizing = true;
}
}
if (!resizing) { continue; }
relatedVfo = _vfo;
@ -1138,7 +1142,6 @@ namespace ImGui {
}
reference = ref;
setOffset(generalOffset);
}
void WaterfallVFO::updateDrawingVars(double viewBandwidth, float dataWidth, double viewOffset, ImVec2 widgetPos, int fftHeight) {
@ -1202,11 +1205,15 @@ namespace ImGui {
if (rectMax.x - rectMin.x < 10) { return; }
if (reference != REF_LOWER && !bandwidthLocked && !leftClamped) {
if (IS_IN_AREA(mousePos, lbwSelMin, lbwSelMax)) { ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); }
else if (IS_IN_AREA(mousePos, wfLbwSelMin, wfLbwSelMax)) { ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); }
else if (IS_IN_AREA(mousePos, wfLbwSelMin, wfLbwSelMax)) {
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
}
}
if (reference != REF_UPPER && !bandwidthLocked && !rightClamped) {
if (IS_IN_AREA(mousePos, rbwSelMin, rbwSelMax)) { ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); }
else if (IS_IN_AREA(mousePos, wfRbwSelMin, wfRbwSelMax)) { ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); }
else if (IS_IN_AREA(mousePos, wfRbwSelMin, wfRbwSelMax)) {
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
}
}
}
};
@ -1254,4 +1261,3 @@ namespace ImGui {
snapInterval = interval;
}
};

View File

@ -98,7 +98,6 @@ public:
std::map<std::string, ModuleManager::Module_t> modules;
std::map<std::string, ModuleManager::Instance_t> instances;
};
#define SDRPP_MOD_INFO MOD_EXPORT const ModuleManager::ModuleInfo_t _INFO_

View File

@ -2,7 +2,6 @@
#include <core.h>
SignalPath::SignalPath() {
}
void SignalPath::init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*, int, void*), void* fftHandlerCtx) {

View File

@ -86,7 +86,6 @@ public:
private:
dsp::NullSink<dsp::stereo_t> ns;
};
void registerSinkProvider(std::string name, SinkProvider provider);
@ -130,5 +129,4 @@ private:
std::vector<std::string> providerNames;
std::string providerNamesTxt;
std::vector<std::string> streamNames;
};

View File

@ -3,7 +3,6 @@
#include <signal_path/signal_path.h>
SourceManager::SourceManager() {
}
void SourceManager::registerSource(std::string name, SourceHandler* handler) {

View File

@ -43,5 +43,4 @@ private:
double tuneOffset;
double currentFreq;
dsp::stream<dsp::complex_t> nullSource;
};

View File

@ -87,7 +87,6 @@ std::string VFOManager::VFO::getName() {
}
VFOManager::VFOManager() {
}
VFOManager::VFO* VFOManager::createVFO(std::string name, int reference, double offset, double bandwidth, double sampleRate, double minBandwidth, double maxBandwidth, bool bandwidthLocked) {

View File

@ -35,7 +35,6 @@ public:
private:
std::string name;
};
VFOManager::VFO* createVFO(std::string name, int reference, double offset, double bandwidth, double sampleRate, double minBandwidth, double maxBandwidth, bool bandwidthLocked);

View File

@ -11,9 +11,15 @@ namespace color {
// Calculate the hue
if (delta == 0) { h = 0; }
else if (r > g && r > b) { h = 60.0f * fmodf((g - b) / delta, 6.0f); }
else if (g > r && g > b) { h = 60.0f * (((b - r) / delta) + 2.0f); }
else { h = 60.0f * (((r - g) / delta) + 4.0f); }
else if (r > g && r > b) {
h = 60.0f * fmodf((g - b) / delta, 6.0f);
}
else if (g > r && g > b) {
h = 60.0f * (((b - r) / delta) + 2.0f);
}
else {
h = 60.0f * (((r - g) / delta) + 4.0f);
}
// Calculate lightness
l = (cmin + cmax) / 2.0f;
@ -29,12 +35,36 @@ namespace color {
float m = l - (c / 2.0f);
// Affect coefficients to R, G or B depending on hue
if (h < 60) { r = c; g = x; b = 0; }
else if (h < 120) { r = x; g = c; b = 0; }
else if (h < 180) { r = 0; g = c; b = x; }
else if (h < 240) { r = 0; g = x; b = c; }
else if (h < 300) { r = x; g = 0; b = c; }
else { r = c; g = 0; b = x; }
if (h < 60) {
r = c;
g = x;
b = 0;
}
else if (h < 120) {
r = x;
g = c;
b = 0;
}
else if (h < 180) {
r = 0;
g = c;
b = x;
}
else if (h < 240) {
r = 0;
g = x;
b = c;
}
else if (h < 300) {
r = x;
g = 0;
b = c;
}
else {
r = c;
g = 0;
b = x;
}
// Add m
r += m;

View File

@ -40,5 +40,4 @@ public:
private:
std::vector<EventHandler<T>*> handlers;
};

View File

@ -9,7 +9,10 @@ namespace utils {
int len = strlen(str) - 1;
while ((str[len] == '0' || str[len] == '.') && len > 0) {
len--;
if (str[len] == '.') { len--; break; }
if (str[len] == '.') {
len--;
break;
}
}
return std::string(str).substr(0, len + 1) + "MHz";
}
@ -18,7 +21,10 @@ namespace utils {
int len = strlen(str) - 1;
while ((str[len] == '0' || str[len] == '.') && len > 0) {
len--;
if (str[len] == '.') { len--; break; }
if (str[len] == '.') {
len--;
break;
}
}
return std::string(str).substr(0, len + 1) + "KHz";
}
@ -27,7 +33,10 @@ namespace utils {
int len = strlen(str) - 1;
while ((str[len] == '0' || str[len] == '.') && len > 0) {
len--;
if (str[len] == '.') { len--; break; }
if (str[len] == '.') {
len--;
break;
}
}
return std::string(str).substr(0, len + 1) + "Hz";
}

View File

@ -261,7 +261,6 @@ namespace net {
if (acceptWorkerThread.joinable()) { acceptWorkerThread.join(); }
listening = false;
}

View File

@ -78,7 +78,6 @@ namespace net {
Socket _sock;
bool _udp;
struct sockaddr_in remoteAddr;
};
typedef std::unique_ptr<ConnClass> Conn;
@ -112,7 +111,6 @@ namespace net {
std::thread acceptWorkerThread;
Socket sock;
};
typedef std::unique_ptr<ListenerClass> Listener;

View File

@ -115,5 +115,4 @@ private:
std::vector<std::string> names;
std::vector<T> values;
std::string _txt;
};

View File

@ -3,8 +3,7 @@
#include <inttypes.h>
// WTF???
extern "C"
{
extern "C" {
#include <correct.h>
}
@ -92,15 +91,30 @@ namespace dsp {
// Reed the solomon :weary:
int result = 0;
result = correct_reed_solomon_decode(rs, buffers[0], 255, outBuffers[0]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[1], 255, outBuffers[1]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[2], 255, outBuffers[2]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[3], 255, outBuffers[3]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
result = correct_reed_solomon_decode(rs, buffers[4], 255, outBuffers[4]);
if (result == -1) { _in->flush(); return count; }
if (result == -1) {
_in->flush();
return count;
}
// Reinterleave
for (int i = 0; i < 255 * 5; i++) {
@ -122,6 +136,5 @@ namespace dsp {
correct_reed_solomon* rs;
stream<uint8_t>* _in;
};
}

View File

@ -85,8 +85,7 @@ namespace dsp {
break;
}
uint64_t pktId = ((uint64_t)data[i + 2] << 56) | ((uint64_t)data[i + 3] << 48) | ((uint64_t)data[i + 4] << 40) | ((uint64_t)data[i + 5] << 32)
| ((uint64_t)data[i + 6] << 24) | ((uint64_t)data[i + 7] << 16) | ((uint64_t)data[i + 8] << 8) | data[i + 9];
uint64_t pktId = ((uint64_t)data[i + 2] << 56) | ((uint64_t)data[i + 3] << 48) | ((uint64_t)data[i + 4] << 40) | ((uint64_t)data[i + 5] << 32) | ((uint64_t)data[i + 6] << 24) | ((uint64_t)data[i + 7] << 16) | ((uint64_t)data[i + 8] << 8) | data[i + 9];
// If the packet doesn't fit the frame, save and go to next frame
if (dataLen - i < length) {
@ -99,7 +98,6 @@ namespace dsp {
memcpy(out.writeBuf, &data[i], length);
out.swap(length);
i += length;
}
_in->flush();
@ -116,6 +114,5 @@ namespace dsp {
uint8_t packet[0x4008];
stream<uint8_t>* _in;
};
}

View File

@ -84,7 +84,6 @@ public:
}
~Falcon9DecoderModule() {
}
void postInit() {}
@ -187,8 +186,7 @@ private:
Falcon9DecoderModule* _this = (Falcon9DecoderModule*)ctx;
uint16_t length = (((data[0] & 0b1111) << 8) | data[1]) + 2;
uint64_t pktId = ((uint64_t)data[2] << 56) | ((uint64_t)data[3] << 48) | ((uint64_t)data[4] << 40) | ((uint64_t)data[5] << 32)
| ((uint64_t)data[6] << 24) | ((uint64_t)data[7] << 16) | ((uint64_t)data[8] << 8) | data[9];
uint64_t pktId = ((uint64_t)data[2] << 56) | ((uint64_t)data[3] << 48) | ((uint64_t)data[4] << 40) | ((uint64_t)data[5] << 32) | ((uint64_t)data[6] << 24) | ((uint64_t)data[7] << 16) | ((uint64_t)data[8] << 8) | data[9];
if (pktId == 0x0117FE0800320303 || pktId == 0x0112FA0800320303) {
data[length - 2] = 0;
@ -243,7 +241,6 @@ private:
VFOManager::VFO* vfo;
ImGui::SymbolDiagram symDiag;
};
MOD_EXPORT void _INIT_() {

View File

@ -6,24 +6,20 @@
#include <array>
#include <cstddef>
namespace mobilinkd
{
namespace mobilinkd {
template <uint16_t Poly = 0x5935, uint16_t Init = 0xFFFF>
struct CRC16
{
struct CRC16 {
static constexpr uint16_t MASK = 0xFFFF;
static constexpr uint16_t LSB = 0x0001;
static constexpr uint16_t MSB = 0x8000;
uint16_t reg_ = Init;
void reset()
{
void reset() {
reg_ = Init;
for (size_t i = 0; i != 16; ++i)
{
for (size_t i = 0; i != 16; ++i) {
auto bit = reg_ & LSB;
if (bit) reg_ ^= Poly;
reg_ >>= 1;
@ -33,15 +29,12 @@ struct CRC16
reg_ &= MASK;
}
void operator()(uint8_t byte)
{
void operator()(uint8_t byte) {
reg_ = crc(byte, reg_);
}
uint16_t crc(uint8_t byte, uint16_t reg)
{
for (size_t i = 0; i != 8; ++i)
{
uint16_t crc(uint8_t byte, uint16_t reg) {
for (size_t i = 0; i != 8; ++i) {
auto msb = reg & MSB;
reg = ((reg << 1) & MASK) | ((byte >> (7 - i)) & LSB);
if (msb) reg ^= Poly;
@ -49,11 +42,9 @@ struct CRC16
return reg & MASK;
}
uint16_t get()
{
uint16_t get() {
auto reg = reg_;
for (size_t i = 0; i != 16; ++i)
{
for (size_t i = 0; i != 16; ++i) {
auto msb = reg & MSB;
reg = ((reg << 1) & MASK);
if (msb) reg ^= Poly;
@ -61,8 +52,7 @@ struct CRC16
return reg;
}
std::array<uint8_t, 2> get_bytes()
{
std::array<uint8_t, 2> get_bytes() {
auto crc = get();
std::array<uint8_t, 2> result{ uint8_t((crc >> 8) & 0xFF), uint8_t(crc & 0xFF) };
return result;

View File

@ -13,8 +13,7 @@ namespace mobilinkd {
// Parts are adapted from:
// http://aqdi.com/articles/using-the-golay-error-detection-and-correction-code-3/
namespace Golay24
{
namespace Golay24 {
int popcount(uint32_t n) {
int count = 0;
@ -24,38 +23,31 @@ namespace Golay24
return count;
}
namespace detail
{
namespace detail {
// Need a constexpr sort.
// https://stackoverflow.com/a/40030044/854133
template <class T>
void swap(T& l, T& r)
{
void swap(T& l, T& r) {
T tmp = std::move(l);
l = std::move(r);
r = std::move(tmp);
}
template <typename T, size_t N>
struct array
{
constexpr T& operator[](size_t i)
{
struct array {
constexpr T& operator[](size_t i) {
return arr[i];
}
constexpr const T& operator[](size_t i) const
{
constexpr const T& operator[](size_t i) const {
return arr[i];
}
constexpr const T* begin() const
{
constexpr const T* begin() const {
return arr;
}
constexpr const T* end() const
{
constexpr const T* end() const {
return arr + N;
}
@ -63,10 +55,8 @@ struct array
};
template <typename T, size_t N>
void sort_impl(array<T, N> &array, size_t left, size_t right)
{
if (left < right)
{
void sort_impl(array<T, N>& array, size_t left, size_t right) {
if (left < right) {
size_t m = left;
for (size_t i = left + 1; i < right; i++)
@ -81,8 +71,7 @@ void sort_impl(array<T, N> &array, size_t left, size_t right)
}
template <typename T, size_t N>
array<T, N> sort(array<T, N> array)
{
array<T, N> sort(array<T, N> array) {
auto sorted = array;
sort_impl(sorted, 0, N);
return sorted;
@ -94,8 +83,7 @@ array<T, N> sort(array<T, N> array)
constexpr uint16_t POLY = 0xC75;
#pragma pack(push, 1)
struct SyndromeMapEntry
{
struct SyndromeMapEntry {
uint32_t a{ 0 };
uint16_t b{ 0 };
};
@ -106,11 +94,9 @@ struct SyndromeMapEntry
*
* @return the 11-bit syndrome of the codeword in bits [22:12].
*/
uint32_t syndrome(uint32_t codeword)
{
uint32_t syndrome(uint32_t codeword) {
codeword &= 0xffffffl;
for (size_t i = 0; i != 12; ++i)
{
for (size_t i = 0; i != 12; ++i) {
if (codeword & 1)
codeword ^= POLY;
codeword >>= 1;
@ -118,52 +104,42 @@ uint32_t syndrome(uint32_t codeword)
return (codeword << 12);
}
bool parity(uint32_t codeword)
{
bool parity(uint32_t codeword) {
return popcount(codeword) & 1;
}
SyndromeMapEntry makeSyndromeMapEntry(uint64_t val)
{
SyndromeMapEntry makeSyndromeMapEntry(uint64_t val) {
return SyndromeMapEntry{ uint32_t(val >> 16), uint16_t(val & 0xFFFF) };
}
uint64_t makeSME(uint64_t syndrome, uint32_t bits)
{
uint64_t makeSME(uint64_t syndrome, uint32_t bits) {
return (syndrome << 24) | (bits & 0xFFFFFF);
}
constexpr size_t LUT_SIZE = 2048;
std::array<SyndromeMapEntry, LUT_SIZE> make_lut()
{
std::array<SyndromeMapEntry, LUT_SIZE> make_lut() {
constexpr size_t VECLEN = 23;
detail::array<uint64_t, LUT_SIZE> result{};
size_t index = 0;
result[index++] = makeSME(syndrome(0), 0);
for (size_t i = 0; i != VECLEN; ++i)
{
for (size_t i = 0; i != VECLEN; ++i) {
auto v = (1 << i);
result[index++] = makeSME(syndrome(v), v);
}
for (size_t i = 0; i != VECLEN - 1; ++i)
{
for (size_t j = i + 1; j != VECLEN; ++j)
{
for (size_t i = 0; i != VECLEN - 1; ++i) {
for (size_t j = i + 1; j != VECLEN; ++j) {
auto v = (1 << i) | (1 << j);
result[index++] = makeSME(syndrome(v), v);
}
}
for (size_t i = 0; i != VECLEN - 2; ++i)
{
for (size_t j = i + 1; j != VECLEN - 1; ++j)
{
for (size_t k = j + 1; k != VECLEN; ++k)
{
for (size_t i = 0; i != VECLEN - 2; ++i) {
for (size_t j = i + 1; j != VECLEN - 1; ++j) {
for (size_t k = j + 1; k != VECLEN; ++k) {
auto v = (1 << i) | (1 << j) | (1 << k);
result[index++] = makeSME(syndrome(v), v);
}
@ -173,8 +149,7 @@ std::array<SyndromeMapEntry, LUT_SIZE> make_lut()
result = detail::sort(result);
std::array<SyndromeMapEntry, LUT_SIZE> tmp;
for (size_t i = 0; i != LUT_SIZE; ++i)
{
for (size_t i = 0; i != LUT_SIZE; ++i) {
tmp[i] = makeSyndromeMapEntry(result[i]);
}
@ -188,12 +163,10 @@ inline auto LUT = make_lut();
*
* @return checkbits(11)|data(12).
*/
uint32_t encode23(uint16_t data)
{
uint32_t encode23(uint16_t data) {
// data &= 0xfff;
uint32_t codeword = data;
for (size_t i = 0; i != 12; ++i)
{
for (size_t i = 0; i != 12; ++i) {
if (codeword & 1)
codeword ^= POLY;
codeword >>= 1;
@ -201,22 +174,19 @@ uint32_t encode23(uint16_t data)
return codeword | (data << 11);
}
uint32_t encode24(uint16_t data)
{
uint32_t encode24(uint16_t data) {
auto codeword = encode23(data);
return ((codeword << 1) | parity(codeword));
}
bool decode(uint32_t input, uint32_t& output)
{
bool decode(uint32_t input, uint32_t& output) {
auto syndrm = syndrome(input >> 1);
auto it = std::lower_bound(LUT.begin(), LUT.end(), syndrm,
[](const SyndromeMapEntry& sme, uint32_t val) {
return (sme.a >> 8) < val;
});
if ((it->a >> 8) == syndrm)
{
if ((it->a >> 8) == syndrm) {
// Build the correction from the compressed entry.
auto correction = ((((it->a & 0xFF) << 16) | it->b) << 1);
// Apply the correction to the input.

View File

@ -130,7 +130,6 @@ namespace dsp {
private:
stream<float>* _in;
};
class M17FrameDemux : public generic_block<M17FrameDemux> {
@ -176,7 +175,10 @@ namespace dsp {
for (int i = 0; i < count;) {
if (detect) {
if (outCount < M17_SYNC_SIZE) { outCount++; i++; }
if (outCount < M17_SYNC_SIZE) {
outCount++;
i++;
}
else {
int id = M17_INTERLEAVER[outCount - M17_SYNC_SIZE];
@ -264,7 +266,6 @@ namespace dsp {
int type;
int outCount = 0;
};
class M17LSFDecoder : public generic_block<M17LSFDecoder> {
@ -343,7 +344,6 @@ namespace dsp {
uint8_t lsf[30];
correct_convolutional* conv;
};
class M17PayloadFEC : public generic_block<M17PayloadFEC> {
@ -417,7 +417,6 @@ namespace dsp {
uint8_t packed[37];
correct_convolutional* conv;
};
class M17Codec2Decode : public generic_block<M17Codec2Decode> {
@ -489,7 +488,6 @@ namespace dsp {
CODEC2* codec;
int sampsPerC2Frame = 0;
int sampsPerC2FrameDouble = 0;
};
class M17LICHDecoder : public generic_block<M17LICHDecoder> {
@ -590,7 +588,6 @@ namespace dsp {
uint8_t lsf[240];
bool newFrame = false;
int lastId = 0;
};
class M17Decoder : public generic_hier_block<M17Decoder> {
@ -662,6 +659,5 @@ namespace dsp {
float _sampleRate;
};
}

View File

@ -240,7 +240,6 @@ private:
std::ofstream recFile;
int8_t* writeBuffer;
};
MOD_EXPORT void _INIT_() {

View File

@ -686,5 +686,4 @@ private:
const double MAX_SQUELCH = 0.0;
bool enabled = true;
};

View File

@ -129,7 +129,6 @@ private:
int decoderId = 0;
SatDecoder* decoder;
};
MOD_EXPORT void _INIT_() {

View File

@ -391,102 +391,82 @@ private:
// HIRS Data Handlers
static void hirs1Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs2Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs3Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs4Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs5Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs6Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs7Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs8Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs9Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs10Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs11Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs12Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs13Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs14Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs15Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs16Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs17Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs18Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs19Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void hirs20Handler(uint16_t* data, int count, void* ctx) {
NOAAHRPTDecoder* _this = (NOAAHRPTDecoder*)ctx;
}
static void visHandler(float* data, int count, void* ctx) {
@ -568,5 +548,4 @@ private:
std::thread compositeThread;
bool showWindow = false;
};

View File

@ -43,7 +43,6 @@ private:
std::string name;
bool enabled = true;
};
MOD_EXPORT void _INIT_() {

View File

@ -61,7 +61,6 @@ public:
}
private:
// Main thread
void worker() {
// TODO: Switch out for condition variable to terminate thread instantly
@ -87,12 +86,24 @@ private:
int modeNum;
core::modComManager.callInterface(selectedName, RADIO_IFACE_CMD_GET_MODE, NULL, &modeNum);
if (modeNum == RADIO_IFACE_MODE_NFM) { strcpy(mode, "NFM"); }
else if (modeNum == RADIO_IFACE_MODE_WFM) { strcpy(mode, "FM"); }
else if (modeNum == RADIO_IFACE_MODE_AM) { strcpy(mode, "AM"); }
else if (modeNum == RADIO_IFACE_MODE_DSB) { strcpy(mode, "DSB"); }
else if (modeNum == RADIO_IFACE_MODE_USB) { strcpy(mode, "USB"); }
else if (modeNum == RADIO_IFACE_MODE_CW) { strcpy(mode, "CW"); }
else if (modeNum == RADIO_IFACE_MODE_LSB) { strcpy(mode, "LSB"); }
else if (modeNum == RADIO_IFACE_MODE_WFM) {
strcpy(mode, "FM");
}
else if (modeNum == RADIO_IFACE_MODE_AM) {
strcpy(mode, "AM");
}
else if (modeNum == RADIO_IFACE_MODE_DSB) {
strcpy(mode, "DSB");
}
else if (modeNum == RADIO_IFACE_MODE_USB) {
strcpy(mode, "USB");
}
else if (modeNum == RADIO_IFACE_MODE_CW) {
strcpy(mode, "CW");
}
else if (modeNum == RADIO_IFACE_MODE_LSB) {
strcpy(mode, "LSB");
}
}
}
@ -146,7 +157,6 @@ private:
int workerCounter = 0;
std::thread workerThread;
bool workerRunning;
};
MOD_EXPORT void _INIT_() {

View File

@ -104,7 +104,6 @@ public:
}
private:
static void applyBookmark(FrequencyBookmark bm, std::string vfoName) {
if (vfoName == "") {
// TODO: Replace with proper tune call
@ -353,7 +352,9 @@ private:
// TODO: Replace with something that won't iterate every frame
std::vector<std::string> selectedNames;
for (auto& [name, bm] : _this->bookmarks) { if (bm.selected) { selectedNames.push_back(name); } }
for (auto& [name, bm] : _this->bookmarks) {
if (bm.selected) { selectedNames.push_back(name); }
}
float lineHeight = ImGui::GetTextLineHeightWithSpacing();
@ -822,7 +823,6 @@ private:
std::vector<WaterfallBookmark> waterfallBookmarks;
int bookmarkDisplayMode = 0;
};
MOD_EXPORT void _INIT_() {

View File

@ -38,7 +38,8 @@ std::string genFileName(std::string prefix, bool isVfo, std::string name = "") {
time_t now = time(0);
tm* ltm = localtime(&now);
char buf[1024];
double freq = gui::waterfall.getCenterFrequency();;
double freq = gui::waterfall.getCenterFrequency();
;
if (isVfo && gui::waterfall.vfos.find(name) != gui::waterfall.vfos.end()) {
freq += gui::waterfall.vfos[name]->generalOffset;
}
@ -507,7 +508,6 @@ private:
EventHandler<std::string> streamRegisteredHandler;
EventHandler<std::string> streamUnregisterHandler;
EventHandler<std::string> streamUnregisteredHandler;
};
struct RecorderContext_t {

View File

@ -43,7 +43,6 @@ private:
std::string name;
bool enabled = true;
};
MOD_EXPORT void _INIT_() {

View File

@ -8,11 +8,9 @@ namespace sched_action {
~StartRecorderClass() {}
void trigger() {
}
void prepareEditMenu() {
}
bool showEditMenu(bool& valid) {
@ -40,7 +38,6 @@ namespace sched_action {
std::string recorderName;
std::string name = "Start \"\"";
};
Action StartRecorder() {

View File

@ -138,7 +138,6 @@ namespace sched_action {
int vfoNameId = -1;
std::string name;
};
Action TuneVFO() {

View File

@ -127,7 +127,6 @@ private:
char editedName[1024];
std::map<std::string, Task> tasks;
};
MOD_EXPORT void _INIT_() {

View File

@ -119,5 +119,4 @@ private:
std::vector<sched_action::Action> actions;
int editedAction = -1;
};

View File

@ -59,7 +59,6 @@ public:
}
~AudioSink() {
}
void start() {
@ -234,7 +233,6 @@ private:
unsigned int sampleRate = 48000;
RtAudio audio;
};
class AudioSinkModule : public ModuleManager::Instance {
@ -274,7 +272,6 @@ private:
std::string name;
bool enabled = true;
SinkManager::SinkProvider provider;
};
MOD_EXPORT void _INIT_() {

View File

@ -83,11 +83,17 @@ public:
sprintf(buffer, "%d", (int)sr);
sampleRatesTxt += buffer;
sampleRatesTxt += '\0';
if (sr == sampleRate) { srId = id; found = true; }
if (sr == sampleRate) {
srId = id;
found = true;
}
if (sr == 48000.0) { _48kId = id; }
id++;
}
if (!found) { srId = _48kId; sampleRate = 48000.0; }
if (!found) {
srId = _48kId;
sampleRate = 48000.0;
}
_stream->setSampleRate(sampleRate);
// Start if needed
@ -259,7 +265,6 @@ private:
_this->conn->close();
}
else {
}
_this->listener->acceptAsync(clientHandler, _this);
@ -291,7 +296,6 @@ private:
net::Listener listener;
net::Conn conn;
std::mutex connMtx;
};
class NetworkSinkModule : public ModuleManager::Instance {
@ -331,7 +335,6 @@ private:
std::string name;
bool enabled = true;
SinkManager::SinkProvider provider;
};
MOD_EXPORT void _INIT_() {

View File

@ -421,7 +421,6 @@ private:
std::string name;
bool enabled = true;
SinkManager::SinkProvider provider;
};
MOD_EXPORT void _INIT_() {

View File

@ -277,7 +277,6 @@ private:
std::vector<AudioDevice_t*> devices;
std::vector<std::string> deviceNames;
std::string txtDevList;
};
class AudioSinkModule : public ModuleManager::Instance {
@ -319,7 +318,6 @@ private:
std::string name;
bool enabled = true;
SinkManager::SinkProvider provider;
};
MOD_EXPORT void _INIT_() {
@ -333,9 +331,7 @@ MOD_EXPORT void* _CREATE_INSTANCE_(std::string name) {
}
MOD_EXPORT void _DELETE_INSTANCE_() {
}
MOD_EXPORT void _END_() {
}

View File

@ -536,8 +536,6 @@ private:
config.release(true);
}
}
}
static int callback(airspy_transfer_t* transfer) {

View File

@ -100,7 +100,9 @@ public:
void selectFirst() {
if (devCount > 0) { selectByInfo(&devInfoList[0]); }
else { selectedSerial = ""; }
else {
selectedSerial = "";
}
}
void selectBySerial(std::string serial, bool reloadChannelId = true) {
@ -154,9 +156,13 @@ public:
if (config.conf["devices"][info->serial].contains("channelId")) {
chanId = config.conf["devices"][info->serial]["channelId"];
}
else { chanId = 0; }
else {
chanId = 0;
}
}
else {
chanId = 0;
}
else { chanId = 0; }
config.release();
}
@ -361,8 +367,7 @@ private:
// Setup device parameters
bladerf_set_sample_rate(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->sampleRate, NULL);
bladerf_set_frequency(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->freq);
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ?
std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ? std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
bladerf_set_gain_mode(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), _this->gainModes[_this->gainMode].mode);
if (_this->selectedBladeType == BLADERF_TYPE_V2) {
@ -472,8 +477,7 @@ private:
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo(CONCAT("##_balderf_bw_sel_", _this->name), &_this->bwId, _this->bandwidthsTxt.c_str())) {
if (_this->running) {
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ?
std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
bladerf_set_bandwidth(_this->openDev, BLADERF_CHANNEL_RX(_this->chanId), (_this->bwId == _this->bandwidths.size()) ? std::clamp<uint64_t>(_this->sampleRate, _this->bwRange->min, _this->bwRange->max) : _this->bandwidths[_this->bwId], NULL);
}
if (_this->selectedSerial != "") {
config.acquire();
@ -500,7 +504,9 @@ private:
}
}
if (_this->selectedSerial != "") { if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::beginDisabled(); } }
if (_this->selectedSerial != "") {
if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::beginDisabled(); }
}
ImGui::LeftLabel("Gain");
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderInt("##_balderf_oag_sel_", &_this->overallGain, (_this->gainRange != NULL) ? _this->gainRange->min : 0, (_this->gainRange != NULL) ? _this->gainRange->max : 60)) {
@ -514,7 +520,9 @@ private:
config.release(true);
}
}
if (_this->selectedSerial != "") { if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::endDisabled(); } }
if (_this->selectedSerial != "") {
if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::endDisabled(); }
}
if (_this->selectedBladeType == BLADERF_TYPE_V2) {
if (ImGui::Checkbox("Bias-T##_balderf_biast_", &_this->biasT)) {
@ -526,7 +534,6 @@ private:
config.release(true);
}
}
}
void worker() {

View File

@ -134,9 +134,13 @@ public:
if (config.conf["devices"][selectedDevName].contains("channel")) {
chanId = config.conf["devices"][selectedDevName]["channel"];
}
else { chanId = 0; }
else {
chanId = 0;
}
}
else {
chanId = 0;
}
else { chanId = 0; }
config.release();
chanId = std::clamp<int>(chanId, 0, channelCount - 1);

View File

@ -155,7 +155,6 @@ private:
if (_this->running) { style::endDisabled(); }
if (connected) {
// TODO: Options here

View File

@ -86,7 +86,6 @@ namespace rfspace {
bool waiting;
std::mutex waitingmtx;
};
class RFspaceClientClass {

View File

@ -308,7 +308,6 @@ private:
if (i > 1) {
spdlog::warn("RTL-SDR took {0} attempts to tune...", i);
}
}
_this->freq = freq;
spdlog::info("RTLSDRSourceModule '{0}': Tune: {1}!", _this->name, freq);

View File

@ -30,7 +30,6 @@ struct command_t{
class RTLTCPClient {
public:
RTLTCPClient() {
}
bool connectToRTL(char* host, uint16_t port) {
@ -198,5 +197,4 @@ private:
#endif
bool connected = false;
};

View File

@ -202,7 +202,6 @@ private:
if (_this->running) { style::endDisabled(); }
// All other controls
}
std::string name;

View File

@ -211,22 +211,34 @@ public:
std::string name = "";
switch (devArr[i].hwVer) {
case SDRPLAY_RSP1_ID:
name = "RSP1 ("; name += devArr[i].SerNo; name += ')';
name = "RSP1 (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSP1A_ID:
name = "RSP1A ("; name += devArr[i].SerNo; name += ')';
name = "RSP1A (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSP2_ID:
name = "RSP2 ("; name += devArr[i].SerNo; name += ')';
name = "RSP2 (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSPduo_ID:
name = "RSPduo ("; name += devArr[i].SerNo; name += ')';
name = "RSPduo (";
name += devArr[i].SerNo;
name += ')';
break;
case SDRPLAY_RSPdx_ID:
name = "RSPdx ("; name += devArr[i].SerNo; name += ')';
name = "RSPdx (";
name += devArr[i].SerNo;
name += ')';
break;
default:
name = "Unknown ("; name += devArr[i].SerNo; name += ')';
name = "Unknown (";
name += devArr[i].SerNo;
name += ')';
break;
}
devNameList.push_back(name);
@ -500,7 +512,6 @@ public:
channelParams->tunerParams.gain.gRdB = gain;
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
sdrplay_api_Update(openDev.dev, openDev.tuner, sdrplay_api_Update_Tuner_Gr, sdrplay_api_Update_Ext1_None);
}
void rspDuoSelectAntennaPort(int port) {
@ -624,7 +635,8 @@ private:
_this->bandwidth = (_this->bandwidthId == 8) ? preferedBandwidth[_this->srId] : bandwidths[_this->bandwidthId];
_this->openDevParams->devParams->fsFreq.fsHz = _this->sampleRate;
_this->channelParams->tunerParams.bwType = _this->bandwidth;
} else {
}
else {
_this->openDevParams->devParams->fsFreq.fsHz = ifModes[_this->ifModeId].deviceSamplerate;
_this->channelParams->tunerParams.bwType = ifModes[_this->ifModeId].bw;
}
@ -744,7 +756,8 @@ private:
if (_this->ifModeId != 0) {
_this->bandwidth = ifModes[_this->ifModeId].bw;
_this->sampleRate = ifModes[_this->ifModeId].effectiveSamplerate;
} else {
}
else {
config.acquire();
_this->sampleRate = config.conf["devices"][_this->selectedName]["sampleRate"];
_this->bandwidthId = config.conf["devices"][_this->selectedName]["bwMode"];

View File

@ -98,7 +98,8 @@ private:
for (auto bw : bwListReversed) {
if (bw >= samplerate) {
cur = bw;
} else {
}
else {
break;
}
}
@ -182,9 +183,11 @@ private:
bandwidthList.push_back(bw);
if (bw > 1.0e3 && bw <= 1.0e6) {
txtBwList += to_string_with_precision((bw / 1.0e3), 2) + " kHz";
} else if (bw > 1.0e6) {
}
else if (bw > 1.0e6) {
txtBwList += to_string_with_precision((bw / 1.0e6), 2) + " MHz";
} else {
}
else {
txtBwList += to_string_with_precision(bw, 0);
}
txtBwList += '\0';
@ -195,9 +198,11 @@ private:
for (double sr : sampleRates) {
if (sr > 1.0e3 && sr <= 1.0e6) {
txtSrList += to_string_with_precision((sr / 1.0e3), 2) + " kHz";
} else if (sr > 1.0e6) {
}
else if (sr > 1.0e6) {
txtSrList += to_string_with_precision((sr / 1.0e6), 2) + " MHz";
} else {
}
else {
txtSrList += to_string_with_precision(sr, 0);
}
txtSrList += '\0';
@ -211,7 +216,8 @@ private:
if (config.conf["devices"].contains(name)) {
if (config.conf["devices"][name].contains("antenna")) {
uiAntennaId = config.conf["devices"][name]["antenna"];
} else {
}
else {
uiAntennaId = 0;
}
int i = 0;
@ -226,7 +232,8 @@ private:
}
if (config.conf["devices"][name].contains("bandwidth")) {
uiBandwidthId = config.conf["devices"][name]["bandwidth"];
} else if(bandwidthList.size() > 2) {
}
else if (bandwidthList.size() > 2) {
uiBandwidthId = 0;
}
if (hasAgc && config.conf["devices"][name].contains("agc")) {
@ -257,7 +264,6 @@ private:
selectSampleRate(sampleRates[0]); // Select default
}
config.release();
}
void saveCurrent() {
@ -442,7 +448,8 @@ private:
bool res;
if (step == 0.0f) {
res = ImGui::SliderFloat((std::string("##_gain_sel_") + _this->name + gain).c_str(), &_this->uiGains[i], _this->gainRanges[i].minimum(), _this->gainRanges[i].maximum());
} else {
}
else {
res = ImGui::SliderFloatWithSteps((std::string("##_gain_sel_") + _this->name + gain).c_str(), &_this->uiGains[i], _this->gainRanges[i].minimum(), _this->gainRanges[i].maximum(), step);
}
if (res) {

View File

@ -228,7 +228,6 @@ private:
if (_this->running) { style::endDisabled(); }
if (connected) {
if (_this->running) { style::beginDisabled(); }
ImGui::LeftLabel("Samplerate");

View File

@ -44,7 +44,6 @@ namespace spyserver {
SpyServerMessageHeader receivedHeader;
dsp::stream<dsp::complex_t>* output;
};
typedef std::unique_ptr<SpyServerClientClass> SpyServerClient;