Custom build flags, Power level offset, Persistent modem props

This commit is contained in:
Charles J. Cliffe 2016-10-20 21:44:33 -04:00
parent 239f3924a8
commit 979e5b709c
13 changed files with 307 additions and 78 deletions

View File

@ -7,18 +7,67 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
SET(CUBICSDR_VERSION_MAJOR "0") SET(CUBICSDR_VERSION_MAJOR "0")
SET(CUBICSDR_VERSION_MINOR "2") SET(CUBICSDR_VERSION_MINOR "2")
SET(CUBICSDR_VERSION_PATCH "0") SET(CUBICSDR_VERSION_PATCH "0")
SET(CUBICSDR_VERSION_REL "") SET(CUBICSDR_VERSION_SUFFIX "")
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}${CUBICSDR_VERSION_REL}") SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}${CUBICSDR_VERSION_SUFFIX}")
SET(CPACK_PACKAGE_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}") SET(CPACK_PACKAGE_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}")
SET(CPACK_PACKAGE_VERSION_MAJOR ${CUBICSDR_VERSION_MAJOR}) SET(CPACK_PACKAGE_VERSION_MAJOR ${CUBICSDR_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${CUBICSDR_VERSION_MINOR}) SET(CPACK_PACKAGE_VERSION_MINOR ${CUBICSDR_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${CUBICSDR_VERSION_PATCH}) SET(CPACK_PACKAGE_VERSION_PATCH ${CUBICSDR_VERSION_PATCH})
SET (VERSION_SUFFIX "" CACHE STRING "Add custom version suffix to CubicSDR application title.") SET (CUSTOM_BUILD OFF CACHE BOOL "Enable custom build options")
# Build options for custom deploys, optimization and debugging
IF(CUSTOM_BUILD)
SET (CUBICSDR_BUILD_TITLE CACHE STRING "Custom Title")
# bundle flags
SET (CUBICSDR_INSTALL_NAME CACHE "CubicSDR" "Installation Name")
SET (CUBICSDR_INSTALL_TITLE CACHE "CubicSDR" "Installation Title")
SET (CUBICSDR_HEADER_IMAGE CACHE "" "Image file to display in header")
SET (CUBICSDR_HEADER_BG CACHE "000000" "Background Color (HEX) for header")
# feature flags
SET (CUBICSDR_ENABLE_VIEW_DEMOD ON CACHE BOOL "Enable Second Demodulator Spectrum/Waterfall view.")
SET (CUBICSDR_ENABLE_VIEW_SCOPE ON CACHE BOOL "Enable Demodulator Scope/Spectrum view.")
SET (CUBICSDR_MODEM_EXCLUDE CACHE "" "Comma-separated list of modems to exclude.")
IF (NOT CUBICSDR_HEADER_IMAGE STREQUAL "")
SET(CUBICSDR_HAS_HEADER_IMAGE TRUE)
GET_FILENAME_COMPONENT(CUBICSDR_HEADER_IMAGE_FILE "${CUBICSDR_HEADER_IMAGE}" NAME)
GET_FILENAME_COMPONENT(CUBICSDR_HEADER_IMAGE_DIR "${CUBICSDR_HEADER_IMAGE}" PATH)
ADD_DEFINITIONS(
-DCUBICSDR_HEADER_IMAGE="${CUBICSDR_HEADER_IMAGE_FILE}"
-DCUBICSDR_HEADER_BG="${CUBICSDR_HEADER_BG}"
)
ENDIF()
IF (NOT CUBICSDR_MODEM_EXCLUDE STREQUAL "")
ADD_DEFINITIONS(
-DCUBICSDR_MODEM_EXCLUDE="${CUBICSDR_MODEM_EXCLUDE}"
)
ENDIF()
ELSE()
SET (CUBICSDR_BUILD_TITLE "CubicSDR v{$CUBICSDR_VERSION} by Charles J. Cliffe (@ccliffe) :: www.cubicsdr.com")
# bundle flags
SET (CUBICSDR_INSTALL_NAME "CubicSDR")
SET (CUBICSDR_INSTALL_TITLE "CubicSDR ${CUBICSDR_VERSION} Installer")
SET (CUBICSDR_HEADER_IMAGE "")
SET (CUBICSDR_HEADER_BG "")
# feature flags
SET (CUBICSDR_ENABLE_VIEW_DEMOD TRUE)
SET (CUBICSDR_ENABLE_VIEW_SCOPE TRUE)
SET (CUBICSDR_EXCLUDE_MODEM "")
ENDIF()
IF(CUBICSDR_ENABLE_VIEW_DEMOD)
ADD_DEFINITIONS( -DCUBICSDR_ENABLE_VIEW_DEMOD=1 )
ENDIF()
IF(CUBICSDR_ENABLE_VIEW_SCOPE)
ADD_DEFINITIONS( -DCUBICSDR_ENABLE_VIEW_SCOPE=1 )
ENDIF()
ADD_DEFINITIONS( ADD_DEFINITIONS(
-DCUBICSDR_VERSION="${CUBICSDR_VERSION}${VERSION_SUFFIX}" -DCUBICSDR_VERSION="${CUBICSDR_VERSION}"
-DCUBICSDR_BUILD_TITLE="${CUBICSDR_BUILD_TITLE}"
) )
SET (ENABLE_DIGITAL_LAB OFF CACHE BOOL "Enable 'Digital Lab' testing features.") SET (ENABLE_DIGITAL_LAB OFF CACHE BOOL "Enable 'Digital Lab' testing features.")
@ -561,6 +610,9 @@ IF (NOT BUNDLE_APP)
IF(MSVC) IF(MSVC)
configure_files(${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll") configure_files(${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll")
ENDIF() ENDIF()
IF (CUBICSDR_HAS_HEADER_IMAGE)
configure_files(${CUBICSDR_HEADER_IMAGE_DIR} ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} ${CUBICSDR_HEADER_IMAGE_FILE})
ENDIF()
add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers} ${RES_FILES}) add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers} ${RES_FILES})
target_link_libraries(CubicSDR ${LIQUID_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES}) target_link_libraries(CubicSDR ${LIQUID_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
ENDIF (NOT BUNDLE_APP) ENDIF (NOT BUNDLE_APP)
@ -639,7 +691,7 @@ IF (APPLE AND BUNDLE_APP)
MACOSX_BUNDLE_INFO_STRING "CubicSDR Open-Source Software-Defined Radio Application" MACOSX_BUNDLE_INFO_STRING "CubicSDR Open-Source Software-Defined Radio Application"
MACOSX_BUNDLE_BUNDLE_NAME "CubicSDR" MACOSX_BUNDLE_BUNDLE_NAME "CubicSDR"
MACOSX_BUNDLE_BUNDLE_VERSION "${CUBICSDR_VERSION}" MACOSX_BUNDLE_BUNDLE_VERSION "${CUBICSDR_VERSION}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}.${CUBICSDR_VERSION_REL}" MACOSX_BUNDLE_LONG_VERSION_STRING "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}${CUBICSDR_VERSION_SUFFIX}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}" MACOSX_BUNDLE_SHORT_VERSION_STRING "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.cubicproductions.cubicsdr" MACOSX_BUNDLE_GUI_IDENTIFIER "com.cubicproductions.cubicsdr"
MACOSX_BUNDLE_ICON_FILE "CubicSDR.icns" MACOSX_BUNDLE_ICON_FILE "CubicSDR.icns"
@ -734,6 +786,7 @@ IF (APPLE AND BUNDLE_APP)
include(CPack) include(CPack)
ENDIF() ENDIF()
IF(APPLE AND NOT BUNDLE_APP) IF(APPLE AND NOT BUNDLE_APP)
IF (NOT CMAKE_INSTALL_PREFIX) IF (NOT CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX "/usr/") SET(CMAKE_INSTALL_PREFIX "/usr/")
@ -790,16 +843,23 @@ IF (WIN32 AND NOT BUILD_INSTALLER)
INSTALL(FILES INSTALL(FILES
${CUBICSDR_FONTS} ${CUBICSDR_FONTS}
DESTINATION share/cubicsdr/fonts) DESTINATION share/cubicsdr/fonts)
IF (CUBICSDR_HAS_HEADER_IMAGE)
INSTALL(FILES
${CUBICSDR_HEADER_IMAGE}
DESTINATION share/cubicsdr/)
ENDIF()
ENDIF() ENDIF()
IF (WIN32 AND BUILD_INSTALLER) IF (WIN32 AND BUILD_INSTALLER)
set(BUNDLE_SOAPY_MODS OFF CACHE BOOL "Bundle local SoapySDR modules") set(BUNDLE_SOAPY_MODS OFF CACHE BOOL "Bundle local SoapySDR modules")
set(CPACK_GENERATOR NSIS) set(CPACK_GENERATOR NSIS)
set(CPACK_PACKAGE_NAME "CubicSDR") set(CPACK_PACKAGE_NAME "${CUBICSDR_INSTALL_NAME}")
set(CPACK_PACKAGE_VENDOR "cubicsdr.com") set(CPACK_PACKAGE_VENDOR "cubicsdr.com")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CubicSDR ${CUBICSDR_VERSION} Installer") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CUBICSDR_INSTALL_TITLE}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CubicSDR") set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CUBICSDR_INSTALL_NAME}")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "CubicSDR.ico") SET(CPACK_NSIS_INSTALLED_ICON_NAME "CubicSDR.ico")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/icon\\\\NSIS_Header.bmp") set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/icon\\\\NSIS_Header.bmp")
@ -827,6 +887,12 @@ IF (WIN32 AND BUILD_INSTALLER)
${CUBICSDR_FONTS} ${CUBICSDR_FONTS}
DESTINATION fonts) DESTINATION fonts)
IF (CUBICSDR_HAS_HEADER_IMAGE)
INSTALL(FILES
${CUBICSDR_HEADER_IMAGE}
DESTINATION .)
ENDIF()
IF(USE_HAMLIB) IF(USE_HAMLIB)
FOREACH(HAMLIB_DLL ${HAMLIB_DLLS}) FOREACH(HAMLIB_DLL ${HAMLIB_DLLS})
message(STATUS "Copying Hamlib DLL: ${HAMLIB_DLL}") message(STATUS "Copying Hamlib DLL: ${HAMLIB_DLL}")
@ -938,6 +1004,13 @@ IF(UNIX AND NOT APPLE AND NOT BUILD_DEB)
${CUBICSDR_FONTS} ${CUBICSDR_FONTS}
DESTINATION share/cubicsdr/fonts) DESTINATION share/cubicsdr/fonts)
IF (CUBICSDR_HAS_HEADER_IMAGE)
INSTALL(FILES
${CUBICSDR_HEADER_IMAGE}
DESTINATION share/cubicsdr)
ENDIF()
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/CubicSDR.desktop" INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/CubicSDR.desktop"
DESTINATION share/applications) DESTINATION share/applications)

View File

@ -28,7 +28,6 @@ long long DeviceConfig::getOffset() {
return offset.load(); return offset.load();
} }
void DeviceConfig::setSampleRate(long srate) { void DeviceConfig::setSampleRate(long srate) {
sampleRate.store(srate); sampleRate.store(srate);
} }
@ -289,6 +288,7 @@ AppConfig::AppConfig() : configName("") {
centerFreq.store(100000000); centerFreq.store(100000000);
waterfallLinesPerSec.store(DEFAULT_WATERFALL_LPS); waterfallLinesPerSec.store(DEFAULT_WATERFALL_LPS);
spectrumAvgSpeed.store(0.65f); spectrumAvgSpeed.store(0.65f);
dbOffset.store(0);
modemPropsCollapsed.store(false); modemPropsCollapsed.store(false);
#ifdef USE_HAMLIB #ifdef USE_HAMLIB
rigEnabled.store(false); rigEnabled.store(false);
@ -425,6 +425,14 @@ float AppConfig::getSpectrumAvgSpeed() {
return spectrumAvgSpeed.load(); return spectrumAvgSpeed.load();
} }
void AppConfig::setDBOffset(int offset) {
this->dbOffset.store(offset);
}
int AppConfig::getDBOffset() {
return dbOffset.load();
}
void AppConfig::setManualDevices(std::vector<SDRManualDef> manuals) { void AppConfig::setManualDevices(std::vector<SDRManualDef> manuals) {
manualDevices = manuals; manualDevices = manuals;
} }
@ -478,6 +486,7 @@ bool AppConfig::save() {
*window_node->newChild("waterfall_lps") = waterfallLinesPerSec.load(); *window_node->newChild("waterfall_lps") = waterfallLinesPerSec.load();
*window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load(); *window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load();
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();; *window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();;
*window_node->newChild("db_offset") = dbOffset.load();
} }
DataNode *devices_node = cfg.rootNode()->newChild("devices"); DataNode *devices_node = cfg.rootNode()->newChild("devices");
@ -628,6 +637,13 @@ bool AppConfig::load() {
win_node->getNext("modemprops_collapsed")->element()->get(mpc); win_node->getNext("modemprops_collapsed")->element()->get(mpc);
modemPropsCollapsed.store(mpc?true:false); modemPropsCollapsed.store(mpc?true:false);
} }
if (win_node->hasAnother("db_offset")) {
DataNode *offset_node = win_node->getNext("db_offset");
int offsetValue = 0;
offset_node->element()->get(offsetValue);
setDBOffset(offsetValue);
}
} }
if (cfg.rootNode()->hasAnother("devices")) { if (cfg.rootNode()->hasAnother("devices")) {

View File

@ -112,6 +112,9 @@ public:
void setSpectrumAvgSpeed(float avgSpeed); void setSpectrumAvgSpeed(float avgSpeed);
float getSpectrumAvgSpeed(); float getSpectrumAvgSpeed();
void setDBOffset(int offset);
int getDBOffset();
void setManualDevices(std::vector<SDRManualDef> manuals); void setManualDevices(std::vector<SDRManualDef> manuals);
std::vector<SDRManualDef> getManualDevices(); std::vector<SDRManualDef> getManualDevices();
@ -158,6 +161,7 @@ private:
std::atomic_llong centerFreq; std::atomic_llong centerFreq;
std::atomic_int waterfallLinesPerSec; std::atomic_int waterfallLinesPerSec;
std::atomic<float> spectrumAvgSpeed; std::atomic<float> spectrumAvgSpeed;
std::atomic_int dbOffset;
std::vector<SDRManualDef> manualDevices; std::vector<SDRManualDef> manualDevices;
#if USE_HAMLIB #if USE_HAMLIB
std::atomic_int rigModel, rigRate; std::atomic_int rigModel, rigRate;

View File

@ -43,6 +43,10 @@ wxEND_EVENT_TABLE()
#include "RigThread.h" #include "RigThread.h"
#endif #endif
/* split a string by 'seperator' into a vector of string */
std::vector<std::string> str_explode(const std::string &seperator, const std::string &in_str);
#define APPFRAME_MODEMPROPS_MINSIZE 20 #define APPFRAME_MODEMPROPS_MINSIZE 20
#define APPFRAME_MODEMPROPS_MAXSIZE 240 #define APPFRAME_MODEMPROPS_MAXSIZE 240
@ -54,7 +58,6 @@ AppFrame::AppFrame() :
#endif #endif
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *demodVisuals = new wxBoxSizer(wxVERTICAL);
demodTray = new wxBoxSizer(wxHORIZONTAL); demodTray = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL); wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *demodTunerTray = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *demodTunerTray = new wxBoxSizer(wxHORIZONTAL);
@ -70,6 +73,21 @@ AppFrame::AppFrame() :
wxPanel *demodPanel = new wxPanel(mainSplitter, wxID_ANY); wxPanel *demodPanel = new wxPanel(mainSplitter, wxID_ANY);
#ifdef CUBICSDR_HEADER_IMAGE
//get the dir path of the executable
wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
std::string headerPath = exePath.GetPath().ToStdString();
headerPath += filePathSeparator + std::string("" CUBICSDR_HEADER_IMAGE);
wxInitAllImageHandlers();
wxStaticBitmap *headerImgStatic = new wxStaticBitmap(demodPanel, wxID_ANY, wxBitmap( headerPath, wxBITMAP_TYPE_ANY ));
std::string headerBgColor = "" CUBICSDR_HEADER_BG;
if (headerBgColor != "") {
demodPanel->SetBackgroundColour(wxColour(headerBgColor));
}
demodTray->Add(headerImgStatic, 0, wxALIGN_CENTER_VERTICAL | wxALL, 0);
demodTray->AddSpacer(1);
#endif
gainCanvas = new GainCanvas(demodPanel, attribList); gainCanvas = new GainCanvas(demodPanel, attribList);
gainSizerItem = demodTray->Add(gainCanvas, 0, wxEXPAND | wxALL, 0); gainSizerItem = demodTray->Add(gainCanvas, 0, wxEXPAND | wxALL, 0);
@ -77,16 +95,24 @@ AppFrame::AppFrame() :
gainSpacerItem = demodTray->AddSpacer(1); gainSpacerItem = demodTray->AddSpacer(1);
gainSpacerItem->Show(false); gainSpacerItem->Show(false);
std::string modemListArr[] = { "FM", "FMS", "NBFM", "AM", "LSB", "USB", "DSB", "I/Q" };
std::vector<std::string> modemList( modemListArr, modemListArr + 8 );
#ifdef CUBICSDR_MODEM_EXCLUDE
std::string excludeListStr = "" CUBICSDR_MODEM_EXCLUDE;
std::vector<std::string> excludeList = str_explode(",",excludeListStr);
for (auto ex_i : excludeList) {
std::vector<std::string>::iterator found_i = std::find(modemList.begin(),modemList.end(),ex_i);
if (found_i != modemList.end()) {
modemList.erase(found_i);
}
}
#endif
demodModeSelector = new ModeSelectorCanvas(demodPanel, attribList); demodModeSelector = new ModeSelectorCanvas(demodPanel, attribList);
demodModeSelector->addChoice("FM"); for (auto mt_i : modemList) {
demodModeSelector->addChoice("FMS"); demodModeSelector->addChoice(mt_i);
demodModeSelector->addChoice("NBFM"); }
demodModeSelector->addChoice("AM");
demodModeSelector->addChoice("LSB");
demodModeSelector->addChoice("USB");
demodModeSelector->addChoice("DSB");
demodModeSelector->addChoice("I/Q");
demodModeSelector->setSelection("FM");
demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation (Hotkey F), Amplitude Modulation (A) and Lower (L), Upper (U), Double Side-Band and more."); demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation (Hotkey F), Amplitude Modulation (A) and Lower (L), Upper (U), Double Side-Band and more.");
demodModeSelector->SetMinSize(wxSize(50,-1)); demodModeSelector->SetMinSize(wxSize(50,-1));
demodModeSelector->SetMaxSize(wxSize(50,-1)); demodModeSelector->SetMaxSize(wxSize(50,-1));
@ -117,13 +143,19 @@ AppFrame::AppFrame() :
modemProps->SetMinSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE,-1)); modemProps->SetMinSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE,-1));
modemProps->SetMaxSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE,-1)); modemProps->SetMaxSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE,-1));
modemProps->Hide(); ModemArgInfoList dummyInfo;
modemProps->initProperties(dummyInfo, nullptr);
modemProps->updateTheme();
demodTray->Add(modemProps, 15, wxEXPAND | wxALL, 0); demodTray->Add(modemProps, 15, wxEXPAND | wxALL, 0);
#ifndef __APPLE__ #ifndef __APPLE__
demodTray->AddSpacer(1); demodTray->AddSpacer(1);
#endif #endif
#if CUBICSDR_ENABLE_VIEW_DEMOD
wxBoxSizer *demodVisuals = new wxBoxSizer(wxVERTICAL);
wxGetApp().getDemodSpectrumProcessor()->setup(1024); wxGetApp().getDemodSpectrumProcessor()->setup(1024);
demodSpectrumCanvas = new SpectrumCanvas(demodPanel, attribList); demodSpectrumCanvas = new SpectrumCanvas(demodPanel, attribList);
demodSpectrumCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000); demodSpectrumCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000);
@ -147,6 +179,10 @@ AppFrame::AppFrame() :
demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0); demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0);
demodTray->AddSpacer(1); demodTray->AddSpacer(1);
#else
demodSpectrumCanvas = nullptr;
demodWaterfallCanvas = nullptr;
#endif
demodSignalMeter = new MeterCanvas(demodPanel, attribList); demodSignalMeter = new MeterCanvas(demodPanel, attribList);
demodSignalMeter->setMax(DEMOD_SIGNAL_MAX); demodSignalMeter->setMax(DEMOD_SIGNAL_MAX);
@ -160,6 +196,7 @@ AppFrame::AppFrame() :
demodTray->AddSpacer(1); demodTray->AddSpacer(1);
#if CUBICSDR_ENABLE_VIEW_SCOPE
scopeCanvas = new ScopeCanvas(demodPanel, attribList); scopeCanvas = new ScopeCanvas(demodPanel, attribList);
scopeCanvas->setHelpTip("Audio Visuals, drag left/right to toggle Scope or Spectrum."); scopeCanvas->setHelpTip("Audio Visuals, drag left/right to toggle Scope or Spectrum.");
scopeCanvas->SetMinSize(wxSize(128,-1)); scopeCanvas->SetMinSize(wxSize(128,-1));
@ -168,6 +205,9 @@ AppFrame::AppFrame() :
wxGetApp().getScopeProcessor()->attachOutput(scopeCanvas->getInputQueue()); wxGetApp().getScopeProcessor()->attachOutput(scopeCanvas->getInputQueue());
demodScopeTray->AddSpacer(1); demodScopeTray->AddSpacer(1);
#else
scopeCanvas = nullptr;
#endif
deltaLockButton = new ModeSelectorCanvas(demodPanel, attribList); deltaLockButton = new ModeSelectorCanvas(demodPanel, attribList);
deltaLockButton->addChoice(1, "V"); deltaLockButton->addChoice(1, "V");
@ -245,6 +285,7 @@ AppFrame::AppFrame() :
wxGetApp().getSpectrumProcessor()->setup(2048); wxGetApp().getSpectrumProcessor()->setup(2048);
spectrumCanvas = new SpectrumCanvas(spectrumPanel, attribList); spectrumCanvas = new SpectrumCanvas(spectrumPanel, attribList);
spectrumCanvas->setShowDb(true); spectrumCanvas->setShowDb(true);
spectrumCanvas->setUseDBOfs(true);
spectrumCanvas->setScaleFactorEnabled(true); spectrumCanvas->setScaleFactorEnabled(true);
wxGetApp().getSpectrumProcessor()->attachOutput(spectrumCanvas->getVisualDataQueue()); wxGetApp().getSpectrumProcessor()->attachOutput(spectrumCanvas->getVisualDataQueue());
@ -649,6 +690,7 @@ void AppFrame::updateDeviceParams() {
newSettingsMenu->AppendSeparator(); newSettingsMenu->AppendSeparator();
newSettingsMenu->Append(wxID_SET_DB_OFFSET, "Power Level Offset");
newSettingsMenu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset"); newSettingsMenu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset");
if (devInfo->hasCORR(SOAPY_SDR_RX, 0)) { if (devInfo->hasCORR(SOAPY_SDR_RX, 0)) {
@ -864,6 +906,12 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
if (ofs != -1) { if (ofs != -1) {
wxGetApp().setOffset(ofs); wxGetApp().setOffset(ofs);
} }
} else if (event.GetId() == wxID_SET_DB_OFFSET) {
long ofs = wxGetNumberFromUser("Shift the displayed RF power level by this amount.\ni.e. -30 for -30 dB", "Decibels (dB)",
"Power Level Offset", wxGetApp().getConfig()->getDBOffset(), -1000, 1000, this);
if (ofs != -1) {
wxGetApp().getConfig()->setDBOffset(ofs);
}
} else if (event.GetId() == wxID_AGC_CONTROL) { } else if (event.GetId() == wxID_AGC_CONTROL) {
if (wxGetApp().getDevice() == NULL) { if (wxGetApp().getDevice() == NULL) {
agcMenuItem->Check(true); agcMenuItem->Check(true);
@ -1209,8 +1257,10 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
void AppFrame::OnClose(wxCloseEvent& event) { void AppFrame::OnClose(wxCloseEvent& event) {
wxGetApp().closeDeviceSelector(); wxGetApp().closeDeviceSelector();
if (wxGetApp().getDemodSpectrumProcessor()) {
wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodSpectrumCanvas->getVisualDataQueue()); wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodSpectrumCanvas->getVisualDataQueue());
wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodWaterfallCanvas->getVisualDataQueue()); wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodWaterfallCanvas->getVisualDataQueue());
}
wxGetApp().getSpectrumProcessor()->removeOutput(spectrumCanvas->getVisualDataQueue()); wxGetApp().getSpectrumProcessor()->removeOutput(spectrumCanvas->getVisualDataQueue());
wxGetApp().getConfig()->setWindow(this->GetPosition(), this->GetClientSize()); wxGetApp().getConfig()->setWindow(this->GetPosition(), this->GetClientSize());
@ -1281,7 +1331,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demodGainMeter->setInputValue(demod->getGain()); demodGainMeter->setInputValue(demod->getGain());
wxGetApp().getDemodMgr().setLastGain(demod->getGain()); wxGetApp().getDemodMgr().setLastGain(demod->getGain());
int outputDevice = demod->getOutputDevice(); int outputDevice = demod->getOutputDevice();
scopeCanvas->setDeviceName(outputDevices[outputDevice].name); if (scopeCanvas) scopeCanvas->setDeviceName(outputDevices[outputDevice].name);
// outputDeviceMenuItems[outputDevice]->Check(true); // outputDeviceMenuItems[outputDevice]->Check(true);
std::string dType = demod->getDemodulatorType(); std::string dType = demod->getDemodulatorType();
demodModeSelector->setSelection(dType); demodModeSelector->setSelection(dType);
@ -1293,7 +1343,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
modemPropertiesUpdated.store(true); modemPropertiesUpdated.store(true);
demodTuner->setHalfBand(dType=="USB" || dType=="LSB"); demodTuner->setHalfBand(dType=="USB" || dType=="LSB");
} }
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) { if (!demodWaterfallCanvas || demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
long long centerFreq = demod->getFrequency(); long long centerFreq = demod->getFrequency();
unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.25); unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.25);
@ -1314,7 +1364,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demodBw = 20000; demodBw = 20000;
} }
if (centerFreq != demodWaterfallCanvas->getCenterFrequency()) { if (demodWaterfallCanvas && centerFreq != demodWaterfallCanvas->getCenterFrequency()) {
demodWaterfallCanvas->setCenterFrequency(centerFreq); demodWaterfallCanvas->setCenterFrequency(centerFreq);
demodSpectrumCanvas->setCenterFrequency(centerFreq); demodSpectrumCanvas->setCenterFrequency(centerFreq);
} }
@ -1400,9 +1450,11 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
} }
} }
if (demodWaterfallCanvas) {
demodWaterfallCanvas->setBandwidth(demodBw); demodWaterfallCanvas->setBandwidth(demodBw);
demodSpectrumCanvas->setBandwidth(demodBw); demodSpectrumCanvas->setBandwidth(demodBw);
} }
}
demodSignalMeter->setLevel(demod->getSignalLevel()); demodSignalMeter->setLevel(demod->getSignalLevel());
demodSignalMeter->setMin(demod->getSignalFloor()); demodSignalMeter->setMin(demod->getSignalFloor());
@ -1457,9 +1509,9 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demodGainMeter->setLevel(demodGainMeter->getInputValue()); demodGainMeter->setLevel(demodGainMeter->getInputValue());
} }
if (wxGetApp().getFrequency() != demodWaterfallCanvas->getCenterFrequency()) { if (demodWaterfallCanvas && wxGetApp().getFrequency() != demodWaterfallCanvas->getCenterFrequency()) {
demodWaterfallCanvas->setCenterFrequency(wxGetApp().getFrequency()); demodWaterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
demodSpectrumCanvas->setCenterFrequency(wxGetApp().getFrequency()); if (demodSpectrumCanvas) demodSpectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
} }
if (spectrumCanvas->getViewState() && abs(wxGetApp().getFrequency()-spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate()/2)) { if (spectrumCanvas->getViewState() && abs(wxGetApp().getFrequency()-spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate()/2)) {
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency()); spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
@ -1476,6 +1528,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
} }
} }
if (scopeCanvas) {
scopeCanvas->setPPMMode(demodTuner->isAltDown()); scopeCanvas->setPPMMode(demodTuner->isAltDown());
scopeCanvas->setShowDb(spectrumCanvas->getShowDb()); scopeCanvas->setShowDb(spectrumCanvas->getShowDb());
@ -1484,6 +1537,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
wxGetApp().getAudioVisualQueue()->set_max_num_items((scopeCanvas->scopeVisible()?1:0) + (scopeCanvas->spectrumVisible()?1:0)); wxGetApp().getAudioVisualQueue()->set_max_num_items((scopeCanvas->scopeVisible()?1:0) + (scopeCanvas->spectrumVisible()?1:0));
wxGetApp().getScopeProcessor()->run(); wxGetApp().getScopeProcessor()->run();
}
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcessor(); SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcessor();
@ -1503,7 +1557,9 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcessor(); SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcessor();
if (dproc) {
dproc->setView(demodWaterfallCanvas->getViewState(), demodWaterfallCanvas->getCenterFrequency(),demodWaterfallCanvas->getBandwidth()); dproc->setView(demodWaterfallCanvas->getViewState(), demodWaterfallCanvas->getCenterFrequency(),demodWaterfallCanvas->getBandwidth());
}
SpectrumVisualProcessor *wproc = waterfallDataThread->getProcessor(); SpectrumVisualProcessor *wproc = waterfallDataThread->getProcessor();
@ -1536,13 +1592,15 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *)demod->getOutput(); ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *)demod->getOutput();
if (!outp->getDialog()) { if (!outp->getDialog()) {
outp->setTitle(demod->getDemodulatorType() + ": " + frequencyToStr(demod->getFrequency())); outp->setTitle(demod->getDemodulatorType() + ": " + frequencyToStr(demod->getFrequency()));
outp->setDialog(new DigitalConsole(this, outp)); outp->setDialog(new DigitalConsole(this, outp)) ;
} }
demod->showOutput(); demod->showOutput();
} }
#endif #endif
} else if (!demod) { } else if (!demod && modemPropertiesUpdated.load()) {
modemProps->Hide(); ModemArgInfoList dummyInfo;
modemProps->initProperties(dummyInfo, nullptr);
modemProps->updateTheme();
demodTray->Layout(); demodTray->Layout();
} }
@ -1563,7 +1621,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
wxGetApp().getSpectrumProcessor()->setPeakHold(peakHoldMode == 1); wxGetApp().getSpectrumProcessor()->setPeakHold(peakHoldMode == 1);
//make the peak hold act on the current dmod also, like a zoomed-in version. //make the peak hold act on the current dmod also, like a zoomed-in version.
wxGetApp().getDemodSpectrumProcessor()->setPeakHold(peakHoldMode == 1); if (wxGetApp().getDemodSpectrumProcessor()) wxGetApp().getDemodSpectrumProcessor()->setPeakHold(peakHoldMode == 1);
peakHoldButton->clearModeChanged(); peakHoldButton->clearModeChanged();
} }
@ -1577,7 +1635,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
if (scopeCanvas->HasFocus()) { if (scopeCanvas && scopeCanvas->HasFocus()) {
waterfallCanvas->SetFocus(); waterfallCanvas->SetFocus();
} }
#endif #endif
@ -1942,7 +2000,7 @@ void AppFrame::setMainWaterfallFFTSize(int fftSize) {
} }
void AppFrame::setScopeDeviceName(std::string deviceName) { void AppFrame::setScopeDeviceName(std::string deviceName) {
scopeCanvas->setDeviceName(deviceName); if (scopeCanvas) scopeCanvas->setDeviceName(deviceName);
} }
@ -1954,7 +2012,7 @@ void AppFrame::refreshGainUI() {
bool AppFrame::isUserDemodBusy() { bool AppFrame::isUserDemodBusy() {
return (modemProps && modemProps->isMouseInView()) return (modemProps && modemProps->isMouseInView())
|| (waterfallCanvas->isMouseInView() && waterfallCanvas->isMouseDown()) || (waterfallCanvas->isMouseInView() && waterfallCanvas->isMouseDown())
|| (demodWaterfallCanvas->isMouseInView() && demodWaterfallCanvas->isMouseDown()) || (demodWaterfallCanvas && demodWaterfallCanvas->isMouseInView() && demodWaterfallCanvas->isMouseDown())
|| (wxGetApp().getDemodMgr().getLastActiveDemodulator() && || (wxGetApp().getDemodMgr().getLastActiveDemodulator() &&
wxGetApp().getDemodMgr().getActiveDemodulator() && wxGetApp().getDemodMgr().getActiveDemodulator() &&
wxGetApp().getDemodMgr().getLastActiveDemodulator() != wxGetApp().getDemodMgr().getActiveDemodulator()); wxGetApp().getDemodMgr().getLastActiveDemodulator() != wxGetApp().getDemodMgr().getActiveDemodulator());
@ -2192,7 +2250,7 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
break; break;
case 'P': case 'P':
wxGetApp().getSpectrumProcessor()->setPeakHold(!wxGetApp().getSpectrumProcessor()->getPeakHold()); wxGetApp().getSpectrumProcessor()->setPeakHold(!wxGetApp().getSpectrumProcessor()->getPeakHold());
wxGetApp().getDemodSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold()); if (wxGetApp().getDemodSpectrumProcessor()) wxGetApp().getDemodSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold());
peakHoldButton->setSelection(wxGetApp().getSpectrumProcessor()->getPeakHold()?1:0); peakHoldButton->setSelection(wxGetApp().getSpectrumProcessor()->getPeakHold()?1:0);
peakHoldButton->clearModeChanged(); peakHoldButton->clearModeChanged();
break; break;
@ -2243,3 +2301,31 @@ void AppFrame::setViewState(long long center_freq) {
spectrumCanvas->disableView(); spectrumCanvas->disableView();
waterfallCanvas->disableView(); waterfallCanvas->disableView();
} }
/* split a string by 'seperator' into a vector of string */
std::vector<std::string> str_explode(const std::string &seperator, const std::string &in_str)
{
std::vector<std::string> vect_out;
int i = 0, j = 0;
int seperator_len = seperator.length();
int str_len = in_str.length();
while(i < str_len)
{
j = in_str.find_first_of(seperator,i);
if (j == std::string::npos && i < str_len) j = str_len;
if (j == std::string::npos) break;
vect_out.push_back(in_str.substr(i,j-i));
i = j;
i+=seperator_len;
}
return vect_out;
}

View File

@ -32,6 +32,7 @@
#define wxID_AGC_CONTROL 2009 #define wxID_AGC_CONTROL 2009
#define wxID_SDR_START_STOP 2010 #define wxID_SDR_START_STOP 2010
#define wxID_LOW_PERF 2011 #define wxID_LOW_PERF 2011
#define wxID_SET_DB_OFFSET 2012
#define wxID_MAIN_SPLITTER 2050 #define wxID_MAIN_SPLITTER 2050
#define wxID_VIS_SPLITTER 2051 #define wxID_VIS_SPLITTER 2051

View File

@ -228,25 +228,16 @@ bool CubicSDR::OnInit() {
// Visual Data // Visual Data
spectrumVisualThread = new SpectrumVisualDataThread(); spectrumVisualThread = new SpectrumVisualDataThread();
demodVisualThread = new SpectrumVisualDataThread();
pipeIQVisualData = new DemodulatorThreadInputQueue(); pipeIQVisualData = new DemodulatorThreadInputQueue();
pipeIQVisualData->set_max_num_items(1); pipeIQVisualData->set_max_num_items(1);
pipeDemodIQVisualData = new DemodulatorThreadInputQueue();
pipeDemodIQVisualData->set_max_num_items(1);
pipeWaterfallIQVisualData = new DemodulatorThreadInputQueue(); pipeWaterfallIQVisualData = new DemodulatorThreadInputQueue();
pipeWaterfallIQVisualData->set_max_num_items(128); pipeWaterfallIQVisualData->set_max_num_items(128);
getDemodSpectrumProcessor()->setInput(pipeDemodIQVisualData);
getSpectrumProcessor()->setInput(pipeIQVisualData); getSpectrumProcessor()->setInput(pipeIQVisualData);
getSpectrumProcessor()->setHideDC(true); getSpectrumProcessor()->setHideDC(true);
pipeAudioVisualData = new DemodulatorThreadOutputQueue();
pipeAudioVisualData->set_max_num_items(1);
scopeProcessor.setInput(pipeAudioVisualData);
// I/Q Data // I/Q Data
pipeSDRIQData = new SDRThreadIQDataQueue(); pipeSDRIQData = new SDRThreadIQDataQueue();
@ -260,11 +251,31 @@ bool CubicSDR::OnInit() {
sdrPostThread->setOutputQueue("IQVisualDataOutput", pipeIQVisualData); sdrPostThread->setOutputQueue("IQVisualDataOutput", pipeIQVisualData);
sdrPostThread->setOutputQueue("IQDataOutput", pipeWaterfallIQVisualData); sdrPostThread->setOutputQueue("IQDataOutput", pipeWaterfallIQVisualData);
sdrPostThread->setOutputQueue("IQActiveDemodVisualDataOutput", pipeDemodIQVisualData);
t_PostSDR = new std::thread(&SDRPostThread::threadMain, sdrPostThread); t_PostSDR = new std::thread(&SDRPostThread::threadMain, sdrPostThread);
t_SpectrumVisual = new std::thread(&SpectrumVisualDataThread::threadMain, spectrumVisualThread); t_SpectrumVisual = new std::thread(&SpectrumVisualDataThread::threadMain, spectrumVisualThread);
#if CUBICSDR_ENABLE_VIEW_SCOPE
pipeAudioVisualData = new DemodulatorThreadOutputQueue();
pipeAudioVisualData->set_max_num_items(1);
scopeProcessor.setInput(pipeAudioVisualData);
#else
pipeAudioVisualData = nullptr;
#endif
#if CUBICSDR_ENABLE_VIEW_DEMOD
demodVisualThread = new SpectrumVisualDataThread();
pipeDemodIQVisualData = new DemodulatorThreadInputQueue();
pipeDemodIQVisualData->set_max_num_items(1);
if (getDemodSpectrumProcessor()) getDemodSpectrumProcessor()->setInput(pipeDemodIQVisualData);
sdrPostThread->setOutputQueue("IQActiveDemodVisualDataOutput", pipeDemodIQVisualData);
t_DemodVisual = new std::thread(&SpectrumVisualDataThread::threadMain, demodVisualThread); t_DemodVisual = new std::thread(&SpectrumVisualDataThread::threadMain, demodVisualThread);
#else
demodVisualThread = nullptr;
pipeDemodIQVisualData = nullptr;
t_DemodVisual = nullptr;
#endif
sdrEnum = new SDREnumerator(); sdrEnum = new SDREnumerator();
@ -313,16 +324,20 @@ int CubicSDR::OnExit() {
std::cout << "Terminating Visual Processor threads.." << std::endl; std::cout << "Terminating Visual Processor threads.." << std::endl;
spectrumVisualThread->terminate(); spectrumVisualThread->terminate();
if (demodVisualThread) {
demodVisualThread->terminate(); demodVisualThread->terminate();
}
//Wait nicely //Wait nicely
sdrPostThread->isTerminated(1000); sdrPostThread->isTerminated(1000);
spectrumVisualThread->isTerminated(1000); spectrumVisualThread->isTerminated(1000);
if (demodVisualThread) {
demodVisualThread->isTerminated(1000); demodVisualThread->isTerminated(1000);
}
//Then join the thread themselves //Then join the thread themselves
t_PostSDR->join(); t_PostSDR->join();
t_DemodVisual->join(); if (t_DemodVisual) t_DemodVisual->join();
t_SpectrumVisual->join(); t_SpectrumVisual->join();
//Now only we can delete //Now only we can delete
@ -491,7 +506,9 @@ void CubicSDR::setFrequency(long long freq) {
getSpectrumProcessor()->setPeakHold(getSpectrumProcessor()->getPeakHold()); getSpectrumProcessor()->setPeakHold(getSpectrumProcessor()->getPeakHold());
//make the peak hold act on the current dmod also, like a zoomed-in version. //make the peak hold act on the current dmod also, like a zoomed-in version.
if (getDemodSpectrumProcessor()) {
getDemodSpectrumProcessor()->setPeakHold(getSpectrumProcessor()->getPeakHold()); getDemodSpectrumProcessor()->setPeakHold(getSpectrumProcessor()->getPeakHold());
}
} }
long long CubicSDR::getOffset() { long long CubicSDR::getOffset() {
@ -652,7 +669,11 @@ SpectrumVisualProcessor *CubicSDR::getSpectrumProcessor() {
} }
SpectrumVisualProcessor *CubicSDR::getDemodSpectrumProcessor() { SpectrumVisualProcessor *CubicSDR::getDemodSpectrumProcessor() {
if (demodVisualThread) {
return demodVisualThread->getProcessor(); return demodVisualThread->getProcessor();
} else {
return nullptr;
}
} }
DemodulatorThreadOutputQueue* CubicSDR::getAudioVisualQueue() { DemodulatorThreadOutputQueue* CubicSDR::getAudioVisualQueue() {
@ -704,6 +725,7 @@ void CubicSDR::removeDemodulator(DemodulatorInstance *demod) {
} }
demod->setActive(false); demod->setActive(false);
sdrPostThread->removeDemodulator(demod); sdrPostThread->removeDemodulator(demod);
wxGetApp().getAppFrame()->notifyUpdateModemProperties();
} }
std::vector<SDRDeviceInfo*>* CubicSDR::getDevices() { std::vector<SDRDeviceInfo*>* CubicSDR::getDevices() {

View File

@ -94,6 +94,9 @@ public:
void setOffset(long long ofs); void setOffset(long long ofs);
long long getOffset(); long long getOffset();
void setDBOffset(int ofs);
int getDBOffset();
void setSampleRate(long long rate_in); void setSampleRate(long long rate_in);
long long getSampleRate(); long long getSampleRate();

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#define CUBICSDR_TITLE "CubicSDR v" CUBICSDR_VERSION " by Charles J. Cliffe (@ccliffe) :: www.cubicsdr.com" #define CUBICSDR_TITLE "" CUBICSDR_BUILD_TITLE
#ifndef __BYTE_ORDER #ifndef __BYTE_ORDER
#ifdef _WIN32 #ifdef _WIN32

View File

@ -122,10 +122,8 @@ void ModemProperties::initProperties(ModemArgInfoList newArgs, DemodulatorInstan
m_propertyGrid->Clear(); m_propertyGrid->Clear();
if (!demodInstance) { if (!demodInstance) {
Hide(); m_propertyGrid->Append(new wxPropertyCategory("Modem Settings"));
return; return;
} else {
Show();
} }
m_propertyGrid->Append(new wxPropertyCategory(demodInstance->getDemodulatorType() + " Settings")); m_propertyGrid->Append(new wxPropertyCategory(demodInstance->getDemodulatorType() + " Settings"));

View File

@ -3,6 +3,7 @@
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include "CubicSDR.h"
#include "ColorTheme.h" #include "ColorTheme.h"
#include "CubicSDRDefs.h" #include "CubicSDRDefs.h"
@ -10,6 +11,7 @@ SpectrumPanel::SpectrumPanel() {
floorValue = 0; floorValue = 0;
ceilValue = 1; ceilValue = 1;
showDb = false; showDb = false;
useDbOfs = false;
fftSize = DEFAULT_FFT_SIZE; fftSize = DEFAULT_FFT_SIZE;
bandwidth = DEFAULT_DEMOD_BW; bandwidth = DEFAULT_DEMOD_BW;
freq = 0; freq = 0;
@ -83,6 +85,14 @@ bool SpectrumPanel::getShowDb() {
return showDb; return showDb;
} }
void SpectrumPanel::setUseDBOffset(bool useOfs) {
this->useDbOfs = useOfs;
}
bool SpectrumPanel::getUseDBOffset() {
return useDbOfs;
}
void SpectrumPanel::setPoints(std::vector<float> &points) { void SpectrumPanel::setPoints(std::vector<float> &points) {
this->points.assign(points.begin(), points.end()); this->points.assign(points.begin(), points.end());
@ -269,11 +279,11 @@ void SpectrumPanel::drawPanelContents() {
if (showDb) { if (showDb) {
float dbPanelWidth = (1.0 / viewWidth)*88.0 * GLFont::getScaleFactor(); float dbPanelWidth = (1.0 / viewWidth)*88.0 * GLFont::getScaleFactor();
float dbPanelHeight = (1.0/viewHeight)*14.0 * GLFont::getScaleFactor(); float dbPanelHeight = (1.0/viewHeight)*14.0 * GLFont::getScaleFactor();
float dbOfs = useDbOfs?wxGetApp().getConfig()->getDBOffset():0;
std::stringstream ssLabel(""); std::stringstream ssLabel("");
if (getCeilValue() != getFloorValue() && fftSize) { if (getCeilValue() != getFloorValue() && fftSize) {
ssLabel << std::fixed << std::setprecision(1) << (20.0 * log10(2.0*(getCeilValue())/(double)fftSize)) << "dB"; ssLabel << std::fixed << std::setprecision(1) << (dbOfs + 20.0 * log10(2.0*(getCeilValue())/(double)fftSize)) << "dB";
} }
dbPanelCeil.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT); dbPanelCeil.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
dbPanelCeil.setSize(dbPanelWidth, dbPanelHeight); dbPanelCeil.setSize(dbPanelWidth, dbPanelHeight);
@ -282,7 +292,7 @@ void SpectrumPanel::drawPanelContents() {
ssLabel.str(""); ssLabel.str("");
if (getCeilValue() != getFloorValue() && fftSize) { if (getCeilValue() != getFloorValue() && fftSize) {
ssLabel << (20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB"; ssLabel << (dbOfs + 20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB";
} }
dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT); dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);

View File

@ -27,6 +27,9 @@ public:
void setShowDb(bool showDb); void setShowDb(bool showDb);
bool getShowDb(); bool getShowDb();
void setUseDBOffset(bool useOfs);
bool getUseDBOffset();
protected: protected:
void drawPanelContents(); void drawPanelContents();
@ -40,5 +43,5 @@ private:
GLTextPanel dbPanelCeil; GLTextPanel dbPanelCeil;
GLTextPanel dbPanelFloor; GLTextPanel dbPanelFloor;
bool showDb; bool showDb, useDbOfs;
}; };

View File

@ -174,6 +174,14 @@ bool SpectrumCanvas::getShowDb() {
return spectrumPanel.getShowDb(); return spectrumPanel.getShowDb();
} }
void SpectrumCanvas::setUseDBOfs(bool showDb) {
spectrumPanel.setUseDBOffset(showDb);
}
bool SpectrumCanvas::getUseDBOfs() {
return spectrumPanel.getUseDBOffset();
}
void SpectrumCanvas::setView(long long center_freq_in, int bandwidth_in) { void SpectrumCanvas::setView(long long center_freq_in, int bandwidth_in) {
bwChange += bandwidth_in-bandwidth; bwChange += bandwidth_in-bandwidth;
#define BW_RESET_TH 400000 #define BW_RESET_TH 400000
@ -293,7 +301,9 @@ void SpectrumCanvas::OnMouseRightReleased(wxMouseEvent& event) {
wxGetApp().getSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold()); wxGetApp().getSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold());
//make the peak hold act on the current dmod also, like a zoomed-in version. //make the peak hold act on the current dmod also, like a zoomed-in version.
if (wxGetApp().getDemodSpectrumProcessor()) {
wxGetApp().getDemodSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold()); wxGetApp().getDemodSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold());
} }
}
mouseTracker.OnMouseRightReleased(event); mouseTracker.OnMouseRightReleased(event);
} }

View File

@ -22,6 +22,9 @@ public:
void setShowDb(bool showDb); void setShowDb(bool showDb);
bool getShowDb(); bool getShowDb();
void setUseDBOfs(bool showDb);
bool getUseDBOfs();
void setView(long long center_freq_in, int bandwidth_in); void setView(long long center_freq_in, int bandwidth_in);
void disableView(); void disableView();