git-svn-id: https://svn.code.sf.net/p/freetel/code@638 01035d8c-6547-0410-b346-abe4f9...
authorwittend99 <wittend99@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 24 Aug 2012 19:00:49 +0000 (19:00 +0000)
committerwittend99 <wittend99@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 24 Aug 2012 19:00:49 +0000 (19:00 +0000)
13 files changed:
fdmdv2/src/fdmdv2_main.cpp
fdmdv2/src/fdmdv2_main.h
fdmdv2/src/fdmdv2_pa_wrapper.cpp
fdmdv2/src/fdmdv2_pa_wrapper.h
fdmdv2/src/fdmdv2_plot.h
fdmdv2/src/fdmdv2_plot_scatter.cpp
fdmdv2/src/fdmdv2_plot_scatter.h
fdmdv2/src/fdmdv2_plot_spectrum.cpp
fdmdv2/src/fdmdv2_plot_spectrum.h
fdmdv2/src/fdmdv2_plot_waterfall.cpp
fdmdv2/src/fdmdv2_plot_waterfall.h
fdmdv2/src/fdmdv2_scalar.cpp
fdmdv2/src/fdmdv2_scalar.h

index d2c3df21cf29ccf3f57b26b57ba17e0f2ff7833d..69eb73840a7a511768659b07c2db408eb518dba4 100644 (file)
@@ -4,8 +4,23 @@
 // Purpose:         Implements simple wxWidgets application with GUI.\r
 // Created:         Apr. 9, 2012
 // Initial author:  David Witten\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #include "fdmdv2_main.h"\r
 \r
@@ -32,6 +47,7 @@ static int txCallback(
                         PaStreamCallbackFlags statusFlags,\r
                         void *userData\r
                      );\r
+float  av_mag[FDMDV_NSPEC];                  // shared between a few classes
 \r
 // initialize the application\r
 IMPLEMENT_APP(MainApp);\r
index 37d36b904b393e0dc6ef3c104cde86900e46d5c2..ea068cf89131b75f2f25c7185af8a7ac38027922 100644 (file)
 #include "wx/stopwatch.h"
 #include "wx/versioninfo.h"
 #include <wx/sound.h>
-#include <wx/thread.h>
-\r
-#include "sndfile.h"\r
-#include "portaudio.h"
-#include "fdmdv2_pa_wrapper.h"
+#include <wx/thread.h>\r
 \r
 #include "codec2.h"
-#include "fdmdv.h"
-\r
-#define MIN_DB             -40.0\r
-#define MAX_DB               0.0\r
-#define BETA                 0.1  // constant for time averageing spectrum data\r
-#define MIN_HZ               0\r
-#define MAX_HZ            4000\r
-#define WATERFALL_SECS_Y     5    // number of seconds respresented by y axis of waterfall\r
-#define DT                   0.02 // time between samples\r
-#define FS                8000    // FDMDV modem sample rate\r
+#include "fdmdv.h"\r
 \r
 #include "topFrame.h"
 #include "dlg_about.h"\r
 #include "fdmdv2_plot_scatter.h"
 #include "fdmdv2_plot_waterfall.h"
 #include "fdmdv2_plot_spectrum.h"
+#include "fdmdv2_pa_wrapper.h"
+#include "sndfile.h"\r
+#include "portaudio.h"
 \r
+#define MIN_DB             -40.0
+#define MAX_DB               0.0
+#define BETA                 0.1  // constant for time averageing spectrum data
+#define MIN_HZ               0
+#define MAX_HZ            4000
+#define WATERFALL_SECS_Y     5    // number of seconds respresented by y axis of waterfall
+#define DT                   0.02 // time between samples
+#define FS                8000    // FDMDV modem sample rate
+
+#define SCATTER_MEM       (FDMDV_NSYM)*50
+#define SCATTER_X_MAX        3.0
+#define SCATTER_Y_MAX        3.0
+
+// main window params
+
+#define W                  1200
+#define W3                 (W/3)
+#define H                  600
+#define H2                 (H/2)
+#define SP                  20
+
+// sound card
+
+#define SAMPLE_RATE         48000                          // 48 kHz sampling rate rec. as we can trust accuracy of sound card
+#define N8                  FDMDV_NOM_SAMPLES_PER_FRAME    // processing buffer size at 8 kHz
+#define MEM8                (FDMDV_OS_TAPS/FDMDV_OS)
+#define N48                 (N8*FDMDV_OS)                  // processing buffer size at 48 kHz
+#define NUM_CHANNELS        2                              // I think most sound cards prefer stereo we will convert to mono
+
+#define BITS_PER_CODEC_FRAME (2*FDMDV_BITS_PER_FRAME)
+#define BYTES_PER_CODEC_FRAME (BITS_PER_CODEC_FRAME/8)
+
 enum
 {
     ID_ROTATE_LEFT = wxID_HIGHEST + 1,
     ID_ROTATE_RIGHT,
     ID_RESIZE,
     ID_PAINT_BG
-};
+};\r
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\r
 // Class MainApp\r
