Skip to content

Commit 7fb66b6

Browse files
authored
Merge pull request #594 from cjcliffe/audio_recording
Audio recording
2 parents 7b904bf + 7588e77 commit 7fb66b6

29 files changed

+2277
-656
lines changed

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
66

77
SET(CUBICSDR_VERSION_MAJOR "0")
88
SET(CUBICSDR_VERSION_MINOR "2")
9-
SET(CUBICSDR_VERSION_PATCH "2")
9+
SET(CUBICSDR_VERSION_PATCH "3")
1010
SET(CUBICSDR_VERSION_SUFFIX "")
1111
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}${CUBICSDR_VERSION_SUFFIX}")
1212

@@ -347,6 +347,10 @@ SET (cubicsdr_sources
347347
src/modules/modem/analog/ModemLSB.cpp
348348
src/modules/modem/analog/ModemUSB.cpp
349349
src/audio/AudioThread.cpp
350+
src/audio/AudioSinkThread.cpp
351+
src/audio/AudioSinkFileThread.cpp
352+
src/audio/AudioFile.cpp
353+
src/audio/AudioFileWAV.cpp
350354
src/util/Gradient.cpp
351355
src/util/Timer.cpp
352356
src/util/MouseTracker.cpp
@@ -451,6 +455,10 @@ SET (cubicsdr_headers
451455
src/modules/modem/analog/ModemLSB.h
452456
src/modules/modem/analog/ModemUSB.h
453457
src/audio/AudioThread.h
458+
src/audio/AudioSinkThread.h
459+
src/audio/AudioSinkFileThread.h
460+
src/audio/AudioFile.h
461+
src/audio/AudioFileWAV.h
454462
src/util/Gradient.h
455463
src/util/Timer.h
456464
src/util/ThreadBlockingQueue.h
@@ -995,7 +1003,7 @@ IF (WIN32 AND BUILD_INSTALLER)
9951003

9961004
IF (MSVC)
9971005
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/vc_redist.${EX_PLATFORM_NAME}.exe DESTINATION vc_redist)
998-
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\vc_redist\\\\vc_redist.${EX_PLATFORM_NAME}.exe\\\" /q:a'")
1006+
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\vc_redist\\\\vc_redist.${EX_PLATFORM_NAME}.exe\\\" /passive /norestart'")
9991007
ENDIF (MSVC)
10001008

10011009

src/AppConfig.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "AppConfig.h"
55
#include "CubicSDR.h"
66

7+
#include <wx/msgdlg.h>
8+
79
DeviceConfig::DeviceConfig() : deviceId("") {
810
ppm.store(0);
911
offset.store(0);
@@ -505,6 +507,51 @@ bool AppConfig::getBookmarksVisible() {
505507
return bookmarksVisible.load();
506508
}
507509

510+
void AppConfig::setRecordingPath(std::string recPath) {
511+
recordingPath = recPath;
512+
}
513+
514+
std::string AppConfig::getRecordingPath() {
515+
return recordingPath;
516+
}
517+
518+
bool AppConfig::verifyRecordingPath() {
519+
string recPathStr = wxGetApp().getConfig()->getRecordingPath();
520+
521+
if (recPathStr.empty()) {
522+
wxMessageBox( wxT("Recording path is not set. Please use 'Set Recording Path' from the 'File' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION);
523+
524+
return false;
525+
}
526+
527+
wxFileName recPath(recPathStr);
528+
529+
if (!recPath.Exists() || !recPath.IsDirWritable()) {
530+
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);
531+
532+
return false;
533+
}
534+
535+
return true;
536+
}
537+
538+
539+
void AppConfig::setRecordingSquelchOption(int enumChoice) {
540+
recordingSquelchOption = enumChoice;
541+
}
542+
543+
int AppConfig::getRecordingSquelchOption() {
544+
return recordingSquelchOption;
545+
}
546+
547+
void AppConfig::setRecordingFileTimeLimit(int nbSeconds) {
548+
recordingFileTimeLimitSeconds = nbSeconds;
549+
}
550+
551+
int AppConfig::getRecordingFileTimeLimit() {
552+
return recordingFileTimeLimitSeconds;
553+
}
554+
508555

509556
void AppConfig::setConfigName(std::string configName) {
510557
this->configName = configName;
@@ -559,6 +606,12 @@ bool AppConfig::save() {
559606
*window_node->newChild("bookmark_visible") = bookmarksVisible.load();
560607
}
561608

609+
//Recording settings:
610+
DataNode *rec_node = cfg.rootNode()->newChild("recording");
611+
*rec_node->newChild("path") = recordingPath;
612+
*rec_node->newChild("squelch") = recordingSquelchOption;
613+
*rec_node->newChild("file_time_limit") = recordingFileTimeLimitSeconds;
614+
562615
DataNode *devices_node = cfg.rootNode()->newChild("devices");
563616

564617
std::map<std::string, DeviceConfig *>::iterator device_config_i;
@@ -741,6 +794,26 @@ bool AppConfig::load() {
741794
}
742795
}
743796

797+
//Recording settings:
798+
if (cfg.rootNode()->hasAnother("recording")) {
799+
DataNode *rec_node = cfg.rootNode()->getNext("recording");
800+
801+
if (rec_node->hasAnother("path")) {
802+
DataNode *rec_path = rec_node->getNext("path");
803+
recordingPath = rec_path->element()->toString();
804+
}
805+
806+
if (rec_node->hasAnother("squelch")) {
807+
DataNode *rec_squelch = rec_node->getNext("squelch");
808+
rec_squelch->element()->get(recordingSquelchOption);
809+
}
810+
811+
if (rec_node->hasAnother("file_time_limit")) {
812+
DataNode *rec_file_time_limit = rec_node->getNext("file_time_limit");
813+
rec_file_time_limit->element()->get(recordingFileTimeLimitSeconds);
814+
}
815+
}
816+
744817
if (cfg.rootNode()->hasAnother("devices")) {
745818
DataNode *devices_node = cfg.rootNode()->getNext("devices");
746819

src/AppConfig.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ class AppConfig {
138138
void setBookmarksVisible(bool state);
139139
bool getBookmarksVisible();
140140

141+
//Recording settings:
142+
void setRecordingPath(std::string recPath);
143+
std::string getRecordingPath();
144+
bool verifyRecordingPath();
145+
146+
void setRecordingSquelchOption(int enumChoice);
147+
int getRecordingSquelchOption();
148+
149+
void setRecordingFileTimeLimit(int nbSeconds);
150+
int getRecordingFileTimeLimit();
141151

142152
#if USE_HAMLIB
143153
int getRigModel();
@@ -185,6 +195,10 @@ class AppConfig {
185195
std::atomic_int dbOffset;
186196
std::vector<SDRManualDef> manualDevices;
187197
std::atomic_bool bookmarksVisible;
198+
199+
std::string recordingPath = "";
200+
int recordingSquelchOption = 0;
201+
int recordingFileTimeLimitSeconds = 0;
188202
#if USE_HAMLIB
189203
std::atomic_int rigModel, rigRate;
190204
std::string rigPort;

0 commit comments

Comments
 (0)