some code for logging debug messages to windows
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 23 Jun 2015 02:28:52 +0000 (02:28 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 23 Jun 2015 02:28:52 +0000 (02:28 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2210 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2-dev/README.Win32 [deleted file]
fdmdv2-dev/README.txt
fdmdv2-dev/src/fdmdv2_main.cpp

diff --git a/fdmdv2-dev/README.Win32 b/fdmdv2-dev/README.Win32
deleted file mode 100644 (file)
index 0fc9182..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-README.Win32\r
-David Rowe 27 Oct 2012\r
-\r
-Debugging Under Windows\r
------------------------\r
-\r
-printfs don't appear until after the program finishes.  wxLogDebug()\r
-works but you need to run DebugView available from\r
-http://www.sysinternals.com to capture the messages.\r
-\r
-Building fdmdv2 & fdmdv-dev for Windows\r
----------------------------------------\r
-\r
-Richard is currently working on a cmake build system for Win32, until\r
-then the approach below is being used by David Rowe.Many variations\r
-are possible:\r
-\r
-1. Install MinGW & the mysys shell\r
-   + pwd -W prints true Win32 directory\r
-   + I also installed emacs, "tortise svn", and "cmake"\r
-\r
-2. "make install" for various packages below put DLLs in /usr/local/lib\r
-   "cd /usr/local/lib; pwd -W" to find the Win32 directory\r
-   add this to the Windows PATH (Control Panel - System - Advanced)\r
-\r
-3. WxWidgets:\r
-   download 2.9.4 tar ball\r
-   mkdir build-debug; cd build-debug\r
-   ./configure --with-msw\r
-   make && make install\r
-\r
-4. PortAudio:\r
-   download latest V19\r
-   ./configure --enable-cxx\r
-   make && make install\r
-\r
-5. libsndfile:\r
-   download lastest source tar ball (not Win32 binaries)\r
-   ./configure && make && make install\r
-\r
-6. libsamplerate:\r
-   download latest source tar ball:\r
-       http://www.mega-nerd.com/SRC/libsamplerate-0.1.8.tar.gz(not Win32 binaries)\r
-   ./configure && make && make install\r
-\r
-7. hamlib\r
-\r
-   I couldn't get this to compile from source, so used the pre-built Win32\r
-   DLLs:\r
-\r
-   Download https://downloads.sourceforge.net/project/hamlib/hamlib/1.2.15.3/hamlib-win32-1.2.15.3.zip\r
-   Open hamlib-win32-1.2.15.3.zip with a GUI archive tool\r
-   Copy hamlib/include/* to /usr/local/include\r
-   Copy hamlib/bin/hamlib*.dll to /usr/local/lib\r
-   Copy hamlib/lib/gcc to /usr/local/lib\r
-\r
-8. sox (used for Filter - EQ)\r
-\r
-   $ wget http://sourceforge.net/projects/sox/files/sox/14.4.0/sox-14.4.0.tar.gz\r
-   $ tar xvzf sox-14.4.0.tar.gz\r
-   $ ./configure --enable-shared=no --without-id3tag --without-png --disable-gomp --with-oggvorbis=no --with-oss=no --with-flac=no --disable-dl-sndfile --with-waveaudio=no\r
-   $ make && make install\r
-\r
-   I couldn't find an install command line that worked, so manually copied the libs and include files.\r
-\r
-9. Speex (we use the DSP lib for noise reduction):\r
-\r
-   $ wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz \r
-   $ tar xvzf speex-1.2rc1.tar.gz\r
-   $ cd speex-1.2rc1\r
-   $ ./configure && make install\r
-     (ignore libogg warnings, we just want libspeexdsp.a)\r
\r
-10. Codec 2\r
-   $ check out codec-dev using tortise svn from:\r
-       wget https://freetel.svn.sourceforge.net/svnroot/freetel/codec2-dev\r
-   $ cd codec2-dev\r
-   $ mkdir build_win32\r
-   $ cd build_win32\r
-   $ cmake -DSPEEXDSP_INCLUDE_DIR=/usr/local/include/ -G "MSYS Makefiles" ..\r
-   $ make\r
-   $ cp src/libcodec2.dll* /usr/local/lib\r
-\r
-11. freedv (dev version)\r
-   $ check out fdmdv2-dev using tortise svn from:\r
-       wget https://freetel.svn.sourceforge.net/svnroot/freetel/fdmdv2-dev\r
-   $ cd fdmdv2-dev/src\r
-   $ make -f Makefile.Win32\r
-\r
index d7faee3c24d97760e02d1b588ffb9451803f6755..54bf87ea792979d415d4a45544300606eb35f42a 100644 (file)
@@ -57,14 +57,14 @@ Quickstart 2
 
 3/ Checkout a fresh copy of codec2-dev and build for Windows, pointing to the generate_codebook built by a linux build of generate_codebook, using this cmake line
 
-  $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../fdmdv2-dev/cmake/Toolchain-Ubuntu-mingw32.cmake -DUNITTEST=FALSE -DGENERATE_CODEBOOK=/home/david/codec2-dev/build_linux/src/generate_codebook
+  $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../fdmdv2-dev/cmake/Toolchain-Ubuntu-mingw32.cmake -DUNITTEST=FALSE -DGENERATE_CODEBOOK=/home/david/codec2-dev/build_linux/src/generate_codebook 
 
 4/ Build WxWidgets
 
   $ cd /path/to/fdmdv2-dev
   $ mkdir build_windows
   $ cd build_windows
-  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE .. -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake
+  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE .. -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DCMAKE_BUILD_TYPE=Debug
   $ make
 
 5/ Download and install the Windows version of Hamlib:
@@ -74,7 +74,7 @@ Quickstart 2
 
 6/ Build All the libraries and FreeDV:
 
-  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SNDFILE=TRUE -DUSE_STATIC_SAMPLERATE=TRUE -DUSE_STATIC_SOX=TRUE -DUSE_STATIC_CODEC2=FALSE -DCODEC2_INCLUDE_DIRS=/home/david/tmp/codec2-dev/src -DCODEC2_LIBRARY=/home/david/tmp/codec2-dev/build_windows/src/libcodec2.dll.a -DHAMLIB_INCLUDE_DIR=hamlib-win32-1.2.15.3/include -DHAMLIB_LIBRARY=hamlib-win32-1.2.15.3/lib/gcc/libhamlib.dll.a ..
+  $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SNDFILE=TRUE -DUSE_STATIC_SAMPLERATE=TRUE -DUSE_STATIC_SOX=TRUE -DUSE_STATIC_CODEC2=FALSE -DCODEC2_INCLUDE_DIRS=/home/david/tmp/codec2-dev/src -DCODEC2_LIBRARY=/home/david/tmp/codec2-dev/build_windows/src/libcodec2.dll.a -DHAMLIB_INCLUDE_DIR=hamlib-win32-1.2.15.3/include -DHAMLIB_LIBRARY=hamlib-win32-1.2.15.3/lib/gcc/libhamlib.dll.a -DCMAKE_BUILD_TYPE=Debug ..
   $ make
 
 ====================================
index 80713ef3aff8e8af1bf64565fc6bf8c7e3ed801c..e31209ef0732dff79ef75b0b657cdd69d21302e2 100644 (file)
@@ -124,6 +124,7 @@ SpeexPreprocessState *g_speex_st;
 // WxWidgets - initialize the application
 IMPLEMENT_APP(MainApp);
 
+FILE *g_logfile;
 
 //-------------------------------------------------------------------------
 // OnInit()
@@ -166,6 +167,7 @@ bool MainApp::OnInit()
     frame->Layout();
     frame->Show();
     g_parent =frame;
+
     return true;
 }
 
@@ -184,6 +186,12 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
 {
     m_zoom              = 1.;
 
+    #ifdef __WXMSW__
+    g_logfile = fopen("log.txt","wt");
+    #else
+    g_logfile = stderr;
+    #endif
+
     SetMinSize(wxSize(400,400));
 
     // Init Hamlib library, but we dont start talking to any rigs yet
@@ -207,14 +215,12 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
 
     // sanitise frame position as a first pass at Win32 registry bug
 
-    printf("x = %d y = %d w = %d h = %d\n", x,y,w,h);
+    fprintf(g_logfile, "x = %d y = %d w = %d h = %d\n", x,y,w,h);
     if (x < 0 || x > 2048) x = 20;
     if (y < 0 || y > 2048) y = 20;
     if (w < 0 || w > 2048) w = 800;
     if (h < 0 || h > 2048) h = 550;
 
-    // note: run DebugView program to see this message under windows
-    //wxLogDebug("x = %d y = %d w = %d h = %d\n", x,y,w,h);
     wxGetApp().m_show_wf            = pConfig->Read(wxT("/MainFrame/show_wf"),           1);
     wxGetApp().m_show_spect         = pConfig->Read(wxT("/MainFrame/show_spect"),        1);
     wxGetApp().m_show_scatter       = pConfig->Read(wxT("/MainFrame/show_scatter"),      1);
@@ -500,6 +506,10 @@ MainFrame::~MainFrame()
     int w;
     int h;
 
+    #ifdef __WXMSW__
+    fclose(g_logfile);
+    #endif
+
     if (optionsDlg != NULL) {
         delete optionsDlg;
         optionsDlg = NULL;
@@ -2126,10 +2136,10 @@ void MainFrame::stopRxStream()
     {
         m_RxRunning = false;
 
-        wxLogDebug("waiting for thread to stop");
+        fprintf(g_logfile, "waiting for thread to stop");
         m_txRxThread->m_run = 0;
         m_txRxThread->Wait();
-        wxLogDebug("thread stopped");
+        fprintf(g_logfile, "thread stopped");
 
         m_rxInPa->stop();
         m_rxInPa->streamClose();