mirror of
				https://github.com/AlexandreRouma/SDRPlusPlus.git
				synced 2025-11-04 02:39:11 +01:00 
			
		
		
		
	new modole system
This commit is contained in:
		@@ -1,65 +1,19 @@
 | 
			
		||||
cmake_minimum_required(VERSION 3.9)
 | 
			
		||||
project(sdrpp)
 | 
			
		||||
cmake_minimum_required(VERSION 3.13)
 | 
			
		||||
project(sdrpp_core)
 | 
			
		||||
 | 
			
		||||
add_subdirectory("modules/radio")
 | 
			
		||||
add_subdirectory("modules/recorder")
 | 
			
		||||
add_subdirectory("core")
 | 
			
		||||
add_subdirectory("radio")
 | 
			
		||||
add_subdirectory("recorder")
 | 
			
		||||
add_subdirectory("demo")
 | 
			
		||||
 | 
			
		||||
add_executable(sdrpp "src/main.cpp" "win32/resources.rc")
 | 
			
		||||
target_link_libraries(sdrpp PRIVATE sdrpp_core)
 | 
			
		||||
 | 
			
		||||
# Copy dynamic libs over
 | 
			
		||||
if (MSVC)
 | 
			
		||||
    set(CMAKE_CXX_FLAGS "-O2 /std:c++17")
 | 
			
		||||
    link_directories(sdrpp "C:/Program Files/PothosSDR/lib/")
 | 
			
		||||
    include_directories(sdrpp "C:/Program Files/PothosSDR/include/volk/")
 | 
			
		||||
    include_directories(sdrpp "C:/Program Files/PothosSDR/include/")
 | 
			
		||||
    set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
 | 
			
		||||
    add_custom_target(do_always ALL xcopy /s \"$<TARGET_FILE_DIR:sdrpp_core>\\*.dll\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y)
 | 
			
		||||
else()
 | 
			
		||||
    set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive -fsanitize=address -g")
 | 
			
		||||
    # set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive")
 | 
			
		||||
    include_directories(sdrpp "/usr/include/volk")
 | 
			
		||||
    link_libraries(pthread)
 | 
			
		||||
    link_libraries(GL)
 | 
			
		||||
    link_libraries(GLEW)
 | 
			
		||||
    link_libraries(glfw)
 | 
			
		||||
    link_libraries(fftw3)
 | 
			
		||||
    link_libraries(fftw3f)
 | 
			
		||||
    link_libraries(portaudio)
 | 
			
		||||
    link_libraries(X11)
 | 
			
		||||
    link_libraries(Xxf86vm)
 | 
			
		||||
    link_libraries(dl)
 | 
			
		||||
endif (MSVC)
 | 
			
		||||
 | 
			
		||||
link_libraries(volk)
 | 
			
		||||
link_libraries(SoapySDR)
 | 
			
		||||
 | 
			
		||||
# Main code
 | 
			
		||||
include_directories(sdrpp "src/")
 | 
			
		||||
include_directories(sdrpp "src/imgui")
 | 
			
		||||
file(GLOB SRC "src/*.cpp")
 | 
			
		||||
file(GLOB IMGUI "src/imgui/*.cpp")
 | 
			
		||||
 | 
			
		||||
# If on windows, set the executable icon
 | 
			
		||||
if (MSVC)
 | 
			
		||||
    set(SRC ${SRC} "win32/resources.rc")
 | 
			
		||||
endif (MSVC)
 | 
			
		||||
 | 
			
		||||
add_executable(sdrpp ${SRC} ${IMGUI})
 | 
			
		||||
 | 
			
		||||
if (MSVC)
 | 
			
		||||
    # Glew
 | 
			
		||||
    find_package(GLEW REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp PRIVATE GLEW::GLEW)
 | 
			
		||||
 | 
			
		||||
    # GLFW3
 | 
			
		||||
    find_package(glfw3 CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp PRIVATE glfw)
 | 
			
		||||
 | 
			
		||||
    # FFTW3
 | 
			
		||||
    find_package(FFTW3 CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp PRIVATE FFTW3::fftw3)
 | 
			
		||||
    find_package(FFTW3f CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp PRIVATE FFTW3::fftw3f)
 | 
			
		||||
 | 
			
		||||
    # PortAudio
 | 
			
		||||
    find_package(portaudio CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp PRIVATE portaudio portaudio_static)
 | 
			
		||||
    add_custom_target(do_always ALL cp \"$<TARGET_FILE_DIR:sdrpp_core>/sdrpp_core.so\" \"$<TARGET_FILE_DIR:sdrpp>\")
 | 
			
		||||
endif (MSVC)
 | 
			
		||||
 | 
			
		||||
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
 | 
			
		||||
							
								
								
									
										74
									
								
								core/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								core/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
cmake_minimum_required(VERSION 3.13)
 | 
			
		||||
project(sdrpp_core)
 | 
			
		||||
 | 
			
		||||
# Set compiler options
 | 
			
		||||
if (MSVC)
 | 
			
		||||
    set(CMAKE_CXX_FLAGS "-O2 /std:c++17")
 | 
			
		||||
    set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
 | 
			
		||||
else()
 | 
			
		||||
    set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive -fsanitize=address -g")
 | 
			
		||||
    # set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive")
 | 
			
		||||
endif (MSVC)
 | 
			
		||||
 | 
			
		||||
# Main code
 | 
			
		||||
file(GLOB SRC "src/*.cpp")
 | 
			
		||||
file(GLOB IMGUI "src/imgui/*.cpp")
 | 
			
		||||
 | 
			
		||||
# Add code to dyn lib
 | 
			
		||||
add_library(sdrpp_core SHARED ${SRC} ${IMGUI})
 | 
			
		||||
 | 
			
		||||
# Include core headers
 | 
			
		||||
target_include_directories(sdrpp_core PUBLIC "src/")
 | 
			
		||||
target_include_directories(sdrpp_core PUBLIC "src/imgui")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if (MSVC)
 | 
			
		||||
    # Lib path
 | 
			
		||||
    target_link_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/lib/")
 | 
			
		||||
 | 
			
		||||
    # Misc headers
 | 
			
		||||
    target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/")
 | 
			
		||||
 | 
			
		||||
    # Volk
 | 
			
		||||
    target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/volk/")
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC volk)
 | 
			
		||||
    
 | 
			
		||||
    # SoapySDR
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC SoapySDR)
 | 
			
		||||
 | 
			
		||||
    # Glew
 | 
			
		||||
    find_package(GLEW REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC GLEW::GLEW)
 | 
			
		||||
 | 
			
		||||
    # GLFW3
 | 
			
		||||
    find_package(glfw3 CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC glfw)
 | 
			
		||||
 | 
			
		||||
    # FFTW3
 | 
			
		||||
    find_package(FFTW3 CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3)
 | 
			
		||||
    find_package(FFTW3f CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC FFTW3::fftw3f)
 | 
			
		||||
 | 
			
		||||
    # PortAudio
 | 
			
		||||
    find_package(portaudio CONFIG REQUIRED)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC portaudio portaudio_static)
 | 
			
		||||
 | 
			
		||||
