mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-10 04:37:37 +01:00
Fixed OS EventHandler compilation issue
This commit is contained in:
parent
6e4f502454
commit
c6c15a446b
2
.github/workflows/build_all.yml
vendored
2
.github/workflows/build_all.yml
vendored
@ -73,7 +73,7 @@ jobs:
|
||||
|
||||
- name: Prepare CMake
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_AIRSPYHF_SOURCE=OFF -DOPT_BUILD_PLUTOSDR_SOURCE=OFF -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_AIRSPY_SOURCE=OFF
|
||||
run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_AIRSPYHF_SOURCE=OFF -DOPT_BUILD_PLUTOSDR_SOURCE=OFF -DOPT_BUILD_SOAPY_SOURCE=OFF
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
|
@ -30,6 +30,12 @@ else (MSVC)
|
||||
target_include_directories(airspyhf_source PUBLIC ${LIBAIRSPYHF_INCLUDE_DIRS})
|
||||
target_link_directories(airspyhf_source PUBLIC ${LIBAIRSPYHF_LIBRARY_DIRS})
|
||||
target_link_libraries(airspyhf_source PUBLIC ${LIBAIRSPYHF_LIBRARIES})
|
||||
|
||||
# Include it because for some reason pkgconfig doesn't look here?
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
target_include_directories(airspy_source PUBLIC "/usr/local/include")
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
# Install directives
|
||||
|
@ -24,7 +24,7 @@ if (MSVC)
|
||||
target_link_libraries(bladerf_source PUBLIC bladeRF)
|
||||
else (MSVC)
|
||||
# Not in pkg-config
|
||||
target_link_libraries(bladerf_source PUBLIC libbladeRF)
|
||||
target_link_libraries(bladerf_source PUBLIC bladeRF)
|
||||
endif ()
|
||||
|
||||
# Install directives
|
||||
|
@ -194,6 +194,7 @@ private:
|
||||
_this->bufferSize = _this->sampleRate / 200.0;
|
||||
_this->bufferSize /= 1024;
|
||||
_this->bufferSize *= 1024;
|
||||
if (_this->bufferSize < 1024) { _this->bufferSize = 1024; }
|
||||
|
||||
bladerf_sample_rate wantedSr = _this->sampleRate;
|
||||
bladerf_sample_rate actualSr;
|
||||
@ -255,13 +256,13 @@ private:
|
||||
if (_this->running) { style::beginDisabled(); }
|
||||
|
||||
ImGui::SetNextItemWidth(menuWidth);
|
||||
if (ImGui::Combo(CONCAT("##_airspyhf_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
||||
if (ImGui::Combo(CONCAT("##_balderf_dev_sel_", _this->name), &_this->devId, _this->devListTxt.c_str())) {
|
||||
// Select device
|
||||
core::setInputSampleRate(_this->sampleRate);
|
||||
// Save config
|
||||
}
|
||||
|
||||
if (ImGui::Combo(CONCAT("##_airspyhf_sr_sel_", _this->name), &_this->srId, sampleRatesTxt)) {
|
||||
if (ImGui::Combo(CONCAT("##_balderf_sr_sel_", _this->name), &_this->srId, sampleRatesTxt)) {
|
||||
_this->sampleRate = sampleRates[_this->srId];
|
||||
core::setInputSampleRate(_this->sampleRate);
|
||||
// Save config
|
||||
@ -269,7 +270,7 @@ private:
|
||||
|
||||
ImGui::SameLine();
|
||||
float refreshBtnWdith = menuWidth - ImGui::GetCursorPosX();
|
||||
if (ImGui::Button(CONCAT("Refresh##_airspyhf_refr_", _this->name), ImVec2(refreshBtnWdith, 0))) {
|
||||
if (ImGui::Button(CONCAT("Refresh##_balderf_refr_", _this->name), ImVec2(refreshBtnWdith, 0))) {
|
||||
_this->refresh();
|
||||
config.aquire();
|
||||
std::string devSerial = config.conf["device"];
|
||||
@ -281,7 +282,7 @@ private:
|
||||
if (_this->running) { style::endDisabled(); }
|
||||
|
||||
// General config BS
|
||||
if (ImGui::SliderInt("Test Gain", &_this->testGain, 0, 77)) {
|
||||
if (ImGui::SliderInt("Test Gain", &_this->testGain, (_this->gainRange != NULL) ? _this->gainRange->min : 0, (_this->gainRange != NULL) ? _this->gainRange->max : 60)) {
|
||||
if (_this->running) {
|
||||
spdlog::info("Setting gain to {0}", _this->testGain);
|
||||
bladerf_set_gain(_this->openDev, BLADERF_CHANNEL_RX(0), _this->testGain);
|
||||
@ -296,10 +297,7 @@ private:
|
||||
while (true) {
|
||||
int ret = bladerf_sync_rx(openDev, buffer, bufferSize, &meta, 3500);
|
||||
if (ret != 0) { printf("Error: %d\n", ret); break; }
|
||||
for (int i = 0; i < bufferSize; i++) {
|
||||
stream.writeBuf[i].re = (float)buffer[(i * 2)] / 32768.0f;
|
||||
stream.writeBuf[i].im = (float)buffer[(i * 2) + 1] / 32768.0f;
|
||||
}
|
||||
volk_16i_s32f_convert_32f((float*)stream.writeBuf, buffer, 32768.0f, bufferSize * 2);
|
||||
if (!stream.swap(bufferSize)) { break; }
|
||||
}
|
||||
delete[] buffer;
|
||||
@ -309,7 +307,6 @@ private:
|
||||
bladerf* openDev;
|
||||
bool enabled = true;
|
||||
dsp::stream<dsp::complex_t> stream;
|
||||
//dsp::Packer<dsp::complex_t> packer(&steam, 2048);
|
||||
double sampleRate;
|
||||
SourceManager::SourceHandler handler;
|
||||
bool running = false;
|
||||
@ -320,14 +317,14 @@ private:
|
||||
|
||||
int channelCount;
|
||||
|
||||
const bladerf_range* srRange;
|
||||
const bladerf_range* bwRange;
|
||||
const bladerf_range* gainRange;
|
||||
const bladerf_range* srRange = NULL;
|
||||
const bladerf_range* bwRange = NULL;
|
||||
const bladerf_range* gainRange = NULL;
|
||||
|
||||
int bufferSize;
|
||||
struct bladerf_stream* rxStream;
|
||||
|
||||
int testGain;
|
||||
int testGain = 0;
|
||||
|
||||
std::thread workerThread;
|
||||
|
||||
|
@ -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;
|
||||
};
|
@ -1,5 +1,4 @@
|
||||
#include <imgui.h>
|
||||
#include <watcher.h>
|
||||
#include <config.h>
|
||||
#include <core.h>
|
||||
#include <gui/style.h>
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <imgui.h>
|
||||
#include <watcher.h>
|
||||
#include <config.h>
|
||||
#include <core.h>
|
||||
#include <gui/style.h>
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <imgui.h>
|
||||
#include <watcher.h>
|
||||
#include <config.h>
|
||||
#include <core.h>
|
||||
#include <gui/style.h>
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <imgui.h>
|
||||
#include <module.h>
|
||||
#include <watcher.h>
|
||||
#include <wav.h>
|
||||
#include <dsp/types.h>
|
||||
#include <dsp/stream.h>
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <imgui.h>
|
||||
#include <watcher.h>
|
||||
#include <config.h>
|
||||
#include <core.h>
|
||||
#include <gui/style.h>
|
||||
|
Loading…
Reference in New Issue
Block a user