added file chooser for Vocei Keyer
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 14 Sep 2015 22:34:37 +0000 (22:34 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 14 Sep 2015 22:34:37 +0000 (22:34 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2330 01035d8c-6547-0410-b346-abe4f91aad63

freedv-dev/src/dlg_ptt.cpp
freedv-dev/src/dlg_ptt.h
freedv-dev/src/fdmdv2_main.cpp

index f9a88ce67d192c161e75c6a279af7c9a8eafc2bb..2b8f6ec975ac61fcd62a8f4a788d3c22be2a95ce 100644 (file)
@@ -62,10 +62,13 @@ ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title,
 
     wxStaticText *m_staticText28b = new wxStaticText(this, wxID_ANY, _("Wave File: "), wxDefaultPosition, wxDefaultSize, 0);
     staticBoxSizer28a->Add(m_staticText28b, 0, wxALIGN_CENTER_VERTICAL, 5);    
-    m_txtCtrlVoiceKeyerWaveFile = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(400,-1), 0);
+    m_txtCtrlVoiceKeyerWaveFile = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300,-1), 0);
     m_txtCtrlVoiceKeyerWaveFile->SetToolTip(_("Wave file to play for Voice Keyer"));
     staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerWaveFile, 0, 0, 5);
 
+    m_buttonChooseVoiceKeyerWaveFile = new wxButton(this, wxID_APPLY, _("Choose"), wxDefaultPosition, wxSize(-1,-1), 0);
+    staticBoxSizer28a->Add(m_buttonChooseVoiceKeyerWaveFile, 0, wxALIGN_CENTER_VERTICAL, 5);
+
     wxStaticText *m_staticText28c = new wxStaticText(this, wxID_ANY, _("   Rx Pause: "), wxDefaultPosition, wxDefaultSize, 0);
     staticBoxSizer28a->Add(m_staticText28c, 0, wxALIGN_CENTER_VERTICAL , 5);
     m_txtCtrlVoiceKeyerRxPause = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0);
@@ -211,6 +214,7 @@ ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title,
     m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
     m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
     m_buttonApply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
+    m_buttonChooseVoiceKeyerWaveFile->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnChooseVoiceKeyerWaveFile), NULL, this);
 }
 
 //-------------------------------------------------------------------------
@@ -225,6 +229,7 @@ ComPortsDlg::~ComPortsDlg()
     m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
     m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
     m_buttonApply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
+    m_buttonChooseVoiceKeyerWaveFile->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnChooseVoiceKeyerWaveFile), NULL, this);
 }
 
 //-------------------------------------------------------------------------
@@ -448,6 +453,22 @@ void ComPortsDlg::OnApply(wxCommandEvent& event)
     ExchangeData(EXCHANGE_DATA_OUT);
 }
 
+ void ComPortsDlg::OnChooseVoiceKeyerWaveFile(wxCommandEvent& event) {
+     wxFileDialog openFileDialog(
+                                 this,
+                                 wxT("Voice Keyer wave file"),
+                                 wxGetApp().m_txtVoiceKeyerWaveFile,
+                                 wxEmptyString,
+                                 wxT("WAV files (*.wav)|*.wav"),
+                                 wxFD_SAVE
+                                 );
+     if(openFileDialog.ShowModal() == wxID_CANCEL) {
+         return;     // the user changed their mind...
+     }
+
+     m_txtCtrlVoiceKeyerWaveFile->SetValue(wxGetApp().m_txtVoiceKeyerWaveFile);
+}
+
 //-------------------------------------------------------------------------
 // OnCancel()
 //-------------------------------------------------------------------------
index c0bcfcbecd89a980c52139138389839f03b78a3d..70b8ff351bee6267fe5e26f2dcfe7b7742d9bce0 100644 (file)
@@ -52,6 +52,7 @@ class ComPortsDlg : public wxDialog
 
         /* Voice Keyer */
 
+        wxButton     *m_buttonChooseVoiceKeyerWaveFile;
         wxTextCtrl   *m_txtCtrlVoiceKeyerWaveFile;
         wxTextCtrl   *m_txtCtrlVoiceKeyerRxPause;
         wxTextCtrl   *m_txtCtrlVoiceKeyerRepeats;
@@ -88,6 +89,8 @@ protected:
         void PTTUseHamLibClicked(wxCommandEvent& event);
         void PTTUseSerialClicked(wxCommandEvent& event);
 
+        void OnChooseVoiceKeyerWaveFile(wxCommandEvent& event);
+
         void OnOK(wxCommandEvent& event);
         void OnCancel(wxCommandEvent& event);
         void OnApply(wxCommandEvent& event);
index d0b132f5950d6e4555c2767be61b5b8f2670164f..1b3972233d1bdc47dce6f1199631e478efd9cb4b 100644 (file)
@@ -1800,7 +1800,7 @@ void MainFrame::OnPlayFileToMicIn(wxCommandEvent& event)
                 sfInfo.samplerate = FS;
             }
         }
-        g_sfPlayFile = sf_open(soundFile, SFM_READ, &sfInfo);
+        g_sfPlayFile = sf_open(soundFile.c_str(), SFM_READ, &sfInfo);
         if(g_sfPlayFile == NULL)
         {
             wxString strErr = sf_strerror(NULL);
@@ -1877,7 +1877,7 @@ void MainFrame::OnPlayFileFromRadio(wxCommandEvent& event)
                 sfInfo.samplerate = freedv_get_modem_sample_rate(g_pfreedv);
             }
         }
-        g_sfPlayFileFromRadio = sf_open(soundFile, SFM_READ, &sfInfo);
+        g_sfPlayFileFromRadio = sf_open(soundFile.c_str(), SFM_READ, &sfInfo);
         g_sfFs = sfInfo.samplerate;
         if(g_sfPlayFileFromRadio == NULL)
         {
@@ -2015,7 +2015,7 @@ void MainFrame::OnRecFileFromRadio(wxCommandEvent& event)
         }
 #endif
 
-        g_sfRecFile = sf_open(soundFile, SFM_WRITE, &sfInfo);
+        g_sfRecFile = sf_open(soundFile.c_str(), SFM_WRITE, &sfInfo);
         if(g_sfRecFile == NULL)
         {
             wxString strErr = sf_strerror(NULL);