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", "Benjamin Kyd",
"Cropinghigh", "Cropinghigh",
"Howard0su", "Howard0su",
"Tobias Mädel", "Martin Hauke",
"Raov", "Raov",
"Szymon Zakrent" "Szymon Zakrent",
"Tobias Mädel"
}; };
const char* libraries[] = { const char* libraries[] = {

View File

@ -537,11 +537,14 @@ namespace ImGui {
float* WaterFall::getFFTBuffer() { float* WaterFall::getFFTBuffer() {
if (rawFFTs == NULL) { return NULL; } if (rawFFTs == NULL) { return NULL; }
buf_mtx.lock(); buf_mtx.lock();
currentFFTLine--; if (waterfallVisible) {
fftLines++; currentFFTLine--;
currentFFTLine = ((currentFFTLine + waterfallHeight) % waterfallHeight); fftLines++;
fftLines = std::min<float>(fftLines, waterfallHeight); currentFFTLine = ((currentFFTLine + waterfallHeight) % waterfallHeight);
return &rawFFTs[currentFFTLine * rawFFTSize]; fftLines = std::min<float>(fftLines, waterfallHeight);
return &rawFFTs[currentFFTLine * rawFFTSize];
}
return rawFFTs;
} }
void WaterFall::pushFFT() { void WaterFall::pushFFT() {
@ -550,9 +553,10 @@ namespace ImGui {
int drawDataSize = (viewBandwidth / wholeBandwidth) * rawFFTSize; int drawDataSize = (viewBandwidth / wholeBandwidth) * rawFFTSize;
int drawDataStart = (((double)rawFFTSize / 2.0) * (offsetRatio + 1)) - (drawDataSize / 2); int drawDataStart = (((double)rawFFTSize / 2.0) * (offsetRatio + 1)) - (drawDataSize / 2);
doZoom(drawDataStart, drawDataSize, dataWidth, &rawFFTs[currentFFTLine * rawFFTSize], latestFFT);
if (waterfallVisible) { if (waterfallVisible) {
doZoom(drawDataStart, drawDataSize, dataWidth, &rawFFTs[currentFFTLine * rawFFTSize], latestFFT);
memmove(&waterfallFb[dataWidth], waterfallFb, dataWidth * (waterfallHeight - 1) * sizeof(uint32_t)); memmove(&waterfallFb[dataWidth], waterfallFb, dataWidth * (waterfallHeight - 1) * sizeof(uint32_t));
float pixel; float pixel;
float dataRange = waterfallMax - waterfallMin; float dataRange = waterfallMax - waterfallMin;
@ -563,6 +567,10 @@ namespace ImGui {
} }
waterfallUpdate = true; waterfallUpdate = true;
} }
else {
doZoom(drawDataStart, drawDataSize, dataWidth, rawFFTs, latestFFT);
fftLines = 1;
}
buf_mtx.unlock(); buf_mtx.unlock();
} }
@ -745,10 +753,12 @@ namespace ImGui {
std::lock_guard<std::mutex> lck(buf_mtx); std::lock_guard<std::mutex> lck(buf_mtx);
rawFFTSize = size; rawFFTSize = size;
if (rawFFTs != NULL) { 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 { 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)); memset(rawFFTs, 0, rawFFTSize * waterfallHeight * sizeof(float));
} }
@ -866,15 +876,17 @@ namespace ImGui {
}; };
void WaterFall::showWaterfall() { void WaterFall::showWaterfall() {
waterfallVisible = true;
buf_mtx.lock(); buf_mtx.lock();
waterfallVisible = true;
onResize(); onResize();
memset(rawFFTs, 0, waterfallHeight * rawFFTSize * sizeof(float));
updateWaterfallFb();
buf_mtx.unlock(); buf_mtx.unlock();
} }
void WaterFall::hideWaterfall() { void WaterFall::hideWaterfall() {
waterfallVisible = false;
buf_mtx.lock(); buf_mtx.lock();
waterfallVisible = false;
onResize(); onResize();
buf_mtx.unlock(); 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) * [Benjamin Kyd](https://github.com/benkyd)
* [cropinghigh](https://github.com/cropinghigh) * [cropinghigh](https://github.com/cropinghigh)
* [Howard0su](https://github.com/howard0su) * [Howard0su](https://github.com/howard0su)
* [Tobias Mädel](https://github.com/Manawyrm) * [Martin Hauke](https://github.com/mnhauke)
* [Raov](https://twitter.com/raov_birbtog) * [Raov](https://twitter.com/raov_birbtog)
* [Szymon Zakrent](https://github.com/zakrent) * [Szymon Zakrent](https://github.com/zakrent)
* [Tobias Mädel](https://github.com/Manawyrm)
## Libaries used ## Libaries used