else()
 | 
			
		||||
    target_include_directories(sdrpp_core PUBLIC "/usr/include/volk")
 | 
			
		||||
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC pthread)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC GL)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC GLEW)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC glfw)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC fftw3)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC fftw3f)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC portaudio)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC X11)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC Xxf86vm)
 | 
			
		||||
    target_link_libraries(sdrpp_core PUBLIC dl)
 | 
			
		||||
endif (MSVC)
 | 
			
		||||
 | 
			
		||||
set(CORE_FILES ${RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE)
 | 
			
		||||
 | 
			
		||||
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
 | 
			
		||||
							
								
								
									
										250
									
								
								core/src/core.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										250
									
								
								core/src/core.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,250 @@
 | 
			
		||||
#include "imgui.h"
 | 
			
		||||
#include "imgui_impl_glfw.h"
 | 
			
		||||
#include "imgui_impl_opengl3.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <GL/glew.h>
 | 
			
		||||
#include <GLFW/glfw3.h>
 | 
			
		||||
#include <main_window.h>
 | 
			
		||||
#include <style.h>
 | 
			
		||||
#include <icons.h>
 | 
			
		||||
#include <version.h>
 | 
			
		||||
#include <spdlog/spdlog.h>
 | 
			
		||||
#include <bandplan.h>
 | 
			
		||||
#include <module.h>
 | 
			
		||||
#include <stb_image.h>
 | 
			
		||||
#include <config.h>
 | 
			
		||||
 | 
			
		||||
#include <dsp/block.h>
 | 
			
		||||
 | 
			
		||||
#define STB_IMAGE_RESIZE_IMPLEMENTATION
 | 
			
		||||
#include <stb_image_resize.h>
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include <Windows.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Comment to build a normal release
 | 
			
		||||
#define DEV_BUILD
 | 
			
		||||
 | 
			
		||||
bool maximized = false;
 | 
			
		||||
bool fullScreen = false;
 | 
			
		||||
 | 
			
		||||
static void glfw_error_callback(int error, const char* description) {
 | 
			
		||||
    spdlog::error("Glfw Error {0}: {1}", error, description);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void maximized_callback(GLFWwindow* window, int n) {
 | 
			
		||||
    if (n == GLFW_TRUE) {
 | 
			
		||||
        maximized = true;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        maximized = false;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// main
 | 
			
		||||
int sdrpp_main() {
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
    //FreeConsole();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    spdlog::info("SDR++ v" VERSION_STR);
 | 
			
		||||
 | 
			
		||||
#ifdef DEV_BUILD
 | 
			
		||||
    config::setRootDirectory("../root_dev");
 | 
			
		||||
#elif _WIN32
 | 
			
		||||
    config::setRootDirectory(".");
 | 
			
		||||
#else
 | 
			
		||||
    config::setRootDirectory("/etc/sdrpp");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // Load config
 | 
			
		||||
    spdlog::info("Loading config");
 | 
			
		||||
    config::load(config::getRootDirectory() + "/config.json");
 | 
			
		||||
    config::startAutoSave();
 | 
			
		||||
 | 
			
		||||
    // Setup window
 | 
			
		||||
    glfwSetErrorCallback(glfw_error_callback);
 | 
			
		||||
    if (!glfwInit()) {
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
 | 
			
		||||
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
 | 
			
		||||
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);  // 3.2+ only
 | 
			
		||||
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);            // Required on Mac
 | 
			
		||||
    
 | 
			
		||||
    int winWidth = config::config["windowSize"]["w"];
 | 
			
		||||
    int winHeight = config::config["windowSize"]["h"];
 | 
			
		||||
    maximized = config::config["maximized"];
 | 
			
		||||
 | 
			
		||||
    // Create window with graphics context
 | 
			
		||||
    GLFWmonitor* monitor = glfwGetPrimaryMonitor();
 | 
			
		||||
    GLFWwindow* window = glfwCreateWindow(winWidth, winHeight, "SDR++ v" VERSION_STR " (Built at " __TIME__ ", " __DATE__ ")", NULL, NULL);
 | 
			
		||||
    if (window == NULL)
 | 
			
		||||
        return 1;
 | 
			
		||||
    glfwMakeContextCurrent(window);
 | 
			
		||||
    glfwSwapInterval(1); // Enable vsync
 | 
			
		||||
 | 
			
		||||
    if (maximized) {
 | 
			
		||||
        glfwMaximizeWindow(window);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    glfwSetWindowMaximizeCallback(window, maximized_callback);
 | 
			
		||||
 | 
			
		||||
    // Load app icon
 | 
			
		||||
    GLFWimage icons[10];
 | 
			
		||||
    icons[0].pixels = stbi_load((config::getRootDirectory() + "/res/icons/sdrpp.png").c_str(), &icons[0].width, &icons[0].height, 0, 4);
 | 
			
		||||
    icons[1].pixels = (unsigned char*)malloc(16 * 16 * 4); icons[1].width = icons[1].height = 16;
 | 
			
		||||
    icons[2].pixels = (unsigned char*)malloc(24 * 24 * 4); icons[2].width = icons[2].height = 24;
 | 
			
		||||
    icons[3].pixels = (unsigned char*)malloc(32 * 32 * 4); icons[3].width = icons[3].height = 32;
 | 
			
		||||
    icons[4].pixels = (unsigned char*)malloc(48 * 48 * 4); icons[4].width = icons[4].height = 48;
 | 
			
		||||
    icons[5].pixels = (unsigned char*)malloc(64 * 64 * 4); icons[5].width = icons[5].height = 64;
 | 
			
		||||
    icons[6].pixels = (unsigned char*)malloc(96 * 96 * 4); icons[6].width = icons[6].height = 96;
 | 
			
		||||
    icons[7].pixels = (unsigned char*)malloc(128 * 128 * 4); icons[7].width = icons[7].height = 128;
 | 
			
		||||
    icons[8].pixels = (unsigned char*)malloc(196 * 196 * 4); icons[8].width = icons[8].height = 196;
 | 
			
		||||
    icons[9].pixels = (unsigned char*)malloc(256 * 256 * 4); icons[9].width = icons[9].height = 256;
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[1].pixels, 16, 16, 16 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[2].pixels, 24, 24, 24 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[3].pixels, 32, 32, 32 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[4].pixels, 48, 48, 48 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[5].pixels, 64, 64, 64 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[6].pixels, 96, 96, 96 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[7].pixels, 128, 128, 128 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[8].pixels, 196, 196, 196 * 4, 4);
 | 
			
		||||
    stbir_resize_uint8(icons[0].pixels, icons[0].width, icons[0].height, icons[0].width * 4, icons[9].pixels, 256, 256, 256 * 4, 4);
 | 
			
		||||
    glfwSetWindowIcon(window, 10, icons);
 | 
			
		||||
    stbi_image_free(icons[0].pixels);
 | 
			
		||||
    for (int i = 1; i < 10; i++) {
 | 
			
		||||
        free(icons[i].pixels);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (glewInit() != GLEW_OK) {
 | 
			
		||||
        spdlog::error("Failed to initialize OpenGL loader!");
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // Setup Dear ImGui context
 | 
			
		||||
    IMGUI_CHECKVERSION();
 | 
			
		||||
    ImGui::CreateContext();
 | 
			
		||||
    ImGuiIO& io = ImGui::GetIO(); (void)io;
 | 
			
		||||
    io.IniFilename = NULL;
 | 
			
		||||
 | 
			
		||||
    // Setup Platform/Renderer bindings
 | 
			
		||||
    ImGui_ImplGlfw_InitForOpenGL(window, true);
 | 
			
		||||
    ImGui_ImplOpenGL3_Init("#version 150");
 | 
			
		||||
 | 
			
		||||
    style::setDarkStyle();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // ====================================================
 | 
			
		||||
    // glfwPollEvents();
 | 
			
		||||
    ImGui_ImplOpenGL3_NewFrame();
 | 
			
		||||
    // ImGui_ImplGlfw_NewFrame();
 | 
			
		||||
    // ImGui::NewFrame();
 | 
			
		||||
 | 
			
		||||
    // ImGui::ShowDemoWindow();
 | 
			
		||||
 | 
			
		||||
    // ImGui::Render();
 | 
			
		||||
    int display_w, display_h;
 | 
			
		||||
    glfwGetFramebufferSize(window, &display_w, &display_h);
 | 
			
		||||
    glViewport(0, 0, display_w, display_h);
 | 
			
		||||
    glClearColor(0.0666f, 0.0666f, 0.0666f, 1.0f);
 | 
			
		||||
    //glClearColor(0.9f, 0.9f, 0.9f, 1.0f);
 | 
			
		||||
    glClear(GL_COLOR_BUFFER_BIT);
 | 
			
		||||
    // ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
 | 
			
		||||
 | 
			
		||||
    glfwSwapBuffers(window);
 | 
			
		||||
    // ====================================================
 | 
			
		||||
 | 
			
		||||
    spdlog::info("Loading icons");
 | 
			
		||||
    icons::load();
 | 
			
		||||
 | 
			
		||||
    spdlog::info("Loading band plans");
 | 
			
		||||
    bandplan::loadFromDir(config::getRootDirectory() + "/bandplans");
 | 
			
		||||
 | 
			
		||||
    spdlog::info("Loading band plans color table");
 | 
			
		||||
    bandplan::loadColorTable(config::getRootDirectory() + "/band_colors.json");
 | 
			
		||||
 | 
			
		||||
    windowInit();
 | 
			
		||||
 | 
			
		||||
    spdlog::info("Ready.");
 | 
			
		||||
 | 
			
		||||
    bool _maximized = maximized;
 | 
			
		||||
    int fsWidth, fsHeight, fsPosX, fsPosY;
 | 
			
		||||
 | 
			
		||||
    // Main loop
 | 
			
		||||
    while (!glfwWindowShouldClose(window)) {
 | 
			
		||||
        glfwPollEvents();
 | 
			
		||||
 | 
			
		||||
        // Start the Dear ImGui frame
 | 
			
		||||
        ImGui_ImplOpenGL3_NewFrame();
 | 
			
		||||
        ImGui_ImplGlfw_NewFrame();
 | 
			
		||||
        ImGui::NewFrame();
 | 
			
		||||
 | 
			
		||||
        if (_maximized != maximized) {
 | 
			
		||||
            _maximized = maximized;
 | 
			
		||||
            config::config["maximized"]= _maximized;
 | 
			
		||||
            config::configModified = true;
 | 
			
		||||
            if (!maximized) {
 | 
			
		||||
                glfwSetWindowSize(window, config::config["windowSize"]["w"], config::config["windowSize"]["h"]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int _winWidth, _winHeight;
 | 
			
		||||
        glfwGetWindowSize(window, &_winWidth, &_winHeight);
 | 
			
		||||
 | 
			
		||||
        if (ImGui::IsKeyPressed(GLFW_KEY_F11)) {
 | 
			
		||||
            fullScreen = !fullScreen;
 | 
			
		||||
            if (fullScreen) {
 | 
			
		||||
                spdlog::info("Fullscreen: ON");
 | 
			
		||||
                fsWidth = _winWidth;
 | 
			
		||||
                fsHeight = _winHeight;
 | 
			
		||||
                glfwGetWindowPos(window, &fsPosX, &fsPosY);
 | 
			
		||||
                const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
 | 
			
		||||
                glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, 0);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                spdlog::info("Fullscreen: OFF");
 | 
			
		||||
                glfwSetWindowMonitor(window, nullptr,  fsPosX, fsPosY, fsWidth, fsHeight, 0);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ((_winWidth != winWidth || _winHeight != winHeight) && !maximized && _winWidth > 0 && _winHeight > 0) {
 | 
			
		||||
            winWidth = _winWidth;
 | 
			
		||||
            winHeight = _winHeight;
 | 
			
		||||
            config::config["windowSize"]["w"] = winWidth;
 | 
			
		||||
            config::config["windowSize"]["h"] = winHeight;
 | 
			
		||||
            config::configModified = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (winWidth > 0 && winHeight > 0) {
 | 
			
		||||
            ImGui::SetNextWindowPos(ImVec2(0, 0));
 | 
			
		||||
            ImGui::SetNextWindowSize(ImVec2(_winWidth, _winHeight));
 | 
			
		||||
            drawWindow();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Rendering
 | 
			
		||||
        ImGui::Render();
 | 
			
		||||
        int display_w, display_h;
 | 
			
		||||
        glfwGetFramebufferSize(window, &display_w, &display_h);
 | 
			
		||||
        glViewport(0, 0, display_w, display_h);
 | 
			
		||||
        glClearColor(0.0666f, 0.0666f, 0.0666f, 1.0f);
 | 
			
		||||
        //glClearColor(0.9f, 0.9f, 0.9f, 1.0f);
 | 
			
		||||
        glClear(GL_COLOR_BUFFER_BIT);
 | 
			
		||||
        ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
 | 
			
		||||
 | 
			
		||||
        glfwSwapBuffers(window);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Cleanup
 | 
			
		||||
    ImGui_ImplOpenGL3_Shutdown();
 | 
			
		||||
    ImGui_ImplGlfw_Shutdown();
 | 
			
		||||
    ImGui::DestroyContext();
 | 
			
		||||
 | 
			
		||||
    glfwDestroyWindow(window);
 | 
			
		||||
    glfwTerminate();
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								core/src/core.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								core/src/core.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
int sdrpp_main();
 | 
			
		||||
@@ -12,6 +12,7 @@ void FrequencySelect::init() {
 | 
			
		||||
    font = ImGui::GetIO().Fonts->AddFontFromFileTTF((config::getRootDirectory() + "/res/fonts/Roboto-Medium.ttf").c_str(), 42.0f);
 | 
			
		||||
    for (int i = 0; i < 12; i++) {
 | 
			
		||||
        digits[i] = 0;
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -10,8 +10,12 @@ namespace io {
 | 
			
		||||
    class SoapyWrapper {
 | 
			
		||||
    public:
 | 
			
		||||
        SoapyWrapper() {
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void init() {
 | 
			
		||||
            SoapySDR::registerLogHandler(_logHandler);
 | 
			
		||||
            SoapySDR::Device::make("");
 | 
			
		||||
            //SoapySDR::Device::make("");
 | 
			
		||||
            
 | 
			
		||||
            output.init(64000);
 | 
			
		||||
            currentGains = new float[1];
 | 
			
		||||
@@ -52,7 +56,6 @@ namespace io {
 | 
			
		||||
            if (running) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            devList = SoapySDR::Device::enumerate();
 | 
			
		||||
            txtDevList = "";
 | 
			
		||||
            devNameList.clear();
 | 
			
		||||
@@ -155,6 +155,9 @@ void saveAudioConfig(std::string name) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void windowInit() {
 | 
			
		||||
    spdlog::info("Initializing SoapySDR");
 | 
			
		||||
    soapy.init();
 | 
			
		||||
    
 | 
			
		||||
    fSel.init();
 | 
			
		||||
    
 | 
			
		||||
    fft_in = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * fftSize);
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user