// 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
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
#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
+//==========================================================================\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()
+//==========================================================================\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"
// 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)
//==========================================================================\r
#ifndef __FDMDV2_PLOT__
#define __FDMDV2_PLOT__
-
+\r
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\r
// Class DrawPanel\r
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\r
// 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
// 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
// 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
// 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__
// 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
#include "fdmdv2_plot.h"\r
#include "fdmdv2_plot_waterfall.h"
\r
+extern float *av_mag;\r
/*\r
\r
Notes:\r
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))
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;
// 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__
// 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
// 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__
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