From: wittend99 Date: Fri, 24 Aug 2012 19:00:49 +0000 (+0000) Subject: git-svn-id: https://svn.code.sf.net/p/freetel/code@638 01035d8c-6547-0410-b346-abe4f9... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=48e04ac224ab9e5b543ddb055a555e44566ea5d2;p=freetel-svn-tracking.git git-svn-id: https://svn.code.sf.net/p/freetel/code@638 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/fdmdv2/src/fdmdv2_main.cpp b/fdmdv2/src/fdmdv2_main.cpp index d2c3df21..69eb7384 100644 --- a/fdmdv2/src/fdmdv2_main.cpp +++ b/fdmdv2/src/fdmdv2_main.cpp @@ -4,8 +4,23 @@ // Purpose: Implements simple wxWidgets application with GUI. // Created: Apr. 9, 2012 // Initial author: David Witten -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #include "fdmdv2_main.h" @@ -32,6 +47,7 @@ static int txCallback( PaStreamCallbackFlags statusFlags, void *userData ); +float av_mag[FDMDV_NSPEC]; // shared between a few classes // initialize the application IMPLEMENT_APP(MainApp); diff --git a/fdmdv2/src/fdmdv2_main.h b/fdmdv2/src/fdmdv2_main.h index 37d36b90..ea068cf8 100644 --- a/fdmdv2/src/fdmdv2_main.h +++ b/fdmdv2/src/fdmdv2_main.h @@ -22,23 +22,10 @@ #include "wx/stopwatch.h" #include "wx/versioninfo.h" #include -#include - -#include "sndfile.h" -#include "portaudio.h" -#include "fdmdv2_pa_wrapper.h" +#include #include "codec2.h" -#include "fdmdv.h" - -#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 +#include "fdmdv.h" #include "topFrame.h" #include "dlg_about.h" @@ -50,14 +37,49 @@ #include "fdmdv2_plot_scatter.h" #include "fdmdv2_plot_waterfall.h" #include "fdmdv2_plot_spectrum.h" +#include "fdmdv2_pa_wrapper.h" +#include "sndfile.h" +#include "portaudio.h" +#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 -}; +}; //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= // Class MainApp diff --git a/fdmdv2/src/fdmdv2_pa_wrapper.cpp b/fdmdv2/src/fdmdv2_pa_wrapper.cpp index d427d4ec..fb4610bc 100644 --- a/fdmdv2/src/fdmdv2_pa_wrapper.cpp +++ b/fdmdv2/src/fdmdv2_pa_wrapper.cpp @@ -1,3 +1,26 @@ +//========================================================================== +// Name: fdmdv2_pa_wrapper.cpp +// Purpose: Implements a wrapper class around the PortAudio library. +// Created: August 12, 2012 +// Initial author: David Witten +// License: +// +// 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 . +// +//========================================================================== #include "fdmdv2_pa_wrapper.h" PortAudioWrap::PortAudioWrap() diff --git a/fdmdv2/src/fdmdv2_pa_wrapper.h b/fdmdv2/src/fdmdv2_pa_wrapper.h index 4177d6fc..0076f5b4 100644 --- a/fdmdv2/src/fdmdv2_pa_wrapper.h +++ b/fdmdv2/src/fdmdv2_pa_wrapper.h @@ -1,3 +1,26 @@ +//========================================================================== +// Name: fdmdv2_pa_wrapper.h +// Purpose: Defines a wrapper class around PortAudio +// Created: August 12, 2012 +// Initial author: David Witten +// License: +// +// 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 . +// +//========================================================================== #include #include #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) diff --git a/fdmdv2/src/fdmdv2_plot.h b/fdmdv2/src/fdmdv2_plot.h index e143278b..a7352d41 100644 --- a/fdmdv2/src/fdmdv2_plot.h +++ b/fdmdv2/src/fdmdv2_plot.h @@ -9,7 +9,7 @@ //========================================================================== #ifndef __FDMDV2_PLOT__ #define __FDMDV2_PLOT__ - + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= // Class DrawPanel //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= diff --git a/fdmdv2/src/fdmdv2_plot_scatter.cpp b/fdmdv2/src/fdmdv2_plot_scatter.cpp index 1b76e64a..97e61e0d 100644 --- a/fdmdv2/src/fdmdv2_plot_scatter.cpp +++ b/fdmdv2/src/fdmdv2_plot_scatter.cpp @@ -4,13 +4,28 @@ // Created: June 24, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #include #include "wx/wx.h" -#include "fdmdv2_main.h" -#include "fdmdv2_plot.h" +//#include "fdmdv2_main.h" +//#include "fdmdv2_plot.h" #include "fdmdv2_plot_scatter.h" BEGIN_EVENT_TABLE(ScatterPlot, DrawPanel) diff --git a/fdmdv2/src/fdmdv2_plot_scatter.h b/fdmdv2/src/fdmdv2_plot_scatter.h index 86b003e1..fa097e5a 100644 --- a/fdmdv2/src/fdmdv2_plot_scatter.h +++ b/fdmdv2/src/fdmdv2_plot_scatter.h @@ -4,12 +4,28 @@ // Created: June 24, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #ifndef __FDMDV2_PLOT_SCATTER__ #define __FDMDV2_PLOT_SCATTER__ - +#include "comp.h" +#include "fdmdv2_main.h" #define SCATTER_MEM (FDMDV_NSYM)*50 #define SCATTER_X_MAX 3.0 diff --git a/fdmdv2/src/fdmdv2_plot_spectrum.cpp b/fdmdv2/src/fdmdv2_plot_spectrum.cpp index dd00b82e..3934971c 100644 --- a/fdmdv2/src/fdmdv2_plot_spectrum.cpp +++ b/fdmdv2/src/fdmdv2_plot_spectrum.cpp @@ -4,8 +4,23 @@ // Created: June 23, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #include #include "wx/wx.h" diff --git a/fdmdv2/src/fdmdv2_plot_spectrum.h b/fdmdv2/src/fdmdv2_plot_spectrum.h index d72da02e..6d150c20 100644 --- a/fdmdv2/src/fdmdv2_plot_spectrum.h +++ b/fdmdv2/src/fdmdv2_plot_spectrum.h @@ -4,8 +4,23 @@ // Created: June 22, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #ifndef __FDMDV2_PLOT_SPECTRUM__ #define __FDMDV2_PLOT_SPECTRUM__ diff --git a/fdmdv2/src/fdmdv2_plot_waterfall.cpp b/fdmdv2/src/fdmdv2_plot_waterfall.cpp index 3685590b..9f96808e 100644 --- a/fdmdv2/src/fdmdv2_plot_waterfall.cpp +++ b/fdmdv2/src/fdmdv2_plot_waterfall.cpp @@ -4,8 +4,23 @@ // Created: June 22, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #include #include "wx/wx.h" @@ -13,6 +28,7 @@ #include "fdmdv2_plot.h" #include "fdmdv2_plot_waterfall.h" +extern float *av_mag; /* Notes: @@ -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; + 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; + int dy; + int dy_blocks; + int bytes_in_row_of_blocks; + int b; + int px; + int py; + int intensity; + unsigned *last_row; + unsigned *pdest; + 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; diff --git a/fdmdv2/src/fdmdv2_plot_waterfall.h b/fdmdv2/src/fdmdv2_plot_waterfall.h index 1b51ea24..2feaac54 100644 --- a/fdmdv2/src/fdmdv2_plot_waterfall.h +++ b/fdmdv2/src/fdmdv2_plot_waterfall.h @@ -4,8 +4,23 @@ // Created: June 22, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #ifndef __FDMDV2_PLOT_WATERFALL__ #define __FDMDV2_PLOT_WATERFALL__ diff --git a/fdmdv2/src/fdmdv2_scalar.cpp b/fdmdv2/src/fdmdv2_scalar.cpp index 968dc9cb..e0ed6cff 100644 --- a/fdmdv2/src/fdmdv2_scalar.cpp +++ b/fdmdv2/src/fdmdv2_scalar.cpp @@ -4,8 +4,23 @@ // Created: June 22, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #include #include "wx/wx.h" diff --git a/fdmdv2/src/fdmdv2_scalar.h b/fdmdv2/src/fdmdv2_scalar.h index 06c005d7..54225201 100644 --- a/fdmdv2/src/fdmdv2_scalar.h +++ b/fdmdv2/src/fdmdv2_scalar.h @@ -4,8 +4,23 @@ // Created: June 22, 2012 // Initial author: David Witten // Derived from: code written by David Rowe -// License: BSD License (other licenses may apply to other -// components of this project) +// License: +// +// 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 . +// //========================================================================== #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[]); ~Scalar(); void add_new_sample(float sample); - + protected: int m_x_max;