index d427d4ecd9d92d2e632abc3b54cb8886349cea4e..fb4610bc81186032af0d389242e4ac8c7b784599 100644 (file)
@@ -1,3 +1,26 @@
+//==========================================================================\r
+// Name:            fdmdv2_pa_wrapper.cpp\r
+// Purpose:         Implements a wrapper class around the PortAudio library.\r
+// Created:         August 12, 2012
+// Initial author:  David Witten\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================\r
 #include "fdmdv2_pa_wrapper.h"
 
 PortAudioWrap::PortAudioWrap()
index 4177d6fc08966dc32c3fe858ff48d6db72e687f2..0076f5b48c6ab5deb977bd31fbce23a1c1c6b24d 100644 (file)
@@ -1,3 +1,26 @@
+//==========================================================================\r
+// Name:            fdmdv2_pa_wrapper.h\r
+// Purpose:         Defines a wrapper class around PortAudio\r
+// Created:         August 12, 2012
+// Initial author:  David Witten\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
+//==========================================================================\r
 #include <stdio.h>
 #include <math.h>
 #include "portaudio.h"
@@ -5,7 +28,7 @@
 // Note that many of the older ISA sound cards on PCs do NOT support
 // full duplex audio (simultaneous record and playback).
 // And some only support full duplex at lower sample rates.
-#define SAMPLE_RATE         (44100)
+//#define SAMPLE_RATE         (44100)
 #define PA_SAMPLE_TYPE      paFloat32       //paInt16
 #define FRAMES_PER_BUFFER   (64)
 
index e143278bfe4ec0b410adbb92cea7d9c924800f33..a7352d416ef1319db930bec8de3f298e3bebc63f 100644 (file)
@@ -9,7 +9,7 @@
 //==========================================================================\r
 #ifndef __FDMDV2_PLOT__
 #define __FDMDV2_PLOT__
-
+\r
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\r
 // Class DrawPanel\r
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\r
index 1b76e64aa00b99158e28aa795fef45d9a9fc7ba0..97e61e0ddcba4c92be68939c4965e47773f546fd 100644 (file)
@@ -4,13 +4,28 @@
 // Created:         June 24, 2012\r
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #include <string.h>\r
 #include "wx/wx.h"\r
-#include "fdmdv2_main.h"\r
-#include "fdmdv2_plot.h"\r
+//#include "fdmdv2_main.h"\r
+//#include "fdmdv2_plot.h"\r
 #include "fdmdv2_plot_scatter.h"\r
 \r
 BEGIN_EVENT_TABLE(ScatterPlot, DrawPanel)\r
index 86b003e18ce0097e67b55b32246566829030aa65..fa097e5a652d8d65674f16260d77d66174a4e1f9 100644 (file)
@@ -4,12 +4,28 @@
 // Created:         June 24, 2012
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #ifndef __FDMDV2_PLOT_SCATTER__
 #define __FDMDV2_PLOT_SCATTER__
-
+#include "comp.h"\r
+#include "fdmdv2_main.h"\r
 \r
 #define SCATTER_MEM       (FDMDV_NSYM)*50\r
 #define SCATTER_X_MAX        3.0\r
index dd00b82e207c33187e3bc53ee264c6b9f9a8a4cf..3934971c02353aef43ab048b6df5905e14a03e87 100644 (file)
@@ -4,8 +4,23 @@
 // Created:         June 23, 2012\r
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #include <string.h>\r
 #include "wx/wx.h"\r
