AR := ar rcus\r
CXX := g++\r
CC := gcc\r
-CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -DSVN_REVISION=\"647\" $(Preprocessors)\r
-CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -DSVN_REVISION=\"647\" $(Preprocessors)\r
+CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -DSVN_REVISION=\"658\" $(Preprocessors)\r
+CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -DSVN_REVISION=\"658\" $(Preprocessors)\r
\r
\r
##\r
wxMessageBox(wxT("Tx Stream Start Error."), wxT("Error"), wxOK);\r
return;\r
}
-// OnTogBtnOnOff->SetLabel(wxT("Stop"));\r
}\r
}\r
\r
m_TxRunning = false;\r
m_txPa->stop();\r
m_txPa->streamClose();\r
-// OnTogBtnOnOff->SetLabel(wxT("Start"));\r
}\r
}\r
\r
{\r
m_TxRunning = false;\r
m_txPa->abort();\r
-// OnTogBtnOnOff->SetLabel(wxT("Start"));\r
}\r
}\r
\r
{
public:
MainFrame(wxWindow *parent);
- virtual ~MainFrame();
+ virtual ~MainFrame();\r
+
PlotPanel* m_panelDefaultA;\r
PlotPanel* m_panelDefaultB;\r
PlotSpectrum* m_panelSpectrum;\r
PaError m_rxErr;
PaError m_txErr;
wxSound *m_sound;
+ float av_mag[FDMDV_NSPEC];\r
void DoStartThread();\r
void DoPauseThread();\r
char buf[15];\r
wxString s;\r
\r
- // Draw a filled rectangle with aborder\r
- wxBrush ltBlueBrush = wxBrush(LIGHT_BLUE_COLOR);\r
- dc.SetBrush(ltBlueBrush);\r
- dc.SetPen(wxPen(BLACK_COLOR, 1));\r
- dc.DrawRectangle(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_w, m_h);\r
-\r
// Vertical gridlines\r
dc.SetPen(m_penShortDash);\r
for(p = (PLOT_BORDER + XLEFT_OFFSET + GRID_INCREMENT); p < m_w; p += GRID_INCREMENT)\r
m_w = m_rectGrid.GetWidth();\r
\r
dc.Clear();\r
+\r
+ // Draw a filled rectangle with aborder\r
+ wxBrush ltBlueBrush = wxBrush(LIGHT_BLUE_COLOR);\r
+ dc.SetBrush(ltBlueBrush);\r
+ dc.SetPen(wxPen(BLACK_COLOR, 1));\r
+ dc.DrawRectangle(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_w, m_h);\r
+\r
drawGraticule(dc);\r
}\r
\r
{\r
public:\r
PlotPanel(wxFrame* parent);\r
- void paintEvent(wxPaintEvent & evt);\r
- void draw(wxAutoBufferedPaintDC& dc);\r
- void drawGraticule(wxAutoBufferedPaintDC& dc);\r
- wxPen m_penShortDash;\r
- wxPen m_penDotDash;\r
- wxRect m_rectCtrl;\r
- wxRect m_rectGrid;\r
- wxRect m_rectPlot;\r
-// int m_gridLeftOffset;\r
-// int m_gridRightOffset;\r
-// int m_gridTopOffset;\r
-// int m_gridBottomOffset;\r
- double m_label_size;\r
- wxSize m_Bufsz;\r
- wxBitmap *m_bmp;\r
- wxImagePixelData *m_pBmp;\r
- //wxNativePixelData *m_pBmp;\r
- //wxAlphaPixelData *m_pBmp;\r
+ void paintEvent(wxPaintEvent & evt);\r
+ void draw(wxAutoBufferedPaintDC& dc);\r
+ void drawGraticule(wxAutoBufferedPaintDC& dc);\r
+ wxPen m_penShortDash;\r
+ wxPen m_penDotDash;\r
+ wxRect m_rectCtrl;\r
+ wxRect m_rectGrid;\r
+ wxRect m_rectPlot;\r
+// int m_gridLeftOffset;\r
+// int m_gridRightOffset;\r
+// int m_gridTopOffset;\r
+// int m_gridBottomOffset;\r
+ double m_label_size;\r
+ wxSize m_Bufsz;\r
+ wxBitmap *m_bmp;\r
+ wxImagePixelData *m_pBmp;\r
+ //wxNativePixelData *m_pBmp;\r
+ //wxAlphaPixelData *m_pBmp;\r
\r
// some useful events\r
void OnMouseMove(wxMouseEvent& event);\r
void OnClose(wxCloseEvent& event ){ event.Skip(); }
void OnSize( wxSizeEvent& event );\r
void OnErase(wxEraseEvent& event);\r
- void OnPaint(wxPaintEvent& event);
+ void OnPaint(wxPaintEvent& event);\r
+
double SetZoomFactor(double zf);\r
double GetZoomFactor(double zf);\r
//void OnUpdateUI( wxUpdateUIEvent& event ){ event.Skip(); }\r
char buf[15];\r
wxString s;\r
\r
- // Draw a filled rectangle with aborder\r
- wxBrush ltBlueBrush = wxBrush(LIGHT_YELLOW_COLOR);\r
- dc.SetBrush(ltBlueBrush);\r
- dc.SetPen(wxPen(BLACK_COLOR, 1));\r
- dc.DrawRectangle(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_w, m_h);\r
-\r
// Vertical gridlines\r
dc.SetPen(m_penShortDash);\r
for(p = (PLOT_BORDER + XLEFT_OFFSET + GRID_INCREMENT); p < m_w; p += GRID_INCREMENT)\r
dc.DrawText(buf, p - PLOT_BORDER + XLEFT_OFFSET, m_h + YBOTTOM_OFFSET/2);\r
}\r
// Label the Y-Axis\r
- //for(p = GRID_INCREMENT; p < (h - YBOTTOM_OFFSET); p += GRID_INCREMENT)\r
for(p = (m_h - GRID_INCREMENT); p > PLOT_BORDER; p -= GRID_INCREMENT)\r
{\r
sprintf(buf, "%1.0f", (double)((m_h - p) * -10));\r
m_w = m_rectGrid.GetWidth();\r
\r
dc.Clear();\r
+\r
+ // Draw a filled rectangle with aborder\r
+ wxBrush ltBlueBrush = wxBrush(LIGHT_YELLOW_COLOR);\r
+ dc.SetBrush(ltBlueBrush);\r
+ dc.SetPen(wxPen(BLACK_COLOR, 1));\r
+ dc.DrawRectangle(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_w, m_h);\r
+\r
drawGraticule(dc);\r
/*
Fl_Box::draw();
PlotWaterfall::PlotWaterfall(wxFrame* parent): PlotPanel(parent)\r
{
int i;
-
+\r
+ m_bmp = new wxBitmap(MAX_BMP_X, MAX_BMP_Y, wxBITMAP_SCREEN_DEPTH);
for(i = 0; i < 255; i++)
{
- heatmap_lut[i] = heatmap((float)i, 0.0, 255.0);
+ m_heatmap_lut[i] = heatmap((float)i, 0.0, 255.0);
}
- greyscale = 0;
+ m_greyscale = 0;
SetLabelSize(10.0);\r
m_Bufsz = GetMaxClientSize();
};
//----------------------------------------------------------------\r
PlotWaterfall::~PlotWaterfall()
{
-// if(m_bmp->IsOk())\r
-// {\r
-// delete m_bmp;\r
-// }
+ if(!m_bmp->IsNull())\r
+ {\r
+ delete m_bmp;\r
+ }
}
\r
/*\r
m_bmp = new wxBitmap(w, h, wxBITMAP_SCREEN_DEPTH);\r
//m_pBmp = m_bmp->GetBitmapData();\r
}
-// pixel_buf = new unsigned[buf_sz];
+// m_pixel_buf = new unsigned[buf_sz];
// for(i = 0; i < buf_sz; i++)
// {
-// pixel_buf[i] = 0;
+// m_pixel_buf[i] = 0;
// }\r
}
char buf[15];\r
wxString s;\r
\r
-// int h = m_rectGrid.GetHeight();\r
-// int w = m_rectGrid.GetWidth();\r
-\r
- // Draw a filled rectangle with aborder\r
- wxBrush ltBlueBrush = wxBrush(LIGHT_RED_COLOR);\r
- dc.SetBrush(ltBlueBrush);\r
- dc.SetPen(wxPen(BLACK_COLOR, 1));\r
- dc.DrawRectangle(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_w, m_h);\r
-\r
// Vertical gridlines\r
dc.SetPen(m_penShortDash);\r
for(p = (PLOT_BORDER + XLEFT_OFFSET + GRID_INCREMENT); p < m_w; p += GRID_INCREMENT)\r
m_w = m_rectGrid.GetWidth();\r
\r
dc.Clear();\r
+\r
+ // Draw a filled rectangle with aborder\r
+ wxBrush ltBlueBrush = wxBrush(LIGHT_RED_COLOR);\r
+ dc.SetBrush(ltBlueBrush);\r
+ dc.SetPen(wxPen(BLACK_COLOR, 1));\r
+ dc.DrawRectangle(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_w, m_h);\r
+\r
drawGraticule(dc);\r
\r
/* detect resizing of window */
new_pixel_buf(m_w, m_h);
}\r
*/\r
-/*\r
+\r
// determine dy, the height of one "block"
px_per_sec = (float)m_h / WATERFALL_SECS_Y;
dy = DT * px_per_sec;
bytes_in_row_of_blocks = dy * m_w * sizeof(unsigned);
for(b = 0; b < dy_blocks - 1; b++)
{
- pdest = pixel_buf + b * m_w * dy;
- psrc = pixel_buf + (b + 1) * m_w * dy;
+ pdest = m_pixel_buf + b * m_w * dy;
+ psrc = m_pixel_buf + (b + 1) * m_w * dy;
memcpy(pdest, psrc, bytes_in_row_of_blocks);
}
// create a new row of blocks at bottom
spec_index_per_px = (float)FDMDV_NSPEC / (float) m_w;
intensity_per_dB = (float)256 /(MAX_DB - MIN_DB);
- last_row = pixel_buf + dy *(dy_blocks - 1)* m_w;
+ last_row = m_pixel_buf + dy *(dy_blocks - 1)* m_w;
for(px = 0; px < m_w; px++)
{
index = px * spec_index_per_px;
{
intensity = 0;
}
- if (greyscale)
+ if (m_greyscale)
{
for(py = 0; py < dy; py++)
{
{
for(py = 0; py < dy; py++)
{
- last_row[px + py * m_w] = heatmap_lut[intensity];
+ last_row[px + py * m_w] = m_heatmap_lut[intensity];
}
}
}\r
-*/\r
+\r
// update bit map
- //fl_draw_image((unsigned char*)pixel_buf, m_x, m_y, m_w, m_h, 4, 0);\r
+ //fl_draw_image((unsigned char*)m_pixel_buf, m_x, m_y, m_w, m_h, 4, 0);\r
//dc.DrawLines(4, m_pBmp, 0, 0 );
}
#include "fdmdv2_plot.h"\r
#include "fdmdv2_defines.h"\r
\r
+#define MAX_ZOOM 7\r
+#define MAX_BMP_X (400 * MAX_ZOOM)\r
+#define MAX_BMP_Y (400 * MAX_ZOOM)\r
+\r
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\r
// Class PlotWaterfall\r
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=\r
~PlotWaterfall();\r
protected:
- unsigned *pixel_buf;
- unsigned heatmap_lut[256];
- int greyscale;
+ unsigned *m_pixel_buf;
+ unsigned m_heatmap_lut[256];
+ int m_greyscale;
\r
unsigned heatmap(float val, float min, float max);
\r
#include "codec2.h"
//-- Globals: Eliminate!! --------------------------------
-char *fin_name = NULL;
-char *fout_name = NULL;
-char *sound_dev_name = NULL;
-FILE *fin = NULL;
-FILE *fout = NULL;
-struct FDMDV *fdmdv;
+//char *fin_name = NULL;
+//char *fout_name = NULL;
+//char *sound_dev_name = NULL;
+//FILE *fin = NULL;
+//FILE *fout = NULL;
+struct FDMDV *fdmdv_state;
struct CODEC2 *codec2;
//float av_mag[FDMDV_NSPEC]; // shared between a few classes
extern float *av_mag;\r
short input_buf[2*FDMDV_NOM_SAMPLES_PER_FRAME];
int n_input_buf = 0;
int nin = FDMDV_NOM_SAMPLES_PER_FRAME;
-short *output_buf;
+short *output_buf;
int n_output_buf = 0;
int codec_bits[2*FDMDV_BITS_PER_FRAME];
int state = 0;
} paCallBackData;
//----------------------------------------------------------------
-//
+// per_frame_rx_processing()
//----------------------------------------------------------------
void per_frame_rx_processing(
- short output_buf[], /* output buf of decoded speech samples */
- int *n_output_buf, /* how many samples currently in output_buf[] */
- int codec_bits[], /* current frame of bits for decoder */
- short input_buf[], /* input buf of modem samples input to demod */
- int *n_input_buf, /* how many samples currently in input_buf[] */
- int *nin, /* amount of samples demod needs for next call */
- int *state, /* used to collect codec_bits[] halves */
- struct CODEC2 *c2 /* Codec 2 states */
+ short output_buf[], /* output buf of decoded speech samples */
+ int *n_output_buf, /* how many samples currently in output_buf[] */
+ int codec_bits[], /* current frame of bits for decoder */
+ short input_buf[], /* input buf of modem samples input to demod */
+ int *n_input_buf, /* how many samples currently in input_buf[] */
+ int *nin, /* amount of samples demod needs for next call */
+ int *state, /* used to collect codec_bits[] halves */
+ struct CODEC2 *c2 /* Codec 2 states */
)
{
- struct FDMDV_STATS stats;
- int sync_bit;
- float rx_fdm[FDMDV_MAX_SAMPLES_PER_FRAME];
- int rx_bits[FDMDV_BITS_PER_FRAME];
- unsigned char packed_bits[BYTES_PER_CODEC_FRAME];
- float rx_spec[FDMDV_NSPEC];
- int i, nin_prev, bit, byte;
- int next_state;
+ struct FDMDV_STATS stats;
+ int sync_bit;
+ float rx_fdm[FDMDV_MAX_SAMPLES_PER_FRAME];
+ int rx_bits[FDMDV_BITS_PER_FRAME];
+ unsigned char packed_bits[BYTES_PER_CODEC_FRAME];
+ float rx_spec[FDMDV_NSPEC];
+ int i;\r
+ int nin_prev;\r
+ int bit;\r
+ int byte;
+ int next_state;
assert(*n_input_buf <= (2 * FDMDV_NOM_SAMPLES_PER_FRAME));
while(*n_input_buf >= *nin)
{
// demod per frame processing
- for(i=0; i<*nin; i++)
+ for(i = 0; i < *nin; i++)
{
rx_fdm[i] = (float)input_buf[i]/FDMDV_SCALE;
}
nin_prev = *nin;
- fdmdv_demod(fdmdv, rx_bits, &sync_bit, rx_fdm, nin);
+ fdmdv_demod(fdmdv_state, rx_bits, &sync_bit, rx_fdm, nin);
*n_input_buf -= nin_prev;
assert(*n_input_buf >= 0);
}
// compute rx spectrum & get demod stats, and update GUI plot data
- fdmdv_get_rx_spectrum(fdmdv, rx_spec, rx_fdm, nin_prev);
- fdmdv_get_demod_stats(fdmdv, &stats);
+ fdmdv_get_rx_spectrum(fdmdv_state, rx_spec, rx_fdm, nin_prev);
+ fdmdv_get_demod_stats(fdmdv_state, &stats);
new_data(rx_spec);
// aScatter->add_new_samples(stats.rx_symbols);
// aTimingEst->add_new_sample(stats.rx_timing);
{
case 0:
// mute output audio when out of sync
- if(*n_output_buf < 2*codec2_samples_per_frame(c2) - N8)
+ if(*n_output_buf < 2 * codec2_samples_per_frame(c2) - N8)
{
- for(i=0; i<N8; i++)
+ for(i=0; i<N8; i++)\r
+ {
output_buf[*n_output_buf + i] = 0;
-
+ }
*n_output_buf += N8;
}
- assert(*n_output_buf <= (2*codec2_samples_per_frame(c2)));
+ assert(*n_output_buf <= (2 * codec2_samples_per_frame(c2)));
if((stats.fest_coarse_fine == 1) && (stats.snr_est > 3.0))
{
next_state = 1;
{
next_state = 2;
// first half of frame of codec bits
- memcpy(codec_bits, rx_bits, FDMDV_BITS_PER_FRAME*sizeof(int));
+ memcpy(codec_bits, rx_bits, FDMDV_BITS_PER_FRAME * sizeof(int));
}
else
{
// second half of frame of codec bits
memcpy(&codec_bits[FDMDV_BITS_PER_FRAME], rx_bits, FDMDV_BITS_PER_FRAME*sizeof(int));
// pack bits, MSB received first
- bit = 7;
+ bit = 7;
byte = 0;
memset(packed_bits, 0, BYTES_PER_CODEC_FRAME);
- for(i=0; i<BITS_PER_CODEC_FRAME; i++)
+ for(i = 0; i < BITS_PER_CODEC_FRAME; i++)
{
packed_bits[byte] |= (codec_bits[i] << bit);
bit--;
codec2_decode(c2, &output_buf[*n_output_buf], packed_bits);
*n_output_buf += codec2_samples_per_frame(c2);
}
- assert(*n_output_buf <= (2*codec2_samples_per_frame(c2)));
+ assert(*n_output_buf <= (2 * codec2_samples_per_frame(c2)));
}
break;
}
{
int i;
- for(i=0; i<FDMDV_NSPEC; i++)
+ for(i = 0; i < FDMDV_NSPEC; i++)
{
- av_mag[i] = (1.0 - BETA)*av_mag[i] + BETA*mag_dB[i];
+ av_mag[i] = (1.0 - BETA) * av_mag[i] + BETA * mag_dB[i];
}
}
// is not doing GUI work. We use this function for providing file
// input to update the GUI when simulating real time operation.
//----------------------------------------------------------------
+/*
void idle(void*)
{
-/*
int ret, i;
if(fin_name != NULL)
{
// simulate time delay from real world A/D input, and pause betwen
// screen updates
usleep(20000);
-*/
}
-
+*/
+\r
+/*
//----------------------------------------------------------------
// This routine will be called by the PortAudio engine when audio
// is available.
//----------------------------------------------------------------
-static int callback(const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData)
+static int callback(\r
+ const void *inputBuffer,\r
+ void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData\r
+ )
{
paCallBackData *cbData = (paCallBackData*)userData;
unsigned int i;
in8k[i] = in8k[i+N8];
}
assert(outputBuffer != NULL);
- /* write signal to both channels */
+ // write signal to both channels
for(i = 0; i < N48; i++)
{
out48k_short[i] = (short)out48k[i];
wptr[1] = out48k_short[i];
}
return paContinue;
-}
-
+}\r
+*/
+/*
//----------------------------------------------------------------
// arg_callback()
//----------------------------------------------------------------
}
return 0;
}
+*/\r