3 * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "loadbalance.h"
28 #include "pluginclient.h"
29 #include "recordmonitor.inc"
30 #include "scopewindow.inc"
34 SCOPE_HISTOGRAM, SCOPE_HISTOGRAM_RGB,
35 SCOPE_WAVEFORM, SCOPE_WAVEFORM_RGB, SCOPE_WAVEFORM_PLY,
39 // Number of divisions in histogram.
40 // 65536 + min and max range to speed up the tabulation
41 #define TOTAL_BINS 0x13333
42 #define HIST_SECTIONS 4
43 #define FLOAT_RANGE 1.2
44 // Minimum value in percentage
45 #define HISTOGRAM_MIN -10
46 #define FLOAT_MIN -0.1
47 // Maximum value in percentage
48 #define HISTOGRAM_MAX 110
51 #define MIN_SCOPE_W xS(640)
52 #define MIN_SCOPE_H yS(320)
55 #define WAVEFORM_DIVISIONS 12
56 #define VECTORSCOPE_DIVISIONS 11
58 class ScopePackage : public LoadPackage
66 class ScopeUnit : public LoadClient
69 ScopeUnit(ScopeGUI *gui, ScopeEngine *server);
70 void process_package(LoadPackage *package);
71 int bins[HIST_SECTIONS][TOTAL_BINS];
75 class ScopeEngine : public LoadServer
78 ScopeEngine(ScopeGUI *gui, int cpus);
79 virtual ~ScopeEngine();
81 LoadClient* new_client();
82 LoadPackage* new_package();
87 class ScopePanel : public BC_SubWindow
90 ScopePanel(ScopeGUI *gui, int x, int y, int w, int h);
91 void create_objects();
92 virtual void update_point(int x, int y);
93 virtual void draw_point();
94 virtual void clear_point();
95 int button_press_event();
96 int cursor_motion_event();
97 int button_release_event();
102 class ScopeWaveform : public ScopePanel
105 ScopeWaveform(ScopeGUI *gui, int x, int y, int w, int h);
106 virtual void update_point(int x, int y);
107 virtual void draw_point();
108 virtual void clear_point();
114 class ScopeVectorscope : public ScopePanel
117 ScopeVectorscope(ScopeGUI *gui, int x, int y, int w, int h);
118 virtual void update_point(int x, int y);
119 virtual void draw_point();
120 virtual void clear_point();
125 class ScopeHistogram : public ScopePanel
128 ScopeHistogram(ScopeGUI *gui, int x, int y, int w, int h);
130 void update_point(int x, int y);
132 void draw(int flash, int flush);
133 void draw_mode(int mode, int color, int y, int h);
138 class ScopeScopesOn : public BC_MenuItem
141 ScopeScopesOn(ScopeMenu *scope_menu, const char *text, int id);
144 ScopeMenu *scope_menu;
148 class ScopeMenu : public BC_PopupMenu
151 ScopeMenu(ScopeGUI *gui, int x, int y);
152 void create_objects();
153 void update_toggles();
156 ScopeScopesOn *hist_on;
157 ScopeScopesOn *hist_rgb_on;
158 ScopeScopesOn *wave_on;
159 ScopeScopesOn *wave_rgb_on;
160 ScopeScopesOn *wave_ply_on;
161 ScopeScopesOn *vect_on;
164 class ScopeWaveDial : public BC_FPot
167 ScopeWaveDial(ScopeGUI *gui, int x, int y);
172 class ScopeVectDial : public BC_FPot
175 ScopeVectDial(ScopeGUI *gui, int x, int y);
180 class ScopeGUI : public PluginClientWindow
183 ScopeGUI(Theme *theme, int x, int y, int w, int h, int cpus);
184 ScopeGUI(PluginClient *plugin, int w, int h);
188 virtual void create_objects();
189 void create_panels();
190 virtual int resize_event(int w, int h);
191 virtual int translation_event();
192 virtual void update_scope() {}
194 // Called for user storage when toggles change
195 virtual void toggle_event();
198 void update_toggles();
199 void calculate_sizes(int w, int h);
200 void allocate_vframes();
201 void draw_overlays(int overlays, int borders, int flush);
202 void process(VFrame *output_frame);
203 void draw(int flash, int flush);
204 void clear_points(int flash);
207 VFrame *output_frame;
209 VFrame *waveform_vframe;
210 VFrame *vector_vframe;
211 ScopeHistogram *histogram;
212 ScopeWaveform *waveform;
213 ScopeVectorscope *vectorscope;
214 ScopeMenu *scope_menu;
215 ScopeWaveDial *wave_dial;
216 ScopeVectDial *vect_dial;
217 BC_Title *value_text;
220 int vector_x, vector_y, vector_w, vector_h;
221 int wave_x, wave_y, wave_w, wave_h;
222 int hist_x, hist_y, hist_w, hist_h;
226 int use_hist, use_wave, use_vector;
227 int use_hist_parade, use_wave_parade;
229 int bins[HIST_SECTIONS][TOTAL_BINS];