From: drowe67 Date: Mon, 14 Sep 2015 22:34:37 +0000 (+0000) Subject: added file chooser for Vocei Keyer X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=312067b2c22c3d27804104662b066a80edec41f0;p=freetel-svn-tracking.git added file chooser for Vocei Keyer git-svn-id: https://svn.code.sf.net/p/freetel/code@2330 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freedv-dev/src/dlg_ptt.cpp b/freedv-dev/src/dlg_ptt.cpp index f9a88ce6..2b8f6ec9 100644 --- a/freedv-dev/src/dlg_ptt.cpp +++ b/freedv-dev/src/dlg_ptt.cpp @@ -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() //------------------------------------------------------------------------- diff --git a/freedv-dev/src/dlg_ptt.h b/freedv-dev/src/dlg_ptt.h index c0bcfcbe..70b8ff35 100644 --- a/freedv-dev/src/dlg_ptt.h +++ b/freedv-dev/src/dlg_ptt.h @@ -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); diff --git a/freedv-dev/src/fdmdv2_main.cpp b/freedv-dev/src/fdmdv2_main.cpp index d0b132f5..1b397223 100644 --- a/freedv-dev/src/fdmdv2_main.cpp +++ b/freedv-dev/src/fdmdv2_main.cpp @@ -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);