diff --git a/CMakeLists.txt b/CMakeLists.txt index 6375e75b..6e1aa4f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,21 @@ if (MSVC) include_directories(sdrpp "C:/Program Files/PothosSDR/include/volk/") include_directories(sdrpp "C:/Program Files/PothosSDR/include/") else() - set(CMAKE_CXX_FLAGS "-O3 -std=c++17") + set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fsanitize=address") + include_directories(sdrpp "/usr/include/volk") + link_libraries(pthread) + link_libraries(GL) + link_libraries(GLEW) + + # GLFW3 + link_libraries(glfw) + + # FFTW3 + link_libraries(fftw3) + link_libraries(fftw3f) + + # PortAudio + link_libraries(portaudio) endif (MSVC) link_libraries(volk) @@ -38,19 +52,6 @@ if (MSVC) # PortAudio find_package(portaudio CONFIG REQUIRED) target_link_libraries(sdrpp PRIVATE portaudio portaudio_static) -else() - # Glew - link_libraries(glew) - - # GLFW3 - link_libraries(glfw) - - # FFTW3 - link_libraries(fftw) - link_libraries(fftwf) - - # PortAudio - link_libraries(portaudio) endif (MSVC) diff --git a/src/dsp/stream.h b/src/dsp/stream.h index fb6d5670..93a546f6 100644 --- a/src/dsp/stream.h +++ b/src/dsp/stream.h @@ -2,6 +2,7 @@ #include #include #include +#include #define STREAM_BUF_SZ 1000000 diff --git a/src/waterfall.cpp b/src/waterfall.cpp index 87241bf2..3a243df1 100644 --- a/src/waterfall.cpp +++ b/src/waterfall.cpp @@ -388,6 +388,8 @@ namespace ImGui { for (int i = 0; i < WATERFALL_RESOLUTION; i++) { int lowerId = floorf(((float)i / (float)WATERFALL_RESOLUTION) * colorCount); int upperId = ceilf(((float)i / (float)WATERFALL_RESOLUTION) * colorCount); + lowerId = std::clamp(lowerId, 0, colorCount - 1); + upperId = std::clamp(upperId, 0, colorCount - 1); float ratio = (((float)i / (float)WATERFALL_RESOLUTION) * colorCount) - lowerId; float r = (colors[lowerId][0] * (1.0f - ratio)) + (colors[upperId][0] * (ratio)); float g = (colors[lowerId][1] * (1.0f - ratio)) + (colors[upperId][1] * (ratio));