Recording path notify, bookmark panel record buttons, tweaks and adjustments

This commit is contained in:
Charles J. Cliffe 2017-12-04 22:44:47 -05:00
parent 326a993a29
commit b9e4f6aeba
10 changed files with 84 additions and 14 deletions

View File

@ -4,6 +4,8 @@
#include "AppConfig.h"
#include "CubicSDR.h"
#include <wx/msgdlg.h>
DeviceConfig::DeviceConfig() : deviceId("") {
ppm.store(0);
offset.store(0);
@ -513,6 +515,25 @@ 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::setConfigName(std::string configName) {
this->configName = configName;

View File

@ -141,6 +141,8 @@ public:
void setRecordingPath(std::string recPath);
std::string getRecordingPath();
bool verifyRecordingPath();
#if USE_HAMLIB
int getRigModel();
void setRigModel(int rigModel);

View File

@ -2643,9 +2643,7 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
return 1;
break;
case 'R':
if (activeDemod) {
activeDemod->setRecording(!activeDemod->isRecording());
}
toggleActiveDemodRecording();
break;
case 'P':
wxGetApp().getSpectrumProcessor()->setPeakHold(!wxGetApp().getSpectrumProcessor()->getPeakHold());
@ -2691,6 +2689,19 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
return 1;
}
void AppFrame::toggleActiveDemodRecording() {
if (!wxGetApp().getConfig()->verifyRecordingPath()) {
return;
}
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
if (activeDemod) {
activeDemod->setRecording(!activeDemod->isRecording());
wxGetApp().getBookmarkMgr().updateActiveList();
}
}
void AppFrame::setWaterfallLinesPerSecond(int lps) {
waterfallSpeedMeter->setUserInputValue(sqrt(lps));

View File

@ -115,6 +115,8 @@ public:
int OnGlobalKeyDown(wxKeyEvent &event);
int OnGlobalKeyUp(wxKeyEvent &event);
void toggleActiveDemodRecording();
void setWaterfallLinesPerSecond(int lps);
void setSpectrumAvgSpeed(double avg);

View File

@ -7,6 +7,7 @@
AudioSinkThread::AudioSinkThread() {
inputQueuePtr = std::make_shared<AudioThreadInputQueue>();
inputQueuePtr->set_max_num_items(1000);
setInputQueue("input", inputQueuePtr);
}

View File

@ -24,7 +24,7 @@ public:
std::vector<float> data;
AudioThreadInput() :
frequency(0), sampleRate(0), inputRate(0), channels(0), peak(0), type(0) {
frequency(0), inputRate(0), sampleRate(0), channels(0), peak(0), type(0) {
}

View File

@ -331,12 +331,11 @@ void DemodulatorThread::run() {
std::cout << "DemodulatorThread::run() cannot push ati into audioOutputQueue, is full !" << std::endl;
std::this_thread::yield();
}
if (localAudioSinkOutputQueue != nullptr) {
if (!audioSinkOutputQueue->try_push(ati)) {
std::cout << "DemodulatorThread::run() cannot push ati into audioSinkOutputQueue, is full !" << std::endl;
std::this_thread::yield();
}
}
if (localAudioSinkOutputQueue != nullptr) {
if (!audioSinkOutputQueue->try_push(ati)) {
std::cout << "DemodulatorThread::run() cannot push ati into audioSinkOutputQueue, is full !" << std::endl;
}
}
}
@ -418,4 +417,4 @@ void DemodulatorThread::releaseSquelchLock(DemodulatorInstance* inst) {
if (inst == nullptr || squelchLock == inst) {
squelchLock = nullptr;
}
}
}

View File

@ -816,8 +816,16 @@ void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
clearButtons();
addBookmarkChoice(m_buttonPanel);
addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
if (dsel->isActive() && !(dsel->isRecording())) {
addButton(m_buttonPanel, "Start Recording", wxCommandEventHandler( BookmarkView::onStartRecording ));
} else {
addButton(m_buttonPanel, "Stop Recording", wxCommandEventHandler( BookmarkView::onStopRecording ));
}
addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
showProps();
showButtons();
refreshLayout();
@ -1149,6 +1157,30 @@ void BookmarkView::onRemoveActive( wxCommandEvent& /* event */ ) {
}
}
void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) {
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
if (!curSel->demod->isRecording() && wxGetApp().getConfig()->verifyRecordingPath()) {
curSel->demod->setRecording(true);
wxGetApp().getBookmarkMgr().updateActiveList();
}
}
}
void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) {
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
if (curSel->demod->isRecording()) {
curSel->demod->setRecording(false);
wxGetApp().getBookmarkMgr().updateActiveList();
}
}
}
void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) {
if (editingLabel) {

View File

@ -145,6 +145,8 @@ protected:
void onBookmarkChoice( wxCommandEvent &event );
void onRemoveActive( wxCommandEvent& event );
void onStartRecording( wxCommandEvent& event );
void onStopRecording( wxCommandEvent& event );
void onRemoveBookmark( wxCommandEvent& event );
void onActivateBookmark( wxCommandEvent& event );

View File

@ -565,14 +565,14 @@ void WaterfallCanvas::updateHoverState() {
mouseTracker.setVertDragLock(true);
mouseTracker.setHorizDragLock(false);
setStatusText("Click and drag to change demodulator bandwidth. SPACE or numeric key for direct frequency input. [, ] to nudge, M for mute, D to delete, C to center, E to edit label.");
setStatusText("Click and drag to change demodulator bandwidth. SPACE or numeric key for direct frequency input. [, ] to nudge, M for mute, D to delete, C to center, E to edit label, R to record.");
} else {
SetCursor(wxCURSOR_SIZING);
nextDragState = WF_DRAG_FREQUENCY;
mouseTracker.setVertDragLock(true);
mouseTracker.setHorizDragLock(false);
setStatusText("Click and drag to change demodulator frequency; SPACE or numeric key for direct input. [, ] to nudge, M for mute, D to delete, C to center, E to edit label.");
setStatusText("Click and drag to change demodulator frequency; SPACE or numeric key for direct input. [, ] to nudge, M for mute, D to delete, C to center, E to edit label, R to record.");
}
}
else {