Skip to content

Commit

Permalink
Merge branch 'ms-easy-record' into ms-rel-v189
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Apr 23, 2023
2 parents 6ec91a6 + 942e81d commit 641648e
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 84 deletions.
139 changes: 71 additions & 68 deletions USER_MANUAL.html

Large diffs are not rendered by default.

26 changes: 18 additions & 8 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,24 @@ As an aid to the above, FreeDV will show the current mode on the bottom of the w

# Voice Keyer

The Voice Keyer Button on the front page, and the Options-PTT dialog
puts FreeDV and your radio into transmit, reads a wave file of your
voice to call CQ, and then switches to receive to see if anyone is
replying. If you press the space bar the voice keyer stops. If a signal
with a valid sync is received for a few seconds the voice keyer stops.

The Options-PTT dialog can be used to select the wave file, set the Rx
delay, and number of times the tx/rx cycle repeats.
The Voice Keyer Button on the front page puts FreeDV and your radio into
transmit, reads a wave file of your voice to call CQ, and then switches to
receive to see if anyone is replying. If you press the space bar or click
the PTT button, the voice keyer stops. If a signal with a valid sync is
received for a few seconds the voice keyer also stops.

The Audio tab inside Tools-Options can be used to select the wave file, set
the Rx delay, and number of times the tx/rx cycle repeats.

# Quick Record

To quickly record incoming signals from the radio, a 'Record' button is provided
in the main window. Clicking this button will create a file beginning with the
name "FreeDV_FromRadio" and containing the current date and time. Clicking 'Record'
again will stop recording.

The Audio tab inside Tools-Options allows control of where these recordings are
saved. By default, this is inside the current user's Documents folder.

# Multiple Configurations

Expand Down
48 changes: 46 additions & 2 deletions src/dlg_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c

m_notebook->AddPage(m_reportingTab, _("Reporting"));
m_notebook->AddPage(m_displayTab, _("Display"));
m_notebook->AddPage(m_keyerTab, _("Voice Keyer"));
m_notebook->AddPage(m_keyerTab, _("Audio"));
m_notebook->AddPage(m_modemTab, _("Modem"));
m_notebook->AddPage(m_simulationTab, _("Simulation"));
m_notebook->AddPage(m_interfacingTab, _("UDP"));
Expand Down Expand Up @@ -186,6 +186,29 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c

m_keyerTab->SetSizer(sizerKeyer);

//------------------------------
// Quick Record
//------------------------------

wxStaticBoxSizer* sbsQuickRecord = new wxStaticBoxSizer( new wxStaticBox(m_keyerTab, wxID_ANY, _("Quick Record")), wxVERTICAL);

wxBoxSizer* quickRecordSizer = new wxBoxSizer(wxHORIZONTAL);

wxStaticText *staticTextQRPath = new wxStaticText(m_keyerTab, wxID_ANY, _("Location to save recordings: "), wxDefaultPosition, wxDefaultSize, 0);
quickRecordSizer->Add(staticTextQRPath, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

m_txtCtrlQuickRecordPath = new wxTextCtrl(m_keyerTab, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300,-1), 0);
m_txtCtrlQuickRecordPath->SetToolTip(_("Location which to save recordings started via the Record button in the main window."));
quickRecordSizer->Add(m_txtCtrlQuickRecordPath, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

m_buttonChooseQuickRecordPath = new wxButton(m_keyerTab, wxID_APPLY, _("Choose"), wxDefaultPosition, wxSize(-1,-1), 0);
m_buttonChooseQuickRecordPath->SetMinSize(wxSize(120, -1));
quickRecordSizer->Add(m_buttonChooseQuickRecordPath, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

sbsQuickRecord->Add(quickRecordSizer);

sizerKeyer->Add(sbsQuickRecord,0, wxALL | wxEXPAND, 5);

// Modem tab
wxBoxSizer* sizerModem = new wxBoxSizer(wxVERTICAL);

Expand Down Expand Up @@ -524,6 +547,8 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c

m_buttonChooseVoiceKeyerWaveFile->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseVoiceKeyerWaveFile), NULL, this);

m_buttonChooseQuickRecordPath->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseQuickRecordPath), NULL, this);

m_BtnFifoReset->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnFifoReset), NULL, this);
m_btn_udp_test->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnUDPTest), NULL, this);

Expand Down Expand Up @@ -558,6 +583,7 @@ OptionsDlg::~OptionsDlg()
m_ckboxFreeDV700txClip->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this);
m_ckboxFreeDV700Combine->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700Combine), NULL, this);
m_buttonChooseVoiceKeyerWaveFile->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseVoiceKeyerWaveFile), NULL, this);
m_buttonChooseQuickRecordPath->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseQuickRecordPath), NULL, this);

m_BtnFifoReset->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnFifoReset), NULL, this);
m_btn_udp_test->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnUDPTest), NULL, this);
Expand Down Expand Up @@ -589,6 +615,8 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
m_txtCtrlVoiceKeyerRxPause->SetValue(wxString::Format(wxT("%i"), wxGetApp().m_intVoiceKeyerRxPause));
m_txtCtrlVoiceKeyerRepeats->SetValue(wxString::Format(wxT("%i"), wxGetApp().m_intVoiceKeyerRepeats));

m_txtCtrlQuickRecordPath->SetValue(wxGetApp().m_txtQuickRecordPath);

m_ckHalfDuplex->SetValue(wxGetApp().m_boolHalfDuplex);

m_ckboxMultipleRx->SetValue(wxGetApp().m_boolMultipleRx);
Expand Down Expand Up @@ -703,7 +731,10 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent)
if (tmp < 0) {tmp = 0;} if (tmp > 100) {tmp = 100;}
wxGetApp().m_intVoiceKeyerRepeats = (int)tmp;
pConfig->Write(wxT("/VoiceKeyer/Repeats"), wxGetApp().m_intVoiceKeyerRepeats);


wxGetApp().m_txtQuickRecordPath = m_txtCtrlQuickRecordPath->GetValue();
pConfig->Write(wxT("/QuickRecord/SavePath"), wxGetApp().m_txtQuickRecordPath);

wxGetApp().m_testFrames = m_ckboxTestFrame->GetValue();

wxGetApp().m_channel_noise = m_ckboxChannelNoise->GetValue();
Expand Down Expand Up @@ -878,6 +909,19 @@ void OptionsDlg::OnChooseVoiceKeyerWaveFile(wxCommandEvent& event) {
m_txtCtrlVoiceKeyerWaveFile->SetValue(wxGetApp().m_txtVoiceKeyerWaveFile);
}

void OptionsDlg::OnChooseQuickRecordPath(wxCommandEvent& event) {
wxDirDialog pathDialog(
this,
wxT("Choose Quick Record save location"),
wxGetApp().m_txtQuickRecordPath
);
if(pathDialog.ShowModal() == wxID_CANCEL) {
return; // the user changed their mind...
}

m_txtCtrlQuickRecordPath->SetValue(pathDialog.GetPath());
}

// Run time update of carrier amplitude attenuation

void OptionsDlg::OnAttnCarrierEn(wxScrollEvent& event) {
Expand Down
5 changes: 5 additions & 0 deletions src/dlg_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class OptionsDlg : public wxDialog
wxTextCtrl *m_txtCtrlVoiceKeyerRxPause;
wxTextCtrl *m_txtCtrlVoiceKeyerRepeats;

/* Quick Record */
wxButton *m_buttonChooseQuickRecordPath;
wxTextCtrl *m_txtCtrlQuickRecordPath;

/* test frames, other simulated channel impairments */

wxCheckBox *m_ckboxTestFrame;
Expand Down Expand Up @@ -151,6 +155,7 @@ class OptionsDlg : public wxDialog
unsigned int event_in_serial, event_out_serial;

void OnChooseVoiceKeyerWaveFile(wxCommandEvent& event);
void OnChooseQuickRecordPath(wxCommandEvent& event);

private:
void updatePSKReporterState();
Expand Down
7 changes: 7 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <chrono>
#include <climits>
#include <wx/cmdline.h>
#include <wx/stdpaths.h>
#include "version.h"
#include "main.h"
#include "osx_interface.h"
Expand Down Expand Up @@ -439,6 +440,10 @@ void MainFrame::loadConfiguration_()
wxGetApp().m_intVoiceKeyerRxPause = pConfig->Read(wxT("/VoiceKeyer/RxPause"), 10);
wxGetApp().m_intVoiceKeyerRepeats = pConfig->Read(wxT("/VoiceKeyer/Repeats"), 5);

auto wxStandardPathObj = wxStandardPaths::Get();
auto documentsDir = wxStandardPathObj.GetDocumentsDir();
wxGetApp().m_txtQuickRecordPath = pConfig->Read(wxT("/QuickRecord/SavePath"), documentsDir);

wxGetApp().m_boolHamlibUseForPTT = pConfig->ReadBool("/Hamlib/UseForPTT", false);
wxGetApp().m_intHamlibIcomCIVHex = pConfig->ReadLong("/Hamlib/IcomCIVHex", 0);

Expand Down Expand Up @@ -907,6 +912,8 @@ MainFrame::~MainFrame()
pConfig->Write(wxT("/VoiceKeyer/WaveFile"), wxGetApp().m_txtVoiceKeyerWaveFile);
pConfig->Write(wxT("/VoiceKeyer/RxPause"), wxGetApp().m_intVoiceKeyerRxPause);
pConfig->Write(wxT("/VoiceKeyer/Repeats"), wxGetApp().m_intVoiceKeyerRepeats);

pConfig->Write(wxT("/QuickRecord/SavePath"), wxGetApp().m_txtQuickRecordPath);

pConfig->Write(wxT("/Rig/HalfDuplex"), wxGetApp().m_boolHalfDuplex);
pConfig->Write(wxT("/Rig/MultipleRx"), wxGetApp().m_boolMultipleRx);
Expand Down
2 changes: 2 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ class MainApp : public wxApp
int m_intVoiceKeyerRxPause;
int m_intVoiceKeyerRepeats;

wxString m_txtQuickRecordPath;

bool m_boolHamlibUseForPTT;
unsigned int m_intHamlibRig;
wxString m_strHamlibRigName;
Expand Down
8 changes: 2 additions & 6 deletions src/playrec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#include "main.h"

#include <wx/stdpaths.h>

extern wxMutex g_mutexProtectingCallbackData;
SNDFILE *g_sfPlayFile;
bool g_playFileToMicIn;
Expand Down Expand Up @@ -393,11 +391,9 @@ void MainFrame::OnTogBtnRecord( wxCommandEvent& event )
}
else
{
auto wxStandardPathObj = wxStandardPaths::Get();
auto documentsDir = wxStandardPathObj.GetDocumentsDir();

auto currentTime = wxDateTime::Now().Format(_("%Y%m%d-%H%M%S"));
wxString soundFile = wxString::Format(_("%s/FreeDV_FromRadio_%s.wav"), documentsDir, currentTime);
wxFileName filePath(wxGetApp().m_txtQuickRecordPath, wxString::Format(_("FreeDV_FromRadio_%s.wav"), currentTime));
wxString soundFile = filePath.GetFullPath();
SF_INFO sfInfo;

sfInfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
Expand Down

0 comments on commit 641648e

Please sign in to comment.