~ubuntu-branches/debian/sid/twpsk/sid

« back to all changes in this revision

Viewing changes to user-twpsk/savedir/twpskDisp.h

  • Committer: Bazaar Package Importer
  • Author(s): Joop Stakenborg
  • Date: 2001-12-12 08:24:32 UTC
  • Revision ID: james.westby@ubuntu.com-20011212082432-tamea6jb427pt8lv
Tags: upstream-2.0
ImportĀ upstreamĀ versionĀ 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* twpsk  - A gui application for PSK
 
2
 * Copyright (C) 1999 Ted Williams WA0EIR (ted_williams@HP.com)
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License as
 
6
 * published by the Free Software Foundation; either version 2 of
 
7
 * the License, or (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be
 
10
 * useful, but WITHOUT ANY WARRANTY; without even the implied
 
11
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 
12
 * PURPOSE.  See the GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public
 
15
 * License along with this program; if not, write to the Free
 
16
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
 
17
 * USA.
 
18
 *
 
19
 * Version: 2.0 - Aug 2001
 
20
 */
 
21
 
 
22
/*
 
23
 * Disp class header file
 
24
 */
 
25
#ifndef INCLUDED_TWPSKDISP
 
26
#define INCLUDED_TWPSKDISP
 
27
 
 
28
#include "GUI.h"
 
29
 
 
30
#define MAX_GRAYS   100
 
31
#define START 150
 
32
#define MAX_SAMPLES 8192                 /* max sample buffer size */
 
33
#define MAX_FFT (MAX_SAMPLES / 2) + 1
 
34
#define WF 1
 
35
#define SA 0
 
36
#define LINE_WIDTH 2                     /* keep it even */
 
37
 
 
38
class Disp {
 
39
   private:
 
40
 
 
41
      Display *display;
 
42
      Window window;
 
43
      int screen;
 
44
      Colormap cmap;
 
45
      GC gc;
 
46
      Cursor wfCursor;
 
47
 
 
48
      XColor dispPix[MAX_GRAYS];
 
49
      XColor redPix, defPix;
 
50
 
 
51
      int values[DISPLAY_WIDTH][DISPLAY_HEIGHT];
 
52
 
 
53
      int displayFlag;
 
54
 
 
55
      int cnt;                         /* Sample counter */
 
56
      int samples;                     /* Size of the sample */
 
57
      int speed;                       /* Speed scale value 0 -> 100 */
 
58
      int ffts;                        /* Number of filters */
 
59
      float fc;                        /* Center freq of display */
 
60
      float deltaf;                    /* Hz per fft sample */
 
61
      int delta;                       /* Offset into fft samples */
 
62
      float max;                       /* Max value in values? */
 
63
      int maxi;                        /* Index to max */
 
64
      int row;                         /* Row in circular buffer */
 
65
      float scaleFactor;               /* Scale factor for values */
 
66
 
 
67
      /* for IMD */
 
68
      int upperSig;
 
69
      int lowerSig;
 
70
      int upperIMD;
 
71
      int lowerIMD;
 
72
 
 
73
#if 0
 
74
      inline float sqr(float arg)
 
75
      {
 
76
         return arg * arg;
 
77
      }
 
78
 
 
79
      inline void swap (float &a, float &b)
 
80
      {
 
81
         float t = a; a = b; b = t;
 
82
      }
 
83
#endif
 
84
      void IMDcalc(float val[]);
 
85
      void mkPoints (float buffer[]);
 
86
      void drawDisplay(void);
 
87
 
 
88
      unsigned long get_mask_color(int color, unsigned long mask);
 
89
      void find_visual_info(int *truecolor, XVisualInfo *vinf);
 
90
 
 
91
   public:
 
92
      int brightness;
 
93
   
 
94
      void fft_setup (int samps, int overlap);
 
95
      void setup (Widget wfDA);
 
96
      void offset (float freq);
 
97
      void getFFT (float *val, int len);
 
98
      float new_fc (int x);
 
99
      int find_center (int x);
 
100
 
 
101
      void changeDisplay (int val)
 
102
      {
 
103
         displayFlag = val;
 
104
      }
 
105
 
 
106
      int getsamplecnt()
 
107
      {
 
108
          return samples;
 
109
      }
 
110
 
 
111
      void  set_samples(int samps)
 
112
      {
 
113
         fft_setup (512 * samps, -1);
 
114
      }
 
115
 
 
116
      void setFFTspeed (int val)
 
117
      {
 
118
         speed = val;
 
119
      }
 
120
};
 
121
#endif