mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 20:07:51 +02:00
Fixed OS EventHandler compilation issue
This commit is contained in:
@ -168,4 +168,43 @@ namespace dsp {
|
||||
stream<float>* _in;
|
||||
|
||||
};
|
||||
|
||||
class Int16CToComplex : public generic_block<Int16CToComplex> {
|
||||
public:
|
||||
Int16CToComplex() {}
|
||||
|
||||
Int16CToComplex(stream<int16_t>* in) { init(in); }
|
||||
|
||||
void init(stream<int16_t>* in) {
|
||||
_in = in;
|
||||
generic_block<Int16CToComplex>::registerInput(_in);
|
||||
generic_block<Int16CToComplex>::registerOutput(&out);
|
||||
}
|
||||
|
||||
void setInput(stream<int16_t>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<Int16CToComplex>::ctrlMtx);
|
||||
generic_block<Int16CToComplex>::tempStop();
|
||||
generic_block<Int16CToComplex>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<Int16CToComplex>::registerInput(_in);
|
||||
generic_block<Int16CToComplex>::tempStart();
|
||||
}
|
||||
|
||||
int run() {
|
||||
int count = _in->read();
|
||||
if (count < 0) { return -1; }
|
||||
|
||||
volk_16i_s32f_convert_32f((float*)out.writeBuf, _in->readBuf, 32768.0f, count * 2);
|
||||
|
||||
_in->flush();
|
||||
if (!out.swap(count)) { return -1; }
|
||||
return count;
|
||||
}
|
||||
|
||||
stream<complex_t> out;
|
||||
|
||||
private:
|
||||
stream<int16_t>* _in;
|
||||
|
||||
};
|
||||
}
|
@ -15,7 +15,6 @@
|
||||
#include <signal_path/dsp.h>
|
||||
#include <gui/icons.h>
|
||||
#include <gui/widgets/bandplan.h>
|
||||
#include <watcher.h>
|
||||
#include <signal_path/vfo_manager.h>
|
||||
#include <gui/style.h>
|
||||
#include <config.h>
|
||||
@ -84,14 +83,10 @@ void fftHandler(dsp::complex_t* samples, int count, void* ctx) {
|
||||
gui::waterfall.pushFFT();
|
||||
}
|
||||
|
||||
watcher<uint64_t> freq((uint64_t)90500000);
|
||||
watcher<double> vfoFreq(92000000.0);
|
||||
float fftMin = -70.0;
|
||||
float fftMax = 0.0;
|
||||
watcher<double> offset(0.0, true);
|
||||
float bw = 8000000;
|
||||
bool playing = false;
|
||||
watcher<bool> dcbias(false, false);
|
||||
bool showCredits = false;
|
||||
std::string audioStreamName = "";
|
||||
std::string sourceName = "";
|
||||
@ -598,9 +593,6 @@ void drawWindow() {
|
||||
ImGui::Text("Framerate: %.1f FPS", ImGui::GetIO().Framerate);
|
||||
ImGui::Text("Center Frequency: %.0f Hz", gui::waterfall.getCenterFrequency());
|
||||
ImGui::Text("Source name: %s", sourceName.c_str());
|
||||
if (ImGui::Checkbox("Test technique", &dcbias.val)) {
|
||||
//sigpath::signalPath.setDCBiasCorrection(dcbias.val);
|
||||
}
|
||||
ImGui::Checkbox("Show demo window", &demoWindow);
|
||||
ImGui::Checkbox("Experimental zoom", &experimentalZoom);
|
||||
ImGui::Text("ImGui version: %s", ImGui::GetVersion());
|
||||
|
@ -69,6 +69,18 @@ void FrequencySelect::decrementDigit(int i) {
|
||||
digits[i]--;
|
||||
}
|
||||
else {
|
||||
if (i == 0) { return; }
|
||||
|
||||
// Check if there are non zero digits afterwards
|
||||
bool otherNoneZero = false;
|
||||
for (int j = i - 1; j >= 0; j--) {
|
||||
if (digits[j] > 0) {
|
||||
otherNoneZero = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!otherNoneZero) { return; }
|
||||
|
||||
digits[i] = 9;
|
||||
decrementDigit(i - 1);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <volk/volk.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <utils/color.h>
|
||||
|
||||
float DEFAULT_COLOR_MAP[][3] = {
|
||||
{0x00, 0x00, 0x20},
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <dsp/processing.h>
|
||||
#include <dsp/sink.h>
|
||||
#include <mutex>
|
||||
#include <event.h>
|
||||
#include <utils/event.h>
|
||||
#include <vector>
|
||||
|
||||
class SinkManager {
|
||||
|
50
core/src/utils/color.h
Normal file
50
core/src/utils/color.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
namespace color {
|
||||
inline void RGBtoHSL(float r, float g, float b, float& h, float& s, float& l) {
|
||||
// Calculate minimum, maximum and delta of components
|
||||
float cmax = std::max<float>(std::max<float>(r, g), b);
|
||||
float cmin = std::min<float>(std::min<float>(r, g), b);
|
||||
float delta = cmax - cmin;
|
||||
|
||||
// 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); }
|
||||
|
||||
// Calculate lightness
|
||||
l = (cmin + cmax) / 2.0f;
|
||||
|
||||
// Calculate saturation
|
||||
s = (delta == 0) ? 0 : (delta / (1.0f - fabsf((2.0f * l) - 1.0f)));
|
||||
}
|
||||
|
||||
inline void HSLtoRGB(float h, float s, float l, float& r, float& g, float& b) {
|
||||
// Calculate coefficients
|
||||
float c = s * (1.0f - fabsf((2.0f * l) - 1.0f));
|
||||
float x = c * (1.0f - fabsf(fmodf(h / 60.0f, 2.0f) - 1.0f));
|
||||
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; }
|
||||
|
||||
// Add m
|
||||
r += m;
|
||||
g += m;
|
||||
b += m;
|
||||
}
|
||||
|
||||
inline void interpRGB(float ar, float ag, float ab, float br, float bg, float bb, float& or, float& og, float& ob, float ratio) {
|
||||
or = ar + (br - ar) * ratio;
|
||||
og = ag + (bg - ag) * ratio;
|
||||
ob = ab + (bb - ab) * ratio;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
template <class T>
|
||||
class watcher {
|
||||
public:
|
||||
watcher(bool changed = false) {
|
||||
_changed = changed;
|
||||
}
|
||||
|
||||
watcher(T value, bool changed = false) {
|
||||
val = value;
|
||||
_val = value;
|
||||
_changed = changed;
|
||||
}
|
||||
|
||||
bool changed(bool clear = true) {
|
||||
bool ch = ((val != _val) || _changed);
|
||||
if (clear) {
|
||||
_changed = false;
|
||||
_val = val;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
void markAsChanged() {
|
||||
_changed = true;
|
||||
}
|
||||
|
||||
T val;
|
||||
|
||||
private:
|
||||
bool _changed;
|
||||
T _val;
|
||||
};
|
Reference in New Issue
Block a user