From eb15daa025b2017016745a701c87e7aaa97a7940 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Mon, 26 Nov 2012 20:43:08 +0000 Subject: [PATCH] number of secords to record from radio hard coded for Win32 as I cant read number of secs from dialog ctrl git-svn-id: https://svn.code.sf.net/p/freetel/code@1077 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2/src/Makefile.win32 | 3 +++ fdmdv2/src/fdmdv2_main.cpp | 18 +++++++++++++----- fdmdv2/src/fdmdv2_main.h | 8 +++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/fdmdv2/src/Makefile.win32 b/fdmdv2/src/Makefile.win32 index 7735a056..6896eb93 100644 --- a/fdmdv2/src/Makefile.win32 +++ b/fdmdv2/src/Makefile.win32 @@ -41,6 +41,9 @@ freedv: $(OBJS) %.o: %.cpp $(HDRS) Makefile.win32 g++ $(CPP_FLAGS) -c $< -o $@ +%.o: %.c $(HDRS) Makefile.win32 + g++ $(CPP_FLAGS) -c $< -o $@ + clean: rm -f *.o fdmdv2 diff --git a/fdmdv2/src/fdmdv2_main.cpp b/fdmdv2/src/fdmdv2_main.cpp index e2341096..82420397 100644 --- a/fdmdv2/src/fdmdv2_main.cpp +++ b/fdmdv2/src/fdmdv2_main.cpp @@ -923,6 +923,7 @@ void MainFrame::OnPlayFileToMicIn(wxCommandEvent& event) } // extra panel added to file save dialog to set number of seconds to record for + MyExtraRecFilePanel::MyExtraRecFilePanel(wxWindow *parent): wxPanel(parent) { wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); @@ -982,8 +983,8 @@ void MainFrame::OnRecFileFromRadio(wxCommandEvent& event) wxString fileName, extension; soundFile = openFileDialog.GetPath(); wxFileName::SplitPath(soundFile, &wxGetApp().m_recFileFromRadioPath, &fileName, &extension); - //wxLogDebug("m_recFileFromRadioPath: %s", wxGetApp().m_recFileFromRadioPath); - //wxLogDebug("sounfFile: %s", soundFile); + wxLogDebug("m_recFileFromRadioPath: %s", wxGetApp().m_recFileFromRadioPath); + wxLogDebug("soundFile: %s", soundFile); sfInfo.format = 0; if(!extension.IsEmpty()) @@ -1010,22 +1011,29 @@ void MainFrame::OnRecFileFromRadio(wxCommandEvent& event) return; } - + // Bug: on Win32 I cant read m_recFileFromRadioSecs, so have hard coded it + #ifdef __WIN32__ + long secs = wxGetApp().m_recFileFromRadioSecs; + g_recFromRadioSamples = FS*(unsigned int)secs; + #else // work out number of samples to record wxWindow * const ctrl = openFileDialog.GetExtraControl(); wxString secsString = static_cast(ctrl)->getSecondsToRecord(); + wxLogDebug("test: %s secsString: %s\n", wxT("testing 123"), secsString); + long secs; if (secsString.ToLong(&secs)) { wxGetApp().m_recFileFromRadioSecs = (unsigned int)secs; - //printf(" secondsToRecord: %d\n", (unsigned int)secs); + printf(" secondsToRecord: %d\n", (unsigned int)secs); g_recFromRadioSamples = FS*(unsigned int)secs; - //printf("g_recFromRadioSamples: %d\n", g_recFromRadioSamples); + printf("g_recFromRadioSamples: %d\n", g_recFromRadioSamples); } else { wxMessageBox(wxT("Invalid number of Seconds"), wxT("Record File From Radio"), wxOK); return; } + #endif g_sfRecFile = sf_open(soundFile, SFM_WRITE, &sfInfo); if(g_sfRecFile == NULL) diff --git a/fdmdv2/src/fdmdv2_main.h b/fdmdv2/src/fdmdv2_main.h index 96c8e48f..c9e4099d 100644 --- a/fdmdv2/src/fdmdv2_main.h +++ b/fdmdv2/src/fdmdv2_main.h @@ -208,8 +208,14 @@ class MyExtraRecFilePanel : public wxPanel { public: MyExtraRecFilePanel(wxWindow *parent); + ~MyExtraRecFilePanel() { + wxLogDebug("Destructor\n"); + } void setSecondsToRecord(wxString value) { m_secondsToRecord->SetValue(value); } - wxString getSecondsToRecord(void) { return m_secondsToRecord->GetValue(); } + wxString getSecondsToRecord(void) { + wxLogDebug("getSecondsToRecord: %s\n",m_secondsToRecord->GetValue()); + return m_secondsToRecord->GetValue(); + } private: wxTextCtrl *m_secondsToRecord; }; -- 2.25.1