Added new contributors + fixed waterfall bug

This commit is contained in:
Ryzerth 2021-01-11 03:19:09 +01:00
parent b79461e3ce
commit afd5699ff1
3 changed files with 27 additions and 13 deletions

View File

@ -8,9 +8,10 @@ namespace sdrpp_credits {
"Benjamin Kyd",
"Cropinghigh",
"Howard0su",
"Tobias Mädel",
"Martin Hauke",
"Raov",
"Szymon Zakrent"
"Szymon Zakrent",
"Tobias Mädel"
};
const char* libraries[] = {

View File

@ -537,12 +537,15 @@ namespace ImGui {
float* WaterFall::getFFTBuffer() {
if (rawFFTs == NULL) { return NULL; }
buf_mtx.lock();
if (waterfallVisible) {
currentFFTLine--;
fftLines++;
currentFFTLine = ((currentFFTLine + waterfallHeight) % waterfallHeight);
fftLines = std::min<float>(fftLines, waterfallHeight);
return &rawFFTs[currentFFTLine * rawFFTSize];
}
return rawFFTs;
}
void WaterFall::pushFFT() {
if (rawFFTs == NULL) { return; }
@ -550,9 +553,10 @@ namespace ImGui {
int drawDataSize = (viewBandwidth / wholeBandwidth) * rawFFTSize;
int drawDataStart = (((double)rawFFTSize / 2.0) * (offsetRatio + 1)) - (drawDataSize / 2);
doZoom(drawDataStart, drawDataSize, dataWidth, &rawFFTs[currentFFTLine * rawFFTSize], latestFFT);
if (waterfallVisible) {
doZoom(drawDataStart, drawDataSize, dataWidth, &rawFFTs[currentFFTLine * rawFFTSize], latestFFT);
memmove(&waterfallFb[dataWidth], waterfallFb, dataWidth * (waterfallHeight - 1) * sizeof(uint32_t));
float pixel;
float dataRange = waterfallMax - waterfallMin;
@ -563,6 +567,10 @@ namespace ImGui {
}
waterfallUpdate = true;
}
else {
doZoom(drawDataStart, drawDataSize, dataWidth, rawFFTs, latestFFT);
fftLines = 1;
}
buf_mtx.unlock();
}
@ -745,10 +753,12 @@ namespace ImGui {
std::lock_guard<std::mutex> lck(buf_mtx);
rawFFTSize = size;
if (rawFFTs != NULL) {
rawFFTs = (float*)realloc(rawFFTs, rawFFTSize * waterfallHeight * sizeof(float));
int wfSize = std::max<int>(1, waterfallHeight);
rawFFTs = (float*)realloc(rawFFTs, rawFFTSize * wfSize * sizeof(float));
}
else {
rawFFTs = (float*)malloc(rawFFTSize * waterfallHeight * sizeof(float));
int wfSize = std::max<int>(1, waterfallHeight);
rawFFTs = (float*)malloc(rawFFTSize * wfSize * sizeof(float));
}
memset(rawFFTs, 0, rawFFTSize * waterfallHeight * sizeof(float));
}
@ -866,15 +876,17 @@ namespace ImGui {
};
void WaterFall::showWaterfall() {
waterfallVisible = true;
buf_mtx.lock();
waterfallVisible = true;
onResize();
memset(rawFFTs, 0, waterfallHeight * rawFFTSize * sizeof(float));
updateWaterfallFb();
buf_mtx.unlock();
}
void WaterFall::hideWaterfall() {
waterfallVisible = false;
buf_mtx.lock();
waterfallVisible = false;
onResize();
buf_mtx.unlock();
}

View File

@ -226,9 +226,10 @@ I will soon publish a contributing.md listing the code style to use.
* [Benjamin Kyd](https://github.com/benkyd)
* [cropinghigh](https://github.com/cropinghigh)
* [Howard0su](https://github.com/howard0su)
* [Tobias Mädel](https://github.com/Manawyrm)
* [Martin Hauke](https://github.com/mnhauke)
* [Raov](https://twitter.com/raov_birbtog)
* [Szymon Zakrent](https://github.com/zakrent)
* [Tobias Mädel](https://github.com/Manawyrm)
## Libaries used