mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-02-03 13:24:46 +01:00
Fixed waterfall non-threadsafe behavior
This commit is contained in:
parent
1fcd783dd9
commit
d9dcfa4a88
@ -151,6 +151,7 @@ namespace ImGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
|
if (latestFFT != NULL && fftLines != 0) {
|
||||||
for (int i = 1; i < dataWidth; i++) {
|
for (int i = 1; i < dataWidth; i++) {
|
||||||
double aPos = widgetPos.y + fftHeight + 10 - ((latestFFT[i - 1] - fftMin) * scaleFactor);
|
double aPos = widgetPos.y + fftHeight + 10 - ((latestFFT[i - 1] - fftMin) * scaleFactor);
|
||||||
double bPos = widgetPos.y + fftHeight + 10 - ((latestFFT[i] - fftMin) * scaleFactor);
|
double bPos = widgetPos.y + fftHeight + 10 - ((latestFFT[i] - fftMin) * scaleFactor);
|
||||||
@ -161,6 +162,7 @@ namespace ImGui {
|
|||||||
window->DrawList->AddLine(ImVec2(widgetPos.x + 50 + i, roundf(bPos)),
|
window->DrawList->AddLine(ImVec2(widgetPos.x + 50 + i, roundf(bPos)),
|
||||||
ImVec2(widgetPos.x + 50 + i, widgetPos.y + fftHeight + 10), shadow, 1.0);
|
ImVec2(widgetPos.x + 50 + i, widgetPos.y + fftHeight + 10), shadow, 1.0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// X Axis
|
// X Axis
|
||||||
window->DrawList->AddLine(ImVec2(widgetPos.x + 50, widgetPos.y + fftHeight + 10),
|
window->DrawList->AddLine(ImVec2(widgetPos.x + 50, widgetPos.y + fftHeight + 10),
|
||||||
@ -407,10 +409,10 @@ namespace ImGui {
|
|||||||
fftHeight = widgetSize.y - 50;
|
fftHeight = widgetSize.y - 50;
|
||||||
}
|
}
|
||||||
dataWidth = widgetSize.x - 60.0;
|
dataWidth = widgetSize.x - 60.0;
|
||||||
delete[] latestFFT;
|
|
||||||
|
|
||||||
|
if (waterfallVisible) {
|
||||||
// Raw FFT resize
|
// Raw FFT resize
|
||||||
fftLines = std::min<int>(fftLines, waterfallHeight);
|
fftLines = std::min<int>(fftLines, waterfallHeight) - 1;
|
||||||
if (rawFFTs != NULL) {
|
if (rawFFTs != NULL) {
|
||||||
if (currentFFTLine != 0) {
|
if (currentFFTLine != 0) {
|
||||||
float* tempWF = new float[currentFFTLine * rawFFTSize];
|
float* tempWF = new float[currentFFTLine * rawFFTSize];
|
||||||
@ -427,8 +429,13 @@ namespace ImGui {
|
|||||||
rawFFTs = (float*)malloc(waterfallHeight * rawFFTSize * sizeof(float));
|
rawFFTs = (float*)malloc(waterfallHeight * rawFFTSize * sizeof(float));
|
||||||
}
|
}
|
||||||
// ==============
|
// ==============
|
||||||
|
}
|
||||||
|
|
||||||
|
if (latestFFT != NULL) {
|
||||||
|
delete[] latestFFT;
|
||||||
|
}
|
||||||
latestFFT = new float[dataWidth];
|
latestFFT = new float[dataWidth];
|
||||||
|
|
||||||
if (waterfallVisible) {
|
if (waterfallVisible) {
|
||||||
delete[] waterfallFb;
|
delete[] waterfallFb;
|
||||||
waterfallFb = new uint32_t[dataWidth * waterfallHeight];
|
waterfallFb = new uint32_t[dataWidth * waterfallHeight];
|
||||||
@ -839,18 +846,24 @@ namespace ImGui {
|
|||||||
|
|
||||||
void WaterFall::showWaterfall() {
|
void WaterFall::showWaterfall() {
|
||||||
waterfallVisible = true;
|
waterfallVisible = true;
|
||||||
|
buf_mtx.lock();
|
||||||
onResize();
|
onResize();
|
||||||
|
buf_mtx.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterFall::hideWaterfall() {
|
void WaterFall::hideWaterfall() {
|
||||||
waterfallVisible = false;
|
waterfallVisible = false;
|
||||||
|
buf_mtx.lock();
|
||||||
onResize();
|
onResize();
|
||||||
|
buf_mtx.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterFall::setFFTHeight(int height) {
|
void WaterFall::setFFTHeight(int height) {
|
||||||
FFTAreaHeight = height;
|
FFTAreaHeight = height;
|
||||||
newFFTAreaHeight = height;
|
newFFTAreaHeight = height;
|
||||||
|
buf_mtx.lock();
|
||||||
onResize();
|
onResize();
|
||||||
|
buf_mtx.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaterFall::getFFTHeight() {
|
int WaterFall::getFFTHeight() {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"bandPlanEnabled": true,
|
"bandPlanEnabled": true,
|
||||||
"centerTuning": false,
|
"centerTuning": false,
|
||||||
"fftHeight": 300,
|
"fftHeight": 300,
|
||||||
"frequency": 98712000,
|
"frequency": 100100000,
|
||||||
"max": 0.0,
|
"max": 0.0,
|
||||||
"maximized": true,
|
"maximized": true,
|
||||||
"menuOrder": [
|
"menuOrder": [
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"Display"
|
"Display"
|
||||||
],
|
],
|
||||||
"menuWidth": 300,
|
"menuWidth": 300,
|
||||||
"min": -55.147056579589844,
|
"min": -61.764705657958984,
|
||||||
"moduleInstances": {
|
"moduleInstances": {
|
||||||
"Audio Sink": "audio_sink",
|
"Audio Sink": "audio_sink",
|
||||||
"PlutoSDR Source": "plutosdr_source",
|
"PlutoSDR Source": "plutosdr_source",
|
||||||
@ -27,16 +27,16 @@
|
|||||||
"SoapySDR Source": "soapy_source"
|
"SoapySDR Source": "soapy_source"
|
||||||
},
|
},
|
||||||
"modules": [
|
"modules": [
|
||||||
"./radio/Release/radio.dll",
|
"./radio/RelWithDebInfo/radio.dll",
|
||||||
"./recorder/Release/recorder.dll",
|
"./recorder/RelWithDebInfo/recorder.dll",
|
||||||
"./soapy_source/Release/soapy_source.dll",
|
"./soapy_source/RelWithDebInfo/soapy_source.dll",
|
||||||
"./rtl_tcp_source/Release/rtl_tcp_source.dll",
|
"./rtl_tcp_source/RelWithDebInfo/rtl_tcp_source.dll",
|
||||||
"./audio_sink/Release/audio_sink.dll",
|
"./audio_sink/RelWithDebInfo/audio_sink.dll",
|
||||||
"./plutosdr_source/Release/plutosdr_source.dll"
|
"./plutosdr_source/RelWithDebInfo/plutosdr_source.dll"
|
||||||
],
|
],
|
||||||
"offset": 0.0,
|
"offset": 0.0,
|
||||||
"showWaterfall": true,
|
"showWaterfall": true,
|
||||||
"source": "SoapySDR",
|
"source": "PlutoSDR",
|
||||||
"streams": {
|
"streams": {
|
||||||
"Radio": {
|
"Radio": {
|
||||||
"muted": false,
|
"muted": false,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"device": "HackRF One #0 901868dc282c8f8b",
|
"device": "",
|
||||||
"devices": {
|
"devices": {
|
||||||
"": {
|
"": {
|
||||||
"agc": false,
|
"agc": true,
|
||||||
"gains": {
|
"gains": {
|
||||||
"PGA": 0.0
|
"PGA": 0.0
|
||||||
},
|
},
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"gains": {
|
"gains": {
|
||||||
"TUNER": 37.3390007019043
|
"TUNER": 37.3390007019043
|
||||||
},
|
},
|
||||||
"sampleRate": 2560000.0
|
"sampleRate": 250000.0
|
||||||
},
|
},
|
||||||
"HackRF One #0 901868dc282c8f8b": {
|
"HackRF One #0 901868dc282c8f8b": {
|
||||||
"gains": {
|
"gains": {
|
||||||
@ -35,7 +35,7 @@
|
|||||||
"LNA": 24.503000259399414,
|
"LNA": 24.503000259399414,
|
||||||
"VGA": 16.332000732421875
|
"VGA": 16.332000732421875
|
||||||
},
|
},
|
||||||
"sampleRate": 16000000.0
|
"sampleRate": 8000000.0
|
||||||
},
|
},
|
||||||
"Microphone (Realtek High Definition Audio)": {
|
"Microphone (Realtek High Definition Audio)": {
|
||||||
"sampleRate": 96000.0
|
"sampleRate": 96000.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user