From ab8ce4c53f67a159f64dd43d9658b3d7bf51a75d Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 20 Sep 2020 01:36:25 +0200 Subject: [PATCH] Fixed warnings on linux --- core/src/config.cpp | 2 +- core/src/gui/bandplan.cpp | 4 +- core/src/gui/icons.cpp | 10 ++-- core/src/gui/waterfall.cpp | 3 +- core/src/module.cpp | 2 +- core/src/signal_path/vfo_manager.cpp | 1 - recorder/CMakeLists.txt | 49 ++----------------- root_dev/config.json | 73 ++++++++++++++++------------ root_dev/module_list.json | 8 ++- 9 files changed, 59 insertions(+), 93 deletions(-) diff --git a/core/src/config.cpp b/core/src/config.cpp index 6c46dde4..6dccaa2b 100644 --- a/core/src/config.cpp +++ b/core/src/config.cpp @@ -32,7 +32,7 @@ namespace config { } _path = path; std::ifstream file(path.c_str()); - config << file; + file >> config; file.close(); } diff --git a/core/src/gui/bandplan.cpp b/core/src/gui/bandplan.cpp index a0e6de91..79bfc441 100644 --- a/core/src/gui/bandplan.cpp +++ b/core/src/gui/bandplan.cpp @@ -71,7 +71,7 @@ namespace bandplan { void loadBandPlan(std::string path) { std::ifstream file(path.c_str()); json data; - data << file; + file >> data; file.close(); BandPlan_t plan = data.get(); @@ -114,7 +114,7 @@ namespace bandplan { } std::ifstream file(path.c_str()); json data; - data << file; + file >> data; file.close(); colorTable = data.get>(); diff --git a/core/src/gui/icons.cpp b/core/src/gui/icons.cpp index 54c6f451..e12810e9 100644 --- a/core/src/gui/icons.cpp +++ b/core/src/gui/icons.cpp @@ -11,7 +11,7 @@ namespace icons { GLuint loadTexture(std::string path) { int w,h,n; - stbi_uc* data = stbi_load(path.c_str(), &w, &h, &n, NULL); + stbi_uc* data = stbi_load(path.c_str(), &w, &h, &n, 0); GLuint texId; glGenTextures(1, &texId); glBindTexture(GL_TEXTURE_2D, texId); @@ -24,9 +24,9 @@ namespace icons { } void load() { - LOGO = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/sdrpp.png"); - PLAY = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/play.png"); - STOP = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/stop.png"); - MENU = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/menu.png"); + LOGO = (ImTextureID)(uintptr_t)loadTexture(config::getRootDirectory() + "/res/icons/sdrpp.png"); + PLAY = (ImTextureID)(uintptr_t)loadTexture(config::getRootDirectory() + "/res/icons/play.png"); + STOP = (ImTextureID)(uintptr_t)loadTexture(config::getRootDirectory() + "/res/icons/stop.png"); + MENU = (ImTextureID)(uintptr_t)loadTexture(config::getRootDirectory() + "/res/icons/menu.png"); } } \ No newline at end of file diff --git a/core/src/gui/waterfall.cpp b/core/src/gui/waterfall.cpp index 6a17381c..ab2af77e 100644 --- a/core/src/gui/waterfall.cpp +++ b/core/src/gui/waterfall.cpp @@ -199,7 +199,7 @@ namespace ImGui { ImVec2 dragOrigin(mousePos.x - drag.x, mousePos.y - drag.y); bool mouseHovered, mouseHeld; - bool mouseClicked = ImGui::ButtonBehavior(ImRect(fftAreaMin, fftAreaMax), ImGuiID("WaterfallID"), &mouseHovered, &mouseHeld, + bool mouseClicked = ImGui::ButtonBehavior(ImRect(fftAreaMin, fftAreaMax), GetID("WaterfallID"), &mouseHovered, &mouseHeld, ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_PressedOnClick); bool draging = ImGui::IsMouseDragging(ImGuiMouseButton_Left) && ImGui::IsWindowFocused(); @@ -650,7 +650,6 @@ namespace ImGui { } void WaterfallVFO::setOffset(float offset) { - printf("WaterfallVFO::SetOffset: %p\n", this); generalOffset = offset; if (reference == REF_CENTER) { centerOffset = offset; diff --git a/core/src/module.cpp b/core/src/module.cpp index 4df08517..69f6c48a 100644 --- a/core/src/module.cpp +++ b/core/src/module.cpp @@ -116,7 +116,7 @@ namespace mod { } std::ifstream file(path.c_str()); json data; - data << file; + file >> data; file.close(); std::map list = data.get>(); diff --git a/core/src/signal_path/vfo_manager.cpp b/core/src/signal_path/vfo_manager.cpp index bf356996..b7397ad8 100644 --- a/core/src/signal_path/vfo_manager.cpp +++ b/core/src/signal_path/vfo_manager.cpp @@ -9,7 +9,6 @@ VFOManager::VFO::VFO(std::string name, int reference, float offset, float bandwi wtfVFO->setBandwidth(bandwidth); wtfVFO->setOffset(offset); output = dspVFO->output; - printf("Created VFO: %p", wtfVFO); gui::waterfall.vfos[name] = wtfVFO; } diff --git a/recorder/CMakeLists.txt b/recorder/CMakeLists.txt index a83a2eba..9d6af4f2 100644 --- a/recorder/CMakeLists.txt +++ b/recorder/CMakeLists.txt @@ -3,53 +3,14 @@ project(recorder) if (MSVC) set(CMAKE_CXX_FLAGS "-O2 /std:c++17") - link_directories(recorder "C:/Program Files/PothosSDR/lib/") - include_directories(recorder "C:/Program Files/PothosSDR/include/volk/") - include_directories(recorder "C:/Program Files/PothosSDR/include/") else() - set(CMAKE_CXX_FLAGS "-O3 -std=c++17") - include_directories(recorder "/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) + set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive") endif (MSVC) -link_libraries(volk) -link_libraries(SoapySDR) - -# Main code -include_directories(recorder "src/") -include_directories(recorder "../core/src/") -include_directories(recorder "../core/src/imgui") file(GLOB SRC "src/*.cpp") -file(GLOB IMGUI "../core/src/imgui/*.cpp") -add_library(recorder SHARED ${SRC} ${IMGUI}) -set_target_properties(recorder PROPERTIES PREFIX "") -if (MSVC) - # Glew - find_package(GLEW REQUIRED) - target_link_libraries(recorder PRIVATE GLEW::GLEW) +include_directories("src/") - # GLFW3 - find_package(glfw3 CONFIG REQUIRED) - target_link_libraries(recorder PRIVATE glfw) - - # FFTW3 - find_package(FFTW3 CONFIG REQUIRED) - target_link_libraries(recorder PRIVATE FFTW3::fftw3) - find_package(FFTW3f CONFIG REQUIRED) - target_link_libraries(recorder PRIVATE FFTW3::fftw3f) - - # PortAudio - find_package(portaudio CONFIG REQUIRED) - target_link_libraries(recorder PRIVATE portaudio portaudio_static) -endif (MSVC) - -# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64" \ No newline at end of file +add_library(recorder SHARED ${SRC}) +target_link_libraries(recorder PRIVATE sdrpp_core) +set_target_properties(recorder PROPERTIES PREFIX "") \ No newline at end of file diff --git a/root_dev/config.json b/root_dev/config.json index 95be2664..81d30f93 100644 --- a/root_dev/config.json +++ b/root_dev/config.json @@ -1,33 +1,42 @@ -{ - "audio": { - "Radio": { - "device": "Speakers (Realtek High Definiti", - "sampleRate": 48000.0, - "volume": 0.6666666865348816 - } - }, - "bandPlan": "General", - "bandPlanEnabled": true, - "fftHeight": 300, - "frequency": 103200000, - "max": 0.0, - "maximized": false, - "menuWidth": 300, - "min": -52.20588302612305, - "showWaterfall": true, - "source": "HackRF One #0 901868dc282c8f8b", - "sourceSettings": { - "HackRF One #0 901868dc282c8f8b": { - "gains": { - "AMP": 0.0, - "LNA": 24.503000259399414, - "VGA": 16.229999542236328 - }, - "sampleRate": 8000000 - } - }, - "windowSize": { - "h": 726, - "w": 1280 - } +{ + "audio": { + "Radio": { + "device": "Speakers (Realtek High Definiti", + "sampleRate": 48000.0, + "volume": 0.3655914068222046 + } + }, + "bandPlan": "General", + "bandPlanEnabled": true, + "fftHeight": 300, + "frequency": 96914040, + "max": 0.0, + "maximized": false, + "menuWidth": 300, + "min": -51.47058868408203, + "showWaterfall": true, + "source": "HackRF One #0 901868dc282c8f8b", + "sourceSettings": { + "Generic RTL2832U OEM :: 00000001": { + "gains": { + "TUNER": 0.0 + }, + "sampleRate": 2560000 + }, + "HackRF One #0 901868dc282c8f8b": { + "gains": { + "AMP": 0.0, + "LNA": 24.503000259399414, + "VGA": 16.229999542236328 + }, + "sampleRate": 8000000 + }, + "PulseAudio": { + "sampleRate": 96000 + } + }, + "windowSize": { + "h": 1053, + "w": 959 + } } \ No newline at end of file diff --git a/root_dev/module_list.json b/root_dev/module_list.json index 319321f3..15853c86 100644 --- a/root_dev/module_list.json +++ b/root_dev/module_list.json @@ -1,6 +1,4 @@ { - "Radio": "../build/radio/Release/radio.dll", - "Recorder": "../build/recorder/Release/recorder.dll", - "Demo": "../build/demo/Release/demo.dll", - "Demo 2": "../build/demo/Release/demo.dll" -} \ No newline at end of file + "Radio": "./radio/radio.so", + "Recorder": "./recorder/recorder.so" +}