Commit 8d7db041 authored by Andreas Bombe's avatar Andreas Bombe

New upstream version 0.2.0+git20170310+dfsg

parent ac88baf7
This diff is collapsed.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
......@@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
CubicSDR
Copyright (C) 2014 Charles J. Cliffe
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -329,7 +329,7 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
......@@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
......@@ -48,4 +48,4 @@ Target Platforms:
License:
-------
- GPL
- GPL-2.0+
# https://github.com/idiap/juicer/blob/master/cmake/FindRtAudio.cmake
#
# Copyright 2015 by Idiap Research Institute
#
# Licensed under 3-clause BSD.
#
# Author(s):
# Phil Garner, November 2015
#
# ...but basically copied from FindSndFile in libube, in turn from the examples
# on the web.
#
#
# Try to find RtAudio
# Once done this will define
# RTAUDIO_FOUND - System has RtAudio
# RTAUDIO_INCLUDE_DIR - The RtAudio include directories
# RTAUDIO_LIBRARIES - The libraries needed to use RtAudio
# RTAUDIO_DEFINITIONS - Compiler switches required for using RtAudio
# RTAUDIO_VERSION_STRING - the version of RtAudio found
#
find_package(PkgConfig)
pkg_check_modules(PC_RTAUDIO rtaudio)
set(RTAUDIO_DEFINITIONS ${PC_RTAUDIO_CFLAGS_OTHER})
set(RTAUDIO_VERSION_STRING ${PC_RTAUDIO_VERSION})
find_path(
RTAUDIO_INCLUDE_DIR RtAudio.h
HINTS ${PC_RTAUDIO_INCLUDEDIR} ${PC_RTAUDIO_INCLUDE_DIRS}
)
find_library(
RTAUDIO_LIBRARIES NAMES rtaudio
HINTS ${PC_RTAUDIO_LIBDIR} ${PC_RTAUDIO_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
RtAudio
REQUIRED_VARS RTAUDIO_LIBRARIES RTAUDIO_INCLUDE_DIR
VERSION_VAR RTAUDIO_VERSION_STRING
)
#mark_as_advanced(RTAUDIO_INCLUDE_DIR RTAUDIO_LIBRARIES)
/*
LodePNG version 20160501
LodePNG version 20161127
Copyright (c) 2005-2016 Lode Vandevenne
......@@ -39,7 +39,7 @@ Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for
#pragma warning( disable : 4996 ) /*VS does not like fopen, but fopen_s is not standard C so unusable here*/
#endif /*_MSC_VER */
const char* LODEPNG_VERSION_STRING = "20160501";
const char* LODEPNG_VERSION_STRING = "20161127";
/*
This source file is built up in the following large parts. The code sections
......@@ -3534,8 +3534,8 @@ void lodepng_color_profile_init(LodePNGColorProfile* profile)
{
profile->colored = 0;
profile->key = 0;
profile->alpha = 0;
profile->key_r = profile->key_g = profile->key_b = 0;
profile->alpha = 0;
profile->numcolors = 0;
profile->bits = 1;
}
......@@ -3622,8 +3622,8 @@ unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
if(a != 65535 && (a != 0 || (profile->key && !matchkey)))
{
profile->alpha = 1;
profile->key = 0;
alpha_done = 1;
if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
}
else if(a == 0 && !profile->alpha && !profile->key)
{
......@@ -3636,6 +3636,7 @@ unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
{
/* Color key cannot be used if an opaque pixel also has that RGB color. */
profile->alpha = 1;
profile->key = 0;
alpha_done = 1;
}
}
......@@ -3651,6 +3652,7 @@ unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
{
/* Color key cannot be used if an opaque pixel also has that RGB color. */
profile->alpha = 1;
profile->key = 0;
alpha_done = 1;
}
}
......@@ -3684,6 +3686,7 @@ unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
if(a != 255 && (a != 0 || (profile->key && !matchkey)))
{
profile->alpha = 1;
profile->key = 0;
alpha_done = 1;
if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
}
......@@ -3698,6 +3701,7 @@ unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
{
/* Color key cannot be used if an opaque pixel also has that RGB color. */
profile->alpha = 1;
profile->key = 0;
alpha_done = 1;
if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
}
......@@ -3734,7 +3738,9 @@ unsigned lodepng_get_color_profile(LodePNGColorProfile* profile,
{
/* Color key cannot be used if an opaque pixel also has that RGB color. */
profile->alpha = 1;
profile->key = 0;
alpha_done = 1;
if(profile->bits < 8) profile->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
}
}
}
......@@ -3760,7 +3766,7 @@ unsigned lodepng_auto_choose_color(LodePNGColorMode* mode_out,
{
LodePNGColorProfile prof;
unsigned error = 0;
unsigned i, n, palettebits, grey_ok, palette_ok;
unsigned i, n, palettebits, palette_ok;
lodepng_color_profile_init(&prof);
error = lodepng_get_color_profile(&prof, image, w, h, mode_in);
......@@ -3770,14 +3776,14 @@ unsigned lodepng_auto_choose_color(LodePNGColorMode* mode_out,
if(prof.key && w * h <= 16)
{
prof.alpha = 1; /*too few pixels to justify tRNS chunk overhead*/
prof.key = 0;
if(prof.bits < 8) prof.bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/
}
grey_ok = !prof.colored && !prof.alpha; /*grey without alpha, with potentially low bits*/
n = prof.numcolors;
palettebits = n <= 2 ? 1 : (n <= 4 ? 2 : (n <= 16 ? 4 : 8));
palette_ok = n <= 256 && (n * 2 < w * h) && prof.bits <= 8;
palette_ok = n <= 256 && prof.bits <= 8;
if(w * h < n * 2) palette_ok = 0; /*don't add palette overhead if image has only a few pixels*/
if(grey_ok && prof.bits <= palettebits) palette_ok = 0; /*grey is less overhead*/
if(!prof.colored && prof.bits <= palettebits) palette_ok = 0; /*grey is less overhead*/
if(palette_ok)
{
......@@ -3806,7 +3812,7 @@ unsigned lodepng_auto_choose_color(LodePNGColorMode* mode_out,
mode_out->colortype = prof.alpha ? (prof.colored ? LCT_RGBA : LCT_GREY_ALPHA)
: (prof.colored ? LCT_RGB : LCT_GREY);
if(prof.key && !prof.alpha)
if(prof.key)
{
unsigned mask = (1u << mode_out->bitdepth) - 1u; /*profile always uses 16-bit, mask converts it*/
mode_out->key_r = prof.key_r & mask;
......
/*
LodePNG version 20160501
LodePNG version 20161127
Copyright (c) 2005-2016 Lode Vandevenne
......@@ -559,11 +559,11 @@ Used internally by default if "auto_convert" is enabled. Public because it's use
typedef struct LodePNGColorProfile
{
unsigned colored; /*not greyscale*/
unsigned key; /*if true, image is not opaque. Only if true and alpha is false, color key is possible.*/
unsigned short key_r; /*these values are always in 16-bit bitdepth in the profile*/
unsigned key; /*image is not opaque and color key is possible instead of full alpha*/
unsigned short key_r; /*key values, always as 16-bit, in 8-bit case the byte is duplicated, e.g. 65535 means 255*/
unsigned short key_g;
unsigned short key_b;
unsigned alpha; /*alpha channel or alpha palette required*/
unsigned alpha; /*image is not opaque and alpha channel or alpha palette required*/
unsigned numcolors; /*amount of colors, up to 257. Not valid if bits == 16.*/
unsigned char palette[1024]; /*Remembers up to the first 256 RGBA colors, in no particular order*/
unsigned bits; /*bits per channel (not for palette). 1,2 or 4 for greyscale only. 16 if 16-bit per channel required.*/
......@@ -896,6 +896,7 @@ TODO:
[X] let the "isFullyOpaque" function check color keys and transparent palettes too
[X] better name for the variables "codes", "codesD", "codelengthcodes", "clcl" and "lldl"
[ ] don't stop decoding on errors like 69, 57, 58 (make warnings)
[ ] make warnings like: oob palette, checksum fail, data after iend, wrong/unknown crit chunk, no null terminator in text, ...
[ ] let the C++ wrapper catch exceptions coming from the standard library and return LodePNG error codes
[ ] allow user to provide custom color conversion functions, e.g. for premultiplied alpha, padding bits or not, ...
[ ] allow user to give data (void*) to custom allocator
......@@ -1607,6 +1608,7 @@ yyyymmdd.
Some changes aren't backwards compatible. Those are indicated with a (!)
symbol.
*) 27 nov 2016: grey+alpha auto color model detection bugfix
*) 18 apr 2016: Changed qsort to custom stable sort (for platforms w/o qsort).
*) 09 apr 2016: Fixed colorkey usage detection, and better file loading (within
the limits of pure C90).
......
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#include "AppConfig.h"
#include "CubicSDR.h"
......@@ -28,7 +31,6 @@ long long DeviceConfig::getOffset() {
return offset.load();
}
void DeviceConfig::setSampleRate(long srate) {
sampleRate.store(srate);
}
......@@ -82,7 +84,7 @@ void DeviceConfig::save(DataNode *node) {
std::lock_guard < std::mutex > lock(busy_lock);
*node->newChild("id") = deviceId;
*node->newChild("name") = deviceName;
*node->newChild("ppm") = (int)ppm.load();
*node->newChild("ppm") = ppm.load();
*node->newChild("offset") = offset.load();
*node->newChild("sample_rate") = sampleRate.load();
*node->newChild("agc_mode") = agcMode.load()?1:0;
......@@ -289,7 +291,13 @@ AppConfig::AppConfig() : configName("") {
centerFreq.store(100000000);
waterfallLinesPerSec.store(DEFAULT_WATERFALL_LPS);
spectrumAvgSpeed.store(0.65f);
dbOffset.store(0);
modemPropsCollapsed.store(false);
mainSplit = -1;
visSplit = -1;
bookmarkSplit = 200;
bookmarksVisible.store(true);
#ifdef USE_HAMLIB
rigEnabled.store(false);
rigModel.store(1);
......@@ -425,6 +433,14 @@ float AppConfig::getSpectrumAvgSpeed() {
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) {
manualDevices = manuals;
}
......@@ -433,6 +449,39 @@ std::vector<SDRManualDef> AppConfig::getManualDevices() {
return manualDevices;
}
void AppConfig::setMainSplit(float value) {
mainSplit.store(value);
}
float AppConfig::getMainSplit() {
return mainSplit.load();
}
void AppConfig::setVisSplit(float value) {
visSplit.store(value);
}
float AppConfig::getVisSplit() {
return visSplit.load();
}
void AppConfig::setBookmarkSplit(float value) {
bookmarkSplit.store(value);
}
float AppConfig::getBookmarkSplit() {
return bookmarkSplit.load();
}
void AppConfig::setBookmarksVisible(bool state) {
bookmarksVisible.store(state);
}
bool AppConfig::getBookmarksVisible() {
return bookmarksVisible.load();
}
void AppConfig::setConfigName(std::string configName) {
this->configName = configName;
}
......@@ -478,6 +527,12 @@ bool AppConfig::save() {
*window_node->newChild("waterfall_lps") = waterfallLinesPerSec.load();
*window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load();
*window_node->newChild("modemprops_collapsed") = modemPropsCollapsed.load();;
*window_node->newChild("db_offset") = dbOffset.load();
*window_node->newChild("main_split") = mainSplit.load();
*window_node->newChild("vis_split") = visSplit.load();
*window_node->newChild("bookmark_split") = bookmarkSplit.load();
*window_node->newChild("bookmark_visible") = bookmarksVisible.load();
}
DataNode *devices_node = cfg.rootNode()->newChild("devices");
......@@ -556,12 +611,13 @@ bool AppConfig::load() {
}
if (cfg.rootNode()->hasAnother("window")) {
int x,y,w,h;
int max,tips,lpm,mpc;
int x = 0 ,y = 0 ,w = 0 ,h = 0;
int max = 0 ,tips = 0 ,lpm = 0 ,mpc = 0;
DataNode *win_node = cfg.rootNode()->getNext("window");
if (win_node->hasAnother("w") && win_node->hasAnother("h") && win_node->hasAnother("x") && win_node->hasAnother("y")) {
win_node->getNext("x")->element()->get(x);
win_node->getNext("y")->element()->get(y);
win_node->getNext("w")->element()->get(w);
......@@ -628,6 +684,37 @@ bool AppConfig::load() {
win_node->getNext("modemprops_collapsed")->element()->get(mpc);
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 (win_node->hasAnother("main_split")) {
float gVal;
win_node->getNext("main_split")->element()->get(gVal);
mainSplit.store(gVal);
}
if (win_node->hasAnother("vis_split")) {
float gVal;
win_node->getNext("vis_split")->element()->get(gVal);
visSplit.store(gVal);
}
if (win_node->hasAnother("bookmark_split")) {
float gVal;
win_node->getNext("bookmark_split")->element()->get(gVal);
bookmarkSplit.store(gVal);
}
if (win_node->hasAnother("bookmark_visible")) {
int bVal;
win_node->getNext("bookmark_visible")->element()->get(bVal);
bookmarksVisible.store(bVal);
}
}
if (cfg.rootNode()->hasAnother("devices")) {
......
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include <wx/stdpaths.h>
......@@ -112,9 +115,25 @@ public:
void setSpectrumAvgSpeed(float avgSpeed);
float getSpectrumAvgSpeed();
void setDBOffset(int offset);
int getDBOffset();
void setManualDevices(std::vector<SDRManualDef> manuals);
std::vector<SDRManualDef> getManualDevices();
void setMainSplit(float value);
float getMainSplit();
void setVisSplit(float value);
float getVisSplit();
void setBookmarkSplit(float value);
float getBookmarkSplit();
void setBookmarksVisible(bool state);
bool getBookmarksVisible();
#if USE_HAMLIB
int getRigModel();
void setRigModel(int rigModel);
......@@ -157,8 +176,10 @@ private:
std::atomic_llong snap;
std::atomic_llong centerFreq;
std::atomic_int waterfallLinesPerSec;
std::atomic<float> spectrumAvgSpeed;
std::atomic<float> spectrumAvgSpeed, mainSplit, visSplit, bookmarkSplit;
std::atomic_int dbOffset;
std::vector<SDRManualDef> manualDevices;
std::atomic_bool bookmarksVisible;
#if USE_HAMLIB
std::atomic_int rigModel, rigRate;
std::string rigPort;
......
This diff is collapsed.
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/splitter.h>
#include <wx/sizer.h>
#include <wx/bitmap.h>
#include <wx/statbmp.h>
#include "PrimaryGLContext.h"
......@@ -19,6 +24,8 @@
#include "ModemProperties.h"
//#include "UITestCanvas.h"
#include "FrequencyDialog.h"
#include "BookmarkView.h"
#include "AboutDialog.h"
#include <map>
......@@ -32,9 +39,12 @@
#define wxID_AGC_CONTROL 2009
#define wxID_SDR_START_STOP 2010
#define wxID_LOW_PERF 2011
#define wxID_SET_DB_OFFSET 2012
#define wxID_ABOUT_CUBICSDR 2013
#define wxID_MAIN_SPLITTER 2050
#define wxID_VIS_SPLITTER 2051
#define wxID_BM_SPLITTER 2052
#define wxID_THEME_DEFAULT 2100
#define wxID_THEME_SHARP 2101
......@@ -44,7 +54,10 @@
#define wxID_THEME_HD 2105
#define wxID_THEME_RADAR 2106
#define wxID_DISPLAY_BOOKMARKS 2107
#define wxID_BANDWIDTH_BASE 2150
#define wxID_BANDWIDTH_MANUAL_DIALOG 2199
#define wxID_BANDWIDTH_MANUAL 2200
#define wxID_DISPLAY_BASE 2250
......@@ -73,8 +86,7 @@ class AppFrame: public wxFrame {
public:
AppFrame();
~AppFrame();
void OnThread(wxCommandEvent& event);
void OnEventInput(wxThreadEvent& event);
void initDeviceParams(SDRDeviceInfo *devInfo);
void updateDeviceParams();
......@@ -100,12 +112,26 @@ public:
void refreshGainUI();
void setViewState(long long center_freq, int bandwidth);
void setViewState(long long center_freq);
long long getViewCenterFreq();
int getViewBandwidth();
bool isUserDemodBusy();
BookmarkView *getBookmarkView();
void disableSave(bool state);
//call this in case the main UI is not
//the origin of device changes / sample rate by operator,
//and must be notified back to update its UI elements
//(ex: SDR Devices dialog changing the configuration)
void notifyDeviceChanged();
#ifdef _WIN32
bool canFocus();
#endif
//set tooltip to window
void setStatusText(wxWindow* window, std::string statusText);
void setStatusText(std::string statusText, int value);
private:
void OnMenu(wxCommandEvent& event);
......@@ -114,7 +140,20 @@ private:
void OnIdle(wxIdleEvent& event);
void OnDoubleClickSash(wxSplitterEvent& event);
void OnUnSplit(wxSplitterEvent& event);
void OnAboutDialogClose(wxCommandEvent& event);
//actionXXXX manage menu actions, return true if the event has been
//treated.
bool actionOnMenuAbout(wxCommandEvent& event);
bool actionOnMenuReset(wxCommandEvent& event);
bool actionOnMenuSettings(wxCommandEvent& event);
bool actionOnMenuAGC(wxCommandEvent& event);
bool actionOnMenuSampleRate(wxCommandEvent& event);
bool actionOnMenuAudioSampleRate(wxCommandEvent& event);
bool actionOnMenuDisplay(wxCommandEvent& event);
bool actionOnMenuLoadSave(wxCommandEvent& event);
bool actionOnMenuRig(wxCommandEvent& event);
ScopeCanvas *scopeCanvas;
SpectrumCanvas *spectrumCanvas;
WaterfallCanvas *waterfallCanvas;
......@@ -133,8 +172,9 @@ private:
ModeSelectorCanvas *demodMuteButton, *peakHoldButton, *soloModeButton, *deltaLockButton;
GainCanvas *gainCanvas;
wxSizerItem *gainSizerItem, *gainSpacerItem;
wxSplitterWindow *mainVisSplitter, *mainSplitter;
wxSplitterWindow *mainVisSplitter, *mainSplitter, *bookmarkSplitter;
wxBoxSizer *demodTray;
BookmarkView *bookmarkView;
DemodulatorInstance *activeDemodulator;
......@@ -147,16 +187,17 @@ private:
std::map<int, wxMenuItem *> directSamplingMenuItems;
wxMenuBar *menuBar;
wxMenu *sampleRateMenu;
wxMenu *displayMenu;
wxMenuItem *agcMenuItem;
wxMenuItem *iqSwapMenuItem;
wxMenuItem *lowPerfMenuItem;
wxMenu *settingsMenu;
wxMenu *sampleRateMenu = nullptr;
wxMenu *displayMenu = nullptr;
wxMenuItem *agcMenuItem = nullptr;
wxMenuItem *iqSwapMenuItem = nullptr;
wxMenuItem *lowPerfMenuItem = nullptr;
wxMenu *settingsMenu = nullptr;
SoapySDR::ArgInfoList settingArgs;
int settingsIdMax;
std::vector<long> sampleRates;
long manualSampleRate = -1;
std::string currentSessionFile;
......@@ -171,7 +212,14 @@ private:
wxMenuItem *showTipMenuItem;
bool lowPerfMode;
wxMenuItem *hideBookmarksItem;
bool saveDisabled;
AboutDialog *aboutDlg;
std::string lastToolTip;
#ifdef USE_HAMLIB
void enableRig();
void disableRig();
......@@ -184,6 +232,7 @@ private:
wxMenuItem *rigCenterLockMenuItem;
wxMenuItem *rigFollowModemMenuItem;
wxMenuItem *sdrIFMenuItem;
std::map<int, wxMenuItem *> rigSerialMenuItems;
std::map<int, wxMenuItem *> rigModelMenuItems;
int rigModel;
......
This diff is collapsed.
// Copyright (c) Charles J. Cliffe
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include <wx/arrstr.h>
#include <vector>
#include <set>
#include <memory>
#include "DataTree.h"
#include "DemodulatorInstance.h"
class BookmarkEntry {
public:
std::mutex busy_lock;
std::string type;
std::wstring label;
std::wstring userLabel;
long long frequency;
int bandwidth;
DataNode *node;
virtual ~BookmarkEntry() {
//free node
delete node;
}
};
class BookmarkRangeEntry {
public:
BookmarkRangeEntry() : label(L""), freq(0), startFreq(0), endFreq(0) {
}
BookmarkRangeEntry(std::wstring label, long long freq, long long startFreq, long long endFreq) : label(label), freq(freq), startFreq(startFreq), endFreq(endFreq) {
}
std::mutex busy_lock;
std::wstring label;
long long freq;
long long startFreq;
long long endFreq;
};
typedef std::shared_ptr<BookmarkEntry> BookmarkEntryPtr;
typedef std::shared_ptr<BookmarkRangeEntry> BookmarkRangeEntryPtr;
struct BookmarkEntryCompare : public std::binary_function<BookmarkEntryPtr,BookmarkEntryPtr,bool>
{
bool operator()(const BookmarkEntryPtr a, BookmarkEntryPtr b) const
{
return a->frequency < b->frequency;
}
};
struct BookmarkRangeEntryCompare : public std::binary_function<BookmarkRangeEntryPtr ,BookmarkRangeEntryPtr ,bool>
{
bool operator()(const BookmarkRangeEntryPtr a, BookmarkRangeEntryPtr b) const
{
return a->freq <