index d72da02eab8bc75f692587efcf84f616efcbadad..6d150c209257662d5b3f010232aa25140939b752 100644 (file)
@@ -4,8 +4,23 @@
 // Created:         June 22, 2012
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #ifndef __FDMDV2_PLOT_SPECTRUM__
 #define __FDMDV2_PLOT_SPECTRUM__
index 3685590bb87a38020c2f49f35359b05d3cefe5a8..9f96808ef56688f1f0c03027464548f851ef54d8 100644 (file)
@@ -4,8 +4,23 @@
 // Created:         June 22, 2012
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #include <string.h>\r
 #include "wx/wx.h"\r
@@ -13,6 +28,7 @@
 #include "fdmdv2_plot.h"\r
 #include "fdmdv2_plot_waterfall.h"
 \r
+extern float *av_mag;\r
 /*\r
 \r
   Notes:\r
@@ -111,11 +127,20 @@ unsigned Waterfall::heatmap(float val, float min, float max)
 
 void Waterfall::draw()
 {
-    float  spec_index_per_px, intensity_per_dB;
+    float  spec_index_per_px;\r
+    float  intensity_per_dB;
     int    px_per_sec;
-    int    index, dy, dy_blocks, bytes_in_row_of_blocks, b;
-    int    px, py, intensity;
-    unsigned *last_row, *pdest, *psrc;
+    int    index;\r
+    int    dy;\r
+    int    dy_blocks;\r
+    int    bytes_in_row_of_blocks;\r
+    int    b;
+    int    px;\r
+    int    py;\r
+    int    intensity;
+    unsigned *last_row;\r
+    unsigned *pdest;\r
+    unsigned *psrc;
 
     /* detect resizing of window */
     if ((m_h != m_prev_h) || (m_w != m_prev_w))
@@ -143,8 +168,8 @@ void Waterfall::draw()
     last_row = pixel_buf + dy *(dy_blocks - 1)* m_w;
     for(px = 0; px < m_w; px++)
     {
-//        index = px*spec_index_per_px;
-//        intensity = intensity_per_dB * (av_mag[index] - MIN_DB);
+        index = px * spec_index_per_px;
+        intensity = intensity_per_dB * (av_mag[index] - MIN_DB);
         if (intensity > 255)
         {
             intensity = 255;
index 1b51ea24689f8e1fefcda7bce91e7e5dcc693bba..2feaac54b7925b9ca44de4516c26f8a21fede886 100644 (file)
@@ -4,8 +4,23 @@
 // Created:         June 22, 2012
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #ifndef __FDMDV2_PLOT_WATERFALL__
 #define __FDMDV2_PLOT_WATERFALL__
index 968dc9cbc2b7d2e3f45991f1c013362f0103145e..e0ed6cff80f8c28b6010219b8fb03c8323200bba 100644 (file)
@@ -4,8 +4,23 @@
 // Created:         June 22, 2012
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #include <string.h>\r
 #include "wx/wx.h"\r
index 06c005d71d5def9a9dd560441219c6412af841f1..5422520186da93c598428db677be369b4ad09f4d 100644 (file)
@@ -4,8 +4,23 @@
 // Created:         June 22, 2012
 // Initial author:  David Witten\r
 // Derived from:    code written by David Rowe\r
-// License:         BSD License (other licenses may apply to other\r
-//                  components of this project)\r
+// License:\r
+//\r
+//  Copyright (C) 2012 David Witten
+//
+//  All rights reserved.
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU Lesser General Public License version 2.1,
+//  as published by the Free Software Foundation.  This program is
+//  distributed in the hope that it will be useful, but WITHOUT ANY
+//  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+//  License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public License
+//  along with this program; if not, see <http://www.gnu.org/licenses/>.
+//
 //==========================================================================\r
 #ifndef __FDMDV2_PLOT_SCALAR__
 #define __FDMDV2_PLOT_SCALAR__
@@ -21,7 +36,7 @@ public:
     Scalar(wxFrame* parent, int x, int y, int w, int h, int x_max_, int y_max_, const char name[]);\r
     ~Scalar();\r
     void add_new_sample(float sample);\r
-    \r
+\r
 protected:\r
 \r
     int    m_x_max;\r