Commit 975119a7 authored by Andreas Bombe's avatar Andreas Bombe

Update upstream source from tag 'upstream/0.2.3+dfsg'

Update to upstream version '0.2.3+dfsg'
with Debian dir f08846973461eeeb4e2ebe972f1d5c0b88031a14
parents cc9dbf1f 5c6e0ed7
*~
.*.sw[a-p]
.pc/
debian/.debhelper
debian/debhelper-build-stamp
debian/files
debian/*.debhelper.log
debian/*.substvars
debian/tmp/
debian/cubicsdr*/
obj-*/
build/
cmake_build/
dist/
......@@ -6,7 +6,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
SET(CUBICSDR_VERSION_MAJOR "0")
SET(CUBICSDR_VERSION_MINOR "2")
SET(CUBICSDR_VERSION_PATCH "2")
SET(CUBICSDR_VERSION_PATCH "3")
SET(CUBICSDR_VERSION_SUFFIX "")
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}${CUBICSDR_VERSION_SUFFIX}")
......@@ -347,6 +347,10 @@ SET (cubicsdr_sources
src/modules/modem/analog/ModemLSB.cpp
src/modules/modem/analog/ModemUSB.cpp
src/audio/AudioThread.cpp
src/audio/AudioSinkThread.cpp
src/audio/AudioSinkFileThread.cpp
src/audio/AudioFile.cpp
src/audio/AudioFileWAV.cpp
src/util/Gradient.cpp
src/util/Timer.cpp
src/util/MouseTracker.cpp
......@@ -451,6 +455,10 @@ SET (cubicsdr_headers
src/modules/modem/analog/ModemLSB.h
src/modules/modem/analog/ModemUSB.h
src/audio/AudioThread.h
src/audio/AudioSinkThread.h
src/audio/AudioSinkFileThread.h
src/audio/AudioFile.h
src/audio/AudioFileWAV.h
src/util/Gradient.h
src/util/Timer.h
src/util/ThreadBlockingQueue.h
......@@ -995,7 +1003,7 @@ IF (WIN32 AND BUILD_INSTALLER)
IF (MSVC)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/vc_redist.${EX_PLATFORM_NAME}.exe DESTINATION vc_redist)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\vc_redist\\\\vc_redist.${EX_PLATFORM_NAME}.exe\\\" /q:a'")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\vc_redist\\\\vc_redist.${EX_PLATFORM_NAME}.exe\\\" /passive /norestart'")
ENDIF (MSVC)
......
......@@ -12,7 +12,7 @@
#include <iostream>
#include "vec3.h"
#include <cstring>
#include <stddef.h>
namespace CubicVR {
#define mat3SG(c,x,y) \
......@@ -20,14 +20,20 @@ namespace CubicVR {
c & COMBINE(set,x)(mat3 value) { y = value; return *this; }
struct mat3 {
__float a,b,c,d,e,f,g,h,i;
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
operator __float*() const { return (__float *)this; }
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
mat3(__float ai,__float bi,__float ci,__float di,__float ei,__float fi,__float gi,__float hi,__float ii) {
a = ai; b = bi; c = ci; d = di; e = ei; f = fi; g = gi; h = hi; i = ii;
};
......
......@@ -15,21 +15,35 @@
#include "vec4.h"
#include "mat3.h"
#include <cmath>
#include <stddef.h>
namespace CubicVR {
using namespace std;
#define mat4SG(c,x,y) \
mat4 COMBINE(get,x)() { return y; } \
c & COMBINE(set,x)(mat4 value) { y = value; return *this; }
struct mat4 {
__float a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;
//16 elements
__float a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
//To be accessed by GL API directly, accessed by pointer.
//operator* overloading is way too dangerous, especially in ptr != NULL
//tests.
inline __float* to_ptr() const { return (__float *)this; }
operator __float*() const { return (__float *)this; }
mat4(__float ai,__float bi,__float ci,__float di,__float ei,__float fi,__float gi,__float hi,__float ii,__float ji,__float ki,__float li,__float mi,__float ni,__float oi,__float pi) {
a = ai; b = bi; c = ci; d = di; e = ei; f = fi; g = gi; h = hi; i = ii; j = ji; k = ki; l = li; m = mi; n = ni; o = oi; p = pi;
}
......@@ -263,22 +277,19 @@ namespace CubicVR {
static mat4 transform(vec3 position, vec3 rotation, vec3 scale) {
mat4 m = mat4::identity();
if (position!=NULL) {
m *= mat4::translate(position[0],position[1],position[2]);
}
if (rotation!=NULL) {
if (!(rotation[0] == 0 && rotation[1] == 0 && rotation[2] == 0)) {
m *= mat4::rotate(rotation[0],rotation[1],rotation[2]);
}
m *= mat4::translate(position[0],position[1],position[2]);
if (!(rotation[0] == 0 && rotation[1] == 0 && rotation[2] == 0)) {
m *= mat4::rotate(rotation[0], rotation[1], rotation[2]);
}
if (scale!=NULL) {
if (!(scale[0] == 1 && scale[1] == 1 && scale[2] == 1)) {
m *= mat4::scale(scale[0],scale[1],scale[2]);
}
if (!(scale[0] == 1 && scale[1] == 1 && scale[2] == 1)) {
m *= mat4::scale(scale[0],scale[1],scale[2]);
}
return m;
};
static vec4 vec4_multiply(vec4 m1, mat4 m2) {
vec4 mOut;
......@@ -313,7 +324,7 @@ namespace CubicVR {
};
static vec3 unProject(mat4 pMatrix, mat4 mvMatrix, float width, float height, float winx, float winy, float /* winz */) {
vec4 p(((winx / width) * 2.0f) - 1.0, -(((winy / height) * 2.0f) - 1.0), 1.0, 1.0);
vec4 p(((winx / width) * 2.0f) - 1.0f, -(((winy / height) * 2.0f) - 1.0f), 1.0f, 1.0f);
vec4 invp = mat4::vec4_multiply(mat4::vec4_multiply(p, mat4::inverse(pMatrix)), mat4::inverse(mvMatrix));
......
......@@ -73,7 +73,7 @@ namespace CubicVR {
void pushMatrix(mat4 m) {
c_stack++;
m_stack[c_stack] = (m ? m : getIdentity());
m_stack[c_stack] = m;
}
void popMatrix() {
......@@ -88,14 +88,10 @@ namespace CubicVR {
m_cache.clear();
c_stack = 0;
valid = 0;
delete result;
result = mat4::identity();
if (init_mat != NULL) {
m_stack[0] = init_mat;
} else {
setIdentity();
}
m_stack[0] = init_mat;
}
void translate(__float x, __float y, __float z) {
......
......@@ -12,6 +12,7 @@
#include <iostream>
#include <cmath>
#include "cubic_types.h"
#include <stddef.h>
namespace CubicVR {
#define vec2SG(c,x,y) \
......@@ -20,20 +21,27 @@ namespace CubicVR {
struct vec2 {
__float x, y;
public:
__float& u() { return x; }
__float& v() { return y; }
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
vec2 (__float xi,__float yi) { x = xi; y = yi; }
vec2 () { x = y = 0.0f; }
operator __float*() const { return (__float *)this; }
vec2 operator*(__float v) { return vec2( x*v, y*v ); }
// vec2 operator*(vec2 v) { return vec2::cross(*this,v); }
vec2 operator+(vec2 v) { return vec2::add(*this,v); }
vec2 operator-(vec2 v) { return vec2::subtract(*this,v); }
......
......@@ -12,6 +12,7 @@
#include <iostream>
#include "cubic_types.h"
#include <cmath>
#include <stddef.h>
namespace CubicVR {
......@@ -23,19 +24,24 @@ namespace CubicVR {
struct vec3 {
__float x,y,z;
operator __float*() const { return (__float *)this; }
__float& r() { return x; }
__float& g() { return y; }
__float& b() { return z; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
vec3 (__float xi,__float yi,__float zi) { x = xi; y = yi; z = zi; }
vec3 () { x = y = z = 0.0f; }
vec3 operator*(__float v) { return vec3(x*v, y*v, z*v); }
vec3 operator*(vec3 v) { return vec3::cross(*this,v); }
vec3 operator+(vec3 v) { return vec3::add(*this,v); }
......
......@@ -12,6 +12,7 @@
#include <iostream>
#include "cubic_types.h"
#include <cmath>
#include <stddef.h>
namespace CubicVR {
......@@ -20,23 +21,29 @@ namespace CubicVR {
c & COMBINE(set,x)(vec3 value) { y = value; return *this; }
struct vec4 {
__float x,y,z,w;
__float x, y, z, w;
public:
__float& r() { return x; }
__float& g() { return y; }
__float& b() { return z; }
__float& a() { return w; }
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
#ifndef _WIN32
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
#endif
//access as-array:
inline __float& operator [] (size_t i) {
__float* as_array = (__float*)this;
return (as_array[i]);
}
inline const __float& operator [] (size_t i) const {
__float* as_array = (__float*)this;
return (as_array[i]);
}
vec4 (__float xi,__float yi,__float zi,__float wi) { x = xi; y = yi; z = zi; w = wi; }
vec4 () { x = y = z = w = 0.0f; }
operator __float*() const { return (__float *)this; }
vec4 operator*(__float v) { return vec4(x*v, y*v, z*v, w*v); }
// vec4 operator*(vec4 v) { return vec4::cross(*this,v); }
// vec4 operator+(vec4 v) { return vec4::add(*this,v); }
......
......@@ -4,6 +4,8 @@
#include "AppConfig.h"
#include "CubicSDR.h"
#include <wx/msgdlg.h>
DeviceConfig::DeviceConfig() : deviceId("") {
ppm.store(0);
offset.store(0);
......@@ -39,6 +41,14 @@ long DeviceConfig::getSampleRate() {
return sampleRate.load();
}
void DeviceConfig::setAntennaName(const std::string& name) {
antennaName = name;
}
const std::string& DeviceConfig::getAntennaName() {
return antennaName;
}
void DeviceConfig::setAGCMode(bool agcMode) {
this->agcMode.store(agcMode);
}
......@@ -81,7 +91,9 @@ std::string DeviceConfig::getDeviceName() {
}
void DeviceConfig::save(DataNode *node) {
std::lock_guard < std::mutex > lock(busy_lock);
*node->newChild("id") = deviceId;
*node->newChild("name") = deviceName;
*node->newChild("ppm") = ppm.load();
......@@ -89,6 +101,10 @@ void DeviceConfig::save(DataNode *node) {
*node->newChild("sample_rate") = sampleRate.load();
*node->newChild("agc_mode") = agcMode.load()?1:0;
if (!antennaName.empty()) {
*node->newChild("antenna") = antennaName;
}
if (streamOpts.size()) {
DataNode *streamOptsNode = node->newChild("streamOpts");
for (ConfigSettings::const_iterator opt_i = streamOpts.begin(); opt_i != streamOpts.end(); opt_i++) {
......@@ -149,6 +165,12 @@ void DeviceConfig::load(DataNode *node) {
sample_rate_node->element()->get(sampleRateValue);
setSampleRate(sampleRateValue);
}
if (node->hasAnother("antenna")) {
DataNode *antenna_node = node->getNext("antenna");
std::string antennaNameValue;
antenna_node->element()->get(antennaNameValue);
setAntennaName(antennaNameValue);
}
if (node->hasAnother("streamOpts")) {
DataNode *streamOptsNode = node->getNext("streamOpts");
for (int i = 0, iMax = streamOptsNode->numChildren(); i<iMax; i++) {
......@@ -485,6 +507,51 @@ bool AppConfig::getBookmarksVisible() {
return bookmarksVisible.load();
}
void AppConfig::setRecordingPath(std::string recPath) {
recordingPath = recPath;
}
std::string AppConfig::getRecordingPath() {
return recordingPath;
}
bool AppConfig::verifyRecordingPath() {
string recPathStr = wxGetApp().getConfig()->getRecordingPath();
if (recPathStr.empty()) {
wxMessageBox( wxT("Recording path is not set. Please use 'Set Recording Path' from the 'File' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
return false;
}
wxFileName recPath(recPathStr);
if (!recPath.Exists() || !recPath.IsDirWritable()) {
wxMessageBox( wxT("Recording path does not exist or is not writable. Please use 'Set Recording Path' from the 'File' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
return false;
}
return true;
}
void AppConfig::setRecordingSquelchOption(int enumChoice) {
recordingSquelchOption = enumChoice;
}
int AppConfig::getRecordingSquelchOption() {
return recordingSquelchOption;
}
void AppConfig::setRecordingFileTimeLimit(int nbSeconds) {
recordingFileTimeLimitSeconds = nbSeconds;
}
int AppConfig::getRecordingFileTimeLimit() {
return recordingFileTimeLimitSeconds;
}
void AppConfig::setConfigName(std::string configName) {
this->configName = configName;
......@@ -539,6 +606,12 @@ bool AppConfig::save() {
*window_node->newChild("bookmark_visible") = bookmarksVisible.load();
}
//Recording settings:
DataNode *rec_node = cfg.rootNode()->newChild("recording");
*rec_node->newChild("path") = recordingPath;
*rec_node->newChild("squelch") = recordingSquelchOption;
*rec_node->newChild("file_time_limit") = recordingFileTimeLimitSeconds;
DataNode *devices_node = cfg.rootNode()->newChild("devices");
std::map<std::string, DeviceConfig *>::iterator device_config_i;
......@@ -721,6 +794,26 @@ bool AppConfig::load() {
}
}
//Recording settings:
if (cfg.rootNode()->hasAnother("recording")) {
DataNode *rec_node = cfg.rootNode()->getNext("recording");
if (rec_node->hasAnother("path")) {
DataNode *rec_path = rec_node->getNext("path");
recordingPath = rec_path->element()->toString();
}
if (rec_node->hasAnother("squelch")) {
DataNode *rec_squelch = rec_node->getNext("squelch");
rec_squelch->element()->get(recordingSquelchOption);
}
if (rec_node->hasAnother("file_time_limit")) {
DataNode *rec_file_time_limit = rec_node->getNext("file_time_limit");
rec_file_time_limit->element()->get(recordingFileTimeLimitSeconds);
}
}
if (cfg.rootNode()->hasAnother("devices")) {
DataNode *devices_node = cfg.rootNode()->getNext("devices");
......
......@@ -31,6 +31,9 @@ public:
void setSampleRate(long srate);
long getSampleRate();
void setAntennaName(const std::string& name);
const std::string& getAntennaName();
void setAGCMode(bool agcMode);
bool getAGCMode();
......@@ -64,12 +67,14 @@ public:
private:
std::string deviceId;
std::string deviceName;
std::mutex busy_lock;
std::atomic_int ppm;
std::atomic_llong offset;
std::atomic_bool agcMode;
std::atomic_long sampleRate;
std::string antennaName;
ConfigSettings streamOpts;
ConfigGains gains;
std::map<std::string, std::string> settings;
......@@ -133,6 +138,16 @@ public:
void setBookmarksVisible(bool state);
bool getBookmarksVisible();
//Recording settings:
void setRecordingPath(std::string recPath);
std::string getRecordingPath();
bool verifyRecordingPath();
void setRecordingSquelchOption(int enumChoice);
int getRecordingSquelchOption();
void setRecordingFileTimeLimit(int nbSeconds);
int getRecordingFileTimeLimit();
#if USE_HAMLIB
int getRigModel();
......@@ -180,6 +195,10 @@ private:
std::atomic_int dbOffset;
std::vector<SDRManualDef> manualDevices;
std::atomic_bool bookmarksVisible;
std::string recordingPath = "";
int recordingSquelchOption = 0;
int recordingFileTimeLimitSeconds = 0;
#if USE_HAMLIB
std::atomic_int rigModel, rigRate;
std::string rigPort;
......
This diff is collapsed.
......@@ -26,7 +26,8 @@
#include "FrequencyDialog.h"
#include "BookmarkView.h"
#include "AboutDialog.h"
#include "DemodulatorInstance.h"
#include "DemodulatorThread.h"
#include <map>
#define wxID_RT_AUDIO_DEVICE 1000
......@@ -42,6 +43,11 @@
#define wxID_SET_DB_OFFSET 2012
#define wxID_ABOUT_CUBICSDR 2013
#define wxID_OPEN_BOOKMARKS 2020
#define wxID_SAVE_BOOKMARKS 2021
#define wxID_SAVEAS_BOOKMARKS 2022
#define wxID_RESET_BOOKMARKS 2023
#define wxID_MAIN_SPLITTER 2050
#define wxID_VIS_SPLITTER 2051
#define wxID_BM_SPLITTER 2052
......@@ -64,8 +70,19 @@
#define wxID_SETTINGS_BASE 2300
#define wxID_ANTENNA_CURRENT 2500
#define wxID_ANTENNA_CURRENT_TX 2501
#define wxID_ANTENNAS_BASE 2502
#define wxID_DEVICE_ID 3500
#define wxID_RECORDING_PATH 8500
#define wxID_RECORDING_SQUELCH_BASE 8501
#define wxID_RECORDING_SQUELCH_SILENCE 8502
#define wxID_RECORDING_SQUELCH_SKIP 8503
#define wxID_RECORDING_SQUELCH_ALWAYS 8504
#define wxID_RECORDING_FILE_TIME_LIMIT 8505
#define wxID_AUDIO_BANDWIDTH_BASE 9000
#define wxID_AUDIO_DEVICE_MULTIPLIER 50
......@@ -91,6 +108,11 @@ public:
AppFrame();
~AppFrame();
wxMenu *makeFileMenu();
wxMenu *makeRecordingMenu();
void updateRecordingMenu();
void initDeviceParams(SDRDeviceInfo *devInfo);
void updateDeviceParams();
......@@ -103,19 +125,22 @@ public:
void setMainWaterfallFFTSize(int fftSize);
void setScopeDeviceName(std::string deviceName);
void gkNudgeLeft(DemodulatorInstance *demod, int snap);
void gkNudgeRight(DemodulatorInstance *demod, int snap);
void gkNudgeLeft(DemodulatorInstancePtr demod, int snap);
void gkNudgeRight(DemodulatorInstancePtr demod, int snap);
int OnGlobalKeyDown(wxKeyEvent &event);
int OnGlobalKeyUp(wxKeyEvent &event);
void toggleActiveDemodRecording();
void toggleAllActiveDemodRecording();
void setWaterfallLinesPerSecond(int lps);
void setSpectrumAvgSpeed(double avg);
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
void refreshGainUI();
void setViewState(long long center_freq, int bandwidth);
void setViewState(long long center_freq);
void setViewState();
long long getViewCenterFreq();
int getViewBandwidth();
......@@ -161,8 +186,13 @@ private:
bool actionOnMenuAudioSampleRate(wxCommandEvent& event);
bool actionOnMenuDisplay(wxCommandEvent& event);
bool actionOnMenuLoadSave(wxCommandEvent& event);
bool actionOnMenuRecording(wxCommandEvent& event);
bool actionOnMenuRig(wxCommandEvent& event);
wxString getSettingsLabel(const std::string& settingsName,
const std::string& settingsValue,
const std::string& settingsSuffix = "");
ScopeCanvas *scopeCanvas;
SpectrumCanvas *spectrumCanvas;
WaterfallCanvas *waterfallCanvas;
......@@ -185,14 +215,26 @@ private:
wxBoxSizer *demodTray;
BookmarkView *bookmarkView;
DemodulatorInstance *activeDemodulator;
//Use a raw pointer here to prevent a dangling reference
DemodulatorInstance* activeDemodulator;
std::vector<RtAudio::DeviceInfo> devices;
std::map<int,RtAudio::DeviceInfo> inputDevices;
std::map<int,RtAudio::DeviceInfo> outputDevices;
std::map<int, wxMenuItem *> outputDeviceMenuItems;
std::map<int, wxMenuItem *> sampleRateMenuItems;
std::map<int, wxMenuItem *> antennaMenuItems;
//depending on context, maps the item id to wxMenuItem*,
//OR the submenu item id to its parent wxMenuItem*.
std::map<int, wxMenuItem *> settingsMenuItems;
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
//
std::map<int, wxMenuItem *> recordingMenuItems;
std::map<int, wxMenuItem *> directSamplingMenuItems;
wxMenuBar *menuBar;
......@@ -201,14 +243,21 @@ private:
wxMenuItem *agcMenuItem = nullptr;
wxMenuItem *iqSwapMenuItem = nullptr;
wxMenuItem *lowPerfMenuItem = nullptr;
wxMenu *fileMenu = nullptr;
wxMenu *settingsMenu = nullptr;
wxMenu *recordingMenu = nullptr;
SoapySDR::ArgInfoList settingArgs;
int settingsIdMax;
std::vector<long> sampleRates;
long manualSampleRate = -1;
std::vector<std::string> antennaNames;
std::string currentTXantennaName;
std::string currentSessionFile;
std::string currentBookmarkFile;
FFTVisualDataThread *waterfallDataThread;
......
......@@ -4,6 +4,7 @@
#include "BookmarkMgr.h"
#include "CubicSDR.h"
#include "DataTree.h"
#include <wx/string.h>
#define BOOKMARK_RECENTS_MAX 25
......@@ -18,7 +19,8 @@ BookmarkMgr::BookmarkMgr() {
//represents an empty BookMarkList that is returned by reference by some functions.
const BookmarkList BookmarkMgr::emptyResults;
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpath) {
DataTree s("cubicsdr_bookmarks");
DataNode *header = s.rootNode()->newChild("header");
header->newChild("version")->element()->set(wxString(CUBICSDR_VERSION).ToStdWstring());
......@@ -48,7 +50,21 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup) {