diff --git a/Makefile b/Makefile index 3e1981e..ed8fc38 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui SOURCES += $(IMGUI_DIR)/backends/imgui_impl_glfw.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) -CXXFLAGS = -std=c++11 -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends +CXXFLAGS = -std=c++14 -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends CXXFLAGS += -g -Wall -Wformat -O2 LIBS = diff --git a/main.cpp b/main.cpp index faaef22..d278e21 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,8 @@ #include +#include +#include +#include +#include #include @@ -6,6 +10,28 @@ #include #include +static std::atomic terminate_dsp; +static std::mutex waterfall_data_mutex; +static int waterfall_width = 1600; +static int waterfall_height = 700; +static unsigned int waterfall_data[1600*700]; + +static void dsp_thread() { + using namespace std::chrono_literals; + + int t = 0; + while(!terminate_dsp) { + t++; + { + std::lock_guard guard(waterfall_data_mutex); + for(int y=0;y guard(waterfall_data_mutex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, waterfall_width, waterfall_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, waterfall_data); + } ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplGlfw_NewFrame();