Recording path notify, bookmark panel record buttons, tweaks and adjustments
This commit is contained in:
parent
326a993a29
commit
b9e4f6aeba
|
@ -4,6 +4,8 @@
|
||||||
#include "AppConfig.h"
|
#include "AppConfig.h"
|
||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
|
|
||||||
|
#include <wx/msgdlg.h>
|
||||||
|
|
||||||
DeviceConfig::DeviceConfig() : deviceId("") {
|
DeviceConfig::DeviceConfig() : deviceId("") {
|
||||||
ppm.store(0);
|
ppm.store(0);
|
||||||
offset.store(0);
|
offset.store(0);
|
||||||
|
@ -513,6 +515,25 @@ std::string AppConfig::getRecordingPath() {
|
||||||
return recordingPath;
|
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) {
|
void AppConfig::setConfigName(std::string configName) {
|
||||||
this->configName = configName;
|
this->configName = configName;
|
||||||
|
|
|
@ -141,6 +141,8 @@ public:
|
||||||
void setRecordingPath(std::string recPath);
|
void setRecordingPath(std::string recPath);
|
||||||
std::string getRecordingPath();
|
std::string getRecordingPath();
|
||||||
|
|
||||||
|
bool verifyRecordingPath();
|
||||||
|
|
||||||
#if USE_HAMLIB
|
#if USE_HAMLIB
|
||||||
int getRigModel();
|
int getRigModel();
|
||||||
void setRigModel(int rigModel);
|
void setRigModel(int rigModel);
|
||||||
|
|
|
@ -2643,9 +2643,7 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
if (activeDemod) {
|
toggleActiveDemodRecording();
|
||||||
activeDemod->setRecording(!activeDemod->isRecording());
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
wxGetApp().getSpectrumProcessor()->setPeakHold(!wxGetApp().getSpectrumProcessor()->getPeakHold());
|
wxGetApp().getSpectrumProcessor()->setPeakHold(!wxGetApp().getSpectrumProcessor()->getPeakHold());
|
||||||
|
@ -2691,6 +2689,19 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
|
||||||
return 1;
|
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) {
|
void AppFrame::setWaterfallLinesPerSecond(int lps) {
|
||||||
waterfallSpeedMeter->setUserInputValue(sqrt(lps));
|
waterfallSpeedMeter->setUserInputValue(sqrt(lps));
|
||||||
|
|
|
@ -115,6 +115,8 @@ public:
|
||||||
int OnGlobalKeyDown(wxKeyEvent &event);
|
int OnGlobalKeyDown(wxKeyEvent &event);
|
||||||
int OnGlobalKeyUp(wxKeyEvent &event);
|
int OnGlobalKeyUp(wxKeyEvent &event);
|
||||||
|
|
||||||
|
void toggleActiveDemodRecording();
|
||||||
|
|
||||||
void setWaterfallLinesPerSecond(int lps);
|
void setWaterfallLinesPerSecond(int lps);
|
||||||
void setSpectrumAvgSpeed(double avg);
|
void setSpectrumAvgSpeed(double avg);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
AudioSinkThread::AudioSinkThread() {
|
AudioSinkThread::AudioSinkThread() {
|
||||||
inputQueuePtr = std::make_shared<AudioThreadInputQueue>();
|
inputQueuePtr = std::make_shared<AudioThreadInputQueue>();
|
||||||
|
inputQueuePtr->set_max_num_items(1000);
|
||||||
setInputQueue("input", inputQueuePtr);
|
setInputQueue("input", inputQueuePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
std::vector<float> data;
|
std::vector<float> data;
|
||||||
|
|
||||||
AudioThreadInput() :
|
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) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,12 +331,11 @@ void DemodulatorThread::run() {
|
||||||
std::cout << "DemodulatorThread::run() cannot push ati into audioOutputQueue, is full !" << std::endl;
|
std::cout << "DemodulatorThread::run() cannot push ati into audioOutputQueue, is full !" << std::endl;
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (localAudioSinkOutputQueue != nullptr) {
|
|
||||||
if (!audioSinkOutputQueue->try_push(ati)) {
|
if (localAudioSinkOutputQueue != nullptr) {
|
||||||
std::cout << "DemodulatorThread::run() cannot push ati into audioSinkOutputQueue, is full !" << std::endl;
|
if (!audioSinkOutputQueue->try_push(ati)) {
|
||||||
std::this_thread::yield();
|
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) {
|
if (inst == nullptr || squelchLock == inst) {
|
||||||
squelchLock = nullptr;
|
squelchLock = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -816,8 +816,16 @@ void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
|
||||||
clearButtons();
|
clearButtons();
|
||||||
|
|
||||||
addBookmarkChoice(m_buttonPanel);
|
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();
|
showProps();
|
||||||
showButtons();
|
showButtons();
|
||||||
refreshLayout();
|
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 */ ) {
|
void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) {
|
||||||
if (editingLabel) {
|
if (editingLabel) {
|
||||||
|
|
|
@ -145,6 +145,8 @@ protected:
|
||||||
void onBookmarkChoice( wxCommandEvent &event );
|
void onBookmarkChoice( wxCommandEvent &event );
|
||||||
|
|
||||||
void onRemoveActive( wxCommandEvent& event );
|
void onRemoveActive( wxCommandEvent& event );
|
||||||
|
void onStartRecording( wxCommandEvent& event );
|
||||||
|
void onStopRecording( wxCommandEvent& event );
|
||||||
void onRemoveBookmark( wxCommandEvent& event );
|
void onRemoveBookmark( wxCommandEvent& event );
|
||||||
|
|
||||||
void onActivateBookmark( wxCommandEvent& event );
|
void onActivateBookmark( wxCommandEvent& event );
|
||||||
|
|
|
@ -565,14 +565,14 @@ void WaterfallCanvas::updateHoverState() {
|
||||||
|
|
||||||
mouseTracker.setVertDragLock(true);
|
mouseTracker.setVertDragLock(true);
|
||||||
mouseTracker.setHorizDragLock(false);
|
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 {
|
} else {
|
||||||
SetCursor(wxCURSOR_SIZING);
|
SetCursor(wxCURSOR_SIZING);
|
||||||
nextDragState = WF_DRAG_FREQUENCY;
|
nextDragState = WF_DRAG_FREQUENCY;
|
||||||
|
|
||||||
mouseTracker.setVertDragLock(true);
|
mouseTracker.setVertDragLock(true);
|
||||||
mouseTracker.setHorizDragLock(false);
|
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 {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue