2
0

modem_monitor.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. /*
  2. * SpanDSP - a series of DSP components for telephony
  3. *
  4. * modem_monitor.cpp - Display QAM constellations, using the FLTK toolkit.
  5. *
  6. * Written by Steve Underwood <steveu@coppice.org>
  7. *
  8. * Copyright (C) 2004 Steve Underwood
  9. *
  10. * All rights reserved.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2, as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. */
  25. #if defined(HAVE_CONFIG_H)
  26. #include "config.h"
  27. #endif
  28. #if defined(HAVE_FL_FL_H) && defined(HAVE_FL_FL_CARTESIAN_H)
  29. #define __STDC_LIMIT_MACROS
  30. #include <inttypes.h>
  31. #include <stdio.h>
  32. #include <math.h>
  33. #include <stdlib.h>
  34. #include <string.h>
  35. #include <unistd.h>
  36. #include <sys/select.h>
  37. #include <FL/Fl.H>
  38. #include <FL/Fl_Overlay_Window.H>
  39. #include <FL/Fl_Light_Button.H>
  40. #include <FL/Fl_Cartesian.H>
  41. #include <FL/Fl_Audio_Meter.H>
  42. #include <FL/Fl_Output.H>
  43. #include <FL/fl_draw.H>
  44. #include "spandsp.h"
  45. #define SYMBOL_TRACKER_POINTS 12000
  46. #define CARRIER_TRACKER_POINTS 12000
  47. struct qam_monitor_s
  48. {
  49. float constel_scaling;
  50. Fl_Double_Window *w;
  51. Fl_Group *c_const;
  52. Fl_Group *c_right;
  53. Fl_Group *c_eq;
  54. Fl_Group *c_symbol_track;
  55. /* Constellation stuff */
  56. Ca_Canvas *canvas_const;
  57. Ca_X_Axis *sig_i;
  58. Ca_Y_Axis *sig_q;
  59. Ca_Point *constel_point[100000];
  60. int constel_window;
  61. int next_constel_point;
  62. int skip;
  63. /* Equalizer stuff */
  64. Ca_Canvas *canvas_eq;
  65. Ca_X_Axis *eq_x;
  66. Ca_Y_Axis *eq_y;
  67. Ca_Line *eq_re;
  68. Ca_Line *eq_im;
  69. double eq_re_plot[200];
  70. double eq_im_plot[200];
  71. /* Carrier and symbol tracking stuff */
  72. Ca_Canvas *canvas_track;
  73. Ca_X_Axis *track_x;
  74. Ca_Y_Axis *symbol_track_y;
  75. Ca_Y_Axis *carrier_y;
  76. Ca_Line *symbol_track;
  77. Ca_Line *carrier;
  78. float symbol_tracker[SYMBOL_TRACKER_POINTS];
  79. double symbol_track_plot[SYMBOL_TRACKER_POINTS*2];
  80. int symbol_track_points;
  81. int symbol_track_ptr;
  82. int symbol_track_window;
  83. float carrier_tracker[CARRIER_TRACKER_POINTS];
  84. double carrier_plot[CARRIER_TRACKER_POINTS*2];
  85. int carrier_points;
  86. int carrier_ptr;
  87. int carrier_window;
  88. /* Audio meter stuff */
  89. Fl_Audio_Meter *audio_meter;
  90. Fl_Output *audio_level;
  91. int32_t power_reading;
  92. };
  93. #include "modem_monitor.h"
  94. int qam_monitor_clear_constel(qam_monitor_t *s)
  95. {
  96. int i;
  97. s->canvas_const->current(s->canvas_const);
  98. for (i = 0; i < s->constel_window; i++)
  99. {
  100. if (s->constel_point[i])
  101. {
  102. delete s->constel_point[i];
  103. s->constel_point[i] = NULL;
  104. }
  105. }
  106. s->next_constel_point = 0;
  107. Fl::check();
  108. return 0;
  109. }
  110. /*- End of function --------------------------------------------------------*/
  111. int qam_monitor_update_constel(qam_monitor_t *s, const complexf_t *pt)
  112. {
  113. int i;
  114. s->canvas_const->current(s->canvas_const);
  115. if (s->constel_point[s->next_constel_point])
  116. delete s->constel_point[s->next_constel_point];
  117. s->constel_point[s->next_constel_point++] = new Ca_Point(pt->re, pt->im, FL_BLACK);
  118. if (s->next_constel_point >= s->constel_window)
  119. s->next_constel_point = 0;
  120. if (++s->skip >= 100)
  121. {
  122. s->skip = 0;
  123. Fl::check();
  124. }
  125. return 0;
  126. }
  127. /*- End of function --------------------------------------------------------*/
  128. int qam_monitor_update_equalizer(qam_monitor_t *s, const complexf_t *coeffs, int len)
  129. {
  130. int i;
  131. float min;
  132. float max;
  133. /* Protect against screwy values */
  134. for (i = 0; i < len; i++)
  135. {
  136. if (isnan(coeffs[i].re) || isinf(coeffs[i].re))
  137. break;
  138. if (isnan(coeffs[i].im) || isinf(coeffs[i].im))
  139. break;
  140. if (coeffs[i].re < -20.0f || coeffs[i].re > 20.0f)
  141. break;
  142. if (coeffs[i].im < -20.0f || coeffs[i].im > 20.0f)
  143. break;
  144. }
  145. if (i != len)
  146. return -1;
  147. if (s->eq_re)
  148. delete s->eq_re;
  149. if (s->eq_im)
  150. delete s->eq_im;
  151. s->canvas_eq->current(s->canvas_eq);
  152. i = 0;
  153. min = coeffs[i].re;
  154. if (min > coeffs[i].im)
  155. min = coeffs[i].im;
  156. max = coeffs[i].re;
  157. if (max < coeffs[i].im)
  158. max = coeffs[i].im;
  159. for (i = 0; i < len; i++)
  160. {
  161. s->eq_re_plot[2*i] = (i - len/2)/2.0;
  162. s->eq_re_plot[2*i + 1] = coeffs[i].re*s->constel_scaling;
  163. if (min > coeffs[i].re)
  164. min = coeffs[i].re;
  165. if (max < coeffs[i].re)
  166. max = coeffs[i].re;
  167. s->eq_im_plot[2*i] = (i - len/2)/2.0;
  168. s->eq_im_plot[2*i + 1] = coeffs[i].im*s->constel_scaling;
  169. if (min > coeffs[i].im)
  170. min = coeffs[i].im;
  171. if (max < coeffs[i].im)
  172. max = coeffs[i].im;
  173. }
  174. s->eq_x->minimum(-len/4.0);
  175. s->eq_x->maximum(len/4.0);
  176. s->eq_y->maximum((max == min) ? max + 0.2 : max);
  177. s->eq_y->minimum(min);
  178. s->eq_re = new Ca_Line(len, s->eq_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
  179. s->eq_im = new Ca_Line(len, s->eq_im_plot, 0, 0, FL_RED, CA_NO_POINT);
  180. Fl::check();
  181. return 0;
  182. }
  183. /*- End of function --------------------------------------------------------*/
  184. int qam_monitor_update_int_equalizer(qam_monitor_t *s, const complexi16_t *coeffs, int len)
  185. {
  186. int i;
  187. float min;
  188. float max;
  189. if (s->eq_re)
  190. delete s->eq_re;
  191. if (s->eq_im)
  192. delete s->eq_im;
  193. s->canvas_eq->current(s->canvas_eq);
  194. i = 0;
  195. min = coeffs[i].re;
  196. if (min > coeffs[i].im)
  197. min = coeffs[i].im;
  198. max = coeffs[i].re;
  199. if (max < coeffs[i].im)
  200. max = coeffs[i].im;
  201. for (i = 0; i < len; i++)
  202. {
  203. if (min > coeffs[i].re)
  204. min = coeffs[i].re;
  205. if (max < coeffs[i].re)
  206. max = coeffs[i].re;
  207. s->eq_re_plot[2*i] = (i - len/2)/2.0f;
  208. s->eq_re_plot[2*i + 1] = coeffs[i].re*s->constel_scaling;
  209. if (min > coeffs[i].im)
  210. min = coeffs[i].im;
  211. if (max < coeffs[i].im)
  212. max = coeffs[i].im;
  213. s->eq_im_plot[2*i] = (i - len/2)/2.0f;
  214. s->eq_im_plot[2*i + 1] = coeffs[i].im*s->constel_scaling;
  215. }
  216. min *= s->constel_scaling;
  217. max *= s->constel_scaling;
  218. s->eq_x->minimum(-len/4.0);
  219. s->eq_x->maximum(len/4.0);
  220. s->eq_y->maximum((max == min) ? max + 0.2 : max);
  221. s->eq_y->minimum(min);
  222. s->eq_re = new Ca_Line(len, s->eq_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
  223. s->eq_im = new Ca_Line(len, s->eq_im_plot, 0, 0, FL_RED, CA_NO_POINT);
  224. Fl::check();
  225. return 0;
  226. }
  227. /*- End of function --------------------------------------------------------*/
  228. int qam_monitor_update_symbol_tracking(qam_monitor_t *s, float total_correction)
  229. {
  230. int i;
  231. int j;
  232. float min;
  233. float max;
  234. s->symbol_tracker[s->symbol_track_ptr++] = total_correction;
  235. if (s->symbol_track_points < SYMBOL_TRACKER_POINTS)
  236. s->symbol_track_points++;
  237. if (s->symbol_track_ptr >= SYMBOL_TRACKER_POINTS)
  238. s->symbol_track_ptr = 0;
  239. s->canvas_track->current(s->canvas_track);
  240. if (s->symbol_track)
  241. delete s->symbol_track;
  242. s->track_x->current();
  243. s->symbol_track_y->current();
  244. min =
  245. max = s->symbol_tracker[0];
  246. for (i = s->symbol_track_ptr, j = 0; i < s->symbol_track_points; i++, j++)
  247. {
  248. if (min > s->symbol_tracker[i])
  249. min = s->symbol_tracker[i];
  250. if (max < s->symbol_tracker[i])
  251. max = s->symbol_tracker[i];
  252. s->symbol_track_plot[2*j] = j;
  253. s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i];
  254. }
  255. for (i = 0; i < s->symbol_track_ptr; i++, j++)
  256. {
  257. if (min > s->symbol_tracker[i])
  258. min = s->symbol_tracker[i];
  259. if (max < s->symbol_tracker[i])
  260. max = s->symbol_tracker[i];
  261. s->symbol_track_plot[2*j] = j;
  262. s->symbol_track_plot[2*j + 1] = s->symbol_tracker[i];
  263. }
  264. s->symbol_track_y->maximum((fabs(max - min) < 0.05) ? max + 0.05 : max);
  265. s->symbol_track_y->minimum(min);
  266. s->symbol_track = new Ca_Line(s->symbol_track_points, s->symbol_track_plot, 0, 0, FL_RED, CA_NO_POINT);
  267. //Fl::check();
  268. return 0;
  269. }
  270. /*- End of function --------------------------------------------------------*/
  271. int qam_monitor_update_audio_level(qam_monitor_t *s, const int16_t amp[], int len)
  272. {
  273. int i;
  274. char buf[11];
  275. double val;
  276. for (i = 0; i < len; i++)
  277. {
  278. s->audio_meter->sample(amp[i]/32768.0);
  279. s->power_reading += ((amp[i]*amp[i] - s->power_reading) >> 10);
  280. }
  281. val = 10.0*log10((double) s->power_reading/(32767.0*32767.0) + 1.0e-10) + 3.14 + 3.02;
  282. snprintf(buf, sizeof(buf), "%5.1fdBm0", val);
  283. s->audio_level->value(buf);
  284. return 0;
  285. }
  286. /*- End of function --------------------------------------------------------*/
  287. int qam_monitor_update_carrier_tracking(qam_monitor_t *s, float carrier_freq)
  288. {
  289. int i;
  290. int j;
  291. float min;
  292. float max;
  293. s->carrier_tracker[s->carrier_ptr++] = carrier_freq;
  294. if (s->carrier_points < CARRIER_TRACKER_POINTS)
  295. s->carrier_points++;
  296. if (s->carrier_ptr >= CARRIER_TRACKER_POINTS)
  297. s->carrier_ptr = 0;
  298. s->canvas_track->current(s->canvas_track);
  299. if (s->carrier)
  300. delete s->carrier;
  301. s->track_x->current();
  302. s->carrier_y->current();
  303. min =
  304. max = s->carrier_tracker[0];
  305. for (i = s->carrier_ptr, j = 0; i < s->carrier_points; i++, j++)
  306. {
  307. s->carrier_plot[2*j] = j;
  308. s->carrier_plot[2*j + 1] = s->carrier_tracker[i];
  309. if (min > s->carrier_tracker[i])
  310. min = s->carrier_tracker[i];
  311. if (max < s->carrier_tracker[i])
  312. max = s->carrier_tracker[i];
  313. }
  314. for (i = 0; i < s->carrier_ptr; i++, j++)
  315. {
  316. s->carrier_plot[2*j] = j;
  317. s->carrier_plot[2*j + 1] = s->carrier_tracker[i];
  318. if (min > s->carrier_tracker[i])
  319. min = s->carrier_tracker[i];
  320. if (max < s->carrier_tracker[i])
  321. max = s->carrier_tracker[i];
  322. }
  323. s->carrier_y->maximum((fabs(max - min) < 0.05) ? max + 0.05 : max);
  324. s->carrier_y->minimum(min);
  325. s->carrier = new Ca_Line(s->carrier_points, s->carrier_plot, 0, 0, FL_BLUE, CA_NO_POINT);
  326. //Fl::check();
  327. return 0;
  328. }
  329. /*- End of function --------------------------------------------------------*/
  330. qam_monitor_t *qam_monitor_init(float constel_width, float constel_scaling, const char *tag)
  331. {
  332. char buf[132 + 1];
  333. float x;
  334. float y;
  335. qam_monitor_t *s;
  336. if ((s = (qam_monitor_t *) malloc(sizeof(*s))) == NULL)
  337. return NULL;
  338. s->w = new Fl_Double_Window(905, 400, (tag) ? tag : "QAM monitor");
  339. s->constel_scaling = 1.0/constel_scaling;
  340. s->c_const = new Fl_Group(0, 0, 380, 400);
  341. s->c_const->box(FL_DOWN_BOX);
  342. s->c_const->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
  343. s->canvas_const = new Ca_Canvas(60, 30, 300, 300, "Constellation");
  344. s->canvas_const->box(FL_PLASTIC_DOWN_BOX);
  345. s->canvas_const->color(7);
  346. s->canvas_const->align(FL_ALIGN_TOP);
  347. s->canvas_const->border(15);
  348. s->sig_i = new Ca_X_Axis(65, 330, 290, 30, "I");
  349. s->sig_i->align(FL_ALIGN_BOTTOM);
  350. s->sig_i->minimum(-constel_width);
  351. s->sig_i->maximum(constel_width);
  352. s->sig_i->label_format("%g");
  353. s->sig_i->minor_grid_color(fl_gray_ramp(20));
  354. s->sig_i->major_grid_color(fl_gray_ramp(15));
  355. s->sig_i->label_grid_color(fl_gray_ramp(10));
  356. s->sig_i->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  357. s->sig_i->minor_grid_style(FL_DOT);
  358. s->sig_i->major_step(5);
  359. s->sig_i->label_step(1);
  360. s->sig_i->axis_color(FL_BLACK);
  361. s->sig_i->axis_align(CA_BOTTOM | CA_LINE);
  362. s->sig_q = new Ca_Y_Axis(20, 35, 40, 290, "Q");
  363. s->sig_q->align(FL_ALIGN_LEFT);
  364. s->sig_q->minimum(-constel_width);
  365. s->sig_q->maximum(constel_width);
  366. s->sig_q->minor_grid_color(fl_gray_ramp(20));
  367. s->sig_q->major_grid_color(fl_gray_ramp(15));
  368. s->sig_q->label_grid_color(fl_gray_ramp(10));
  369. //s->sig_q->grid_visible(CA_MINOR_TICK | CA_MAJOR_TICK | CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  370. s->sig_q->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  371. s->sig_q->minor_grid_style(FL_DOT);
  372. s->sig_q->major_step(5);
  373. s->sig_q->label_step(1);
  374. s->sig_q->axis_color(FL_BLACK);
  375. s->sig_q->current();
  376. s->c_const->end();
  377. s->c_right = new Fl_Group(440, 0, 465, 405);
  378. s->c_eq = new Fl_Group(380, 0, 265, 200);
  379. s->c_eq->box(FL_DOWN_BOX);
  380. s->c_eq->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
  381. s->c_eq->current();
  382. s->canvas_eq = new Ca_Canvas(460, 35, 150, 100, "Equalizer");
  383. s->canvas_eq->box(FL_PLASTIC_DOWN_BOX);
  384. s->canvas_eq->color(7);
  385. s->canvas_eq->align(FL_ALIGN_TOP);
  386. Fl_Group::current()->resizable(s->canvas_eq);
  387. s->canvas_eq->border(15);
  388. s->eq_x = new Ca_X_Axis(465, 135, 140, 30, "Symbol");
  389. s->eq_x->align(FL_ALIGN_BOTTOM);
  390. s->eq_x->minimum(-8.0);
  391. s->eq_x->maximum(8.0);
  392. s->eq_x->label_format("%g");
  393. s->eq_x->minor_grid_color(fl_gray_ramp(20));
  394. s->eq_x->major_grid_color(fl_gray_ramp(15));
  395. s->eq_x->label_grid_color(fl_gray_ramp(10));
  396. s->eq_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  397. s->eq_x->minor_grid_style(FL_DOT);
  398. s->eq_x->major_step(5);
  399. s->eq_x->label_step(1);
  400. s->eq_x->axis_align(CA_BOTTOM | CA_LINE);
  401. s->eq_x->axis_color(FL_BLACK);
  402. s->eq_x->current();
  403. s->eq_y = new Ca_Y_Axis(420, 40, 40, 90, "Amp");
  404. s->eq_y->align(FL_ALIGN_LEFT);
  405. s->eq_y->minimum(-0.1);
  406. s->eq_y->maximum(0.1);
  407. s->eq_y->minor_grid_color(fl_gray_ramp(20));
  408. s->eq_y->major_grid_color(fl_gray_ramp(15));
  409. s->eq_y->label_grid_color(fl_gray_ramp(10));
  410. s->eq_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  411. s->eq_y->minor_grid_style(FL_DOT);
  412. s->eq_y->major_step(5);
  413. s->eq_y->label_step(1);
  414. s->eq_y->axis_color(FL_BLACK);
  415. s->eq_y->current();
  416. s->c_eq->end();
  417. s->c_symbol_track = new Fl_Group(380, 200, 525, 200);
  418. s->c_symbol_track->box(FL_DOWN_BOX);
  419. s->c_symbol_track->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
  420. s->c_symbol_track->current();
  421. s->canvas_track = new Ca_Canvas(490, 235, 300, 100, "Symbol and carrier tracking");
  422. s->canvas_track->box(FL_PLASTIC_DOWN_BOX);
  423. s->canvas_track->color(7);
  424. s->canvas_track->align(FL_ALIGN_TOP);
  425. Fl_Group::current()->resizable(s->canvas_track);
  426. s->canvas_track->border(15);
  427. s->track_x = new Ca_X_Axis(495, 335, 290, 30, "Time (symbols)");
  428. s->track_x->align(FL_ALIGN_BOTTOM);
  429. s->track_x->minimum(0.0);
  430. s->track_x->maximum(2400.0*5.0);
  431. s->track_x->label_format("%g");
  432. s->track_x->minor_grid_color(fl_gray_ramp(20));
  433. s->track_x->major_grid_color(fl_gray_ramp(15));
  434. s->track_x->label_grid_color(fl_gray_ramp(10));
  435. s->track_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  436. s->track_x->minor_grid_style(FL_DOT);
  437. s->track_x->major_step(5);
  438. s->track_x->label_step(1);
  439. s->track_x->axis_align(CA_BOTTOM | CA_LINE);
  440. s->track_x->axis_color(FL_BLACK);
  441. s->track_x->current();
  442. s->symbol_track_y = new Ca_Y_Axis(420, 240, 70, 90, "Cor");
  443. s->symbol_track_y->align(FL_ALIGN_LEFT);
  444. s->symbol_track_y->minimum(-0.1);
  445. s->symbol_track_y->maximum(0.1);
  446. s->symbol_track_y->minor_grid_color(fl_gray_ramp(20));
  447. s->symbol_track_y->major_grid_color(fl_gray_ramp(15));
  448. s->symbol_track_y->label_grid_color(fl_gray_ramp(10));
  449. s->symbol_track_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  450. s->symbol_track_y->minor_grid_style(FL_DOT);
  451. s->symbol_track_y->major_step(5);
  452. s->symbol_track_y->label_step(1);
  453. s->symbol_track_y->axis_color(FL_RED);
  454. s->symbol_track_y->current();
  455. s->carrier_y = new Ca_Y_Axis(790, 240, 70, 90, "Freq");
  456. s->carrier_y->align(FL_ALIGN_RIGHT);
  457. s->carrier_y->minimum(-0.1);
  458. s->carrier_y->maximum(0.1);
  459. s->carrier_y->minor_grid_color(fl_gray_ramp(20));
  460. s->carrier_y->major_grid_color(fl_gray_ramp(15));
  461. s->carrier_y->label_grid_color(fl_gray_ramp(10));
  462. s->carrier_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
  463. s->carrier_y->minor_grid_style(FL_DOT);
  464. s->carrier_y->major_step(5);
  465. s->carrier_y->label_step(1);
  466. s->carrier_y->axis_align(CA_RIGHT);
  467. s->carrier_y->axis_color(FL_BLUE);
  468. s->carrier_y->current();
  469. s->c_symbol_track->end();
  470. s->audio_meter = new Fl_Audio_Meter(672, 10, 16, 150, "");
  471. s->audio_meter->box(FL_PLASTIC_UP_BOX);
  472. s->audio_meter->type(FL_VERT_AUDIO_METER);
  473. s->audio_level = new Fl_Output(650, 170, 60, 20, "");
  474. s->audio_level->textsize(10);
  475. s->c_right->end();
  476. Fl_Group::current()->resizable(s->c_right);
  477. s->w->end();
  478. s->w->show();
  479. s->next_constel_point = 0;
  480. s->constel_window = 10000;
  481. s->carrier_points = 0;
  482. s->carrier_ptr = 0;
  483. s->carrier_window = 100;
  484. s->symbol_track_points = 0;
  485. s->symbol_track_window = 10000;
  486. Fl::check();
  487. return s;
  488. }
  489. /*- End of function --------------------------------------------------------*/
  490. void qam_wait_to_end(qam_monitor_t *s)
  491. {
  492. fd_set rfds;
  493. int res;
  494. struct timeval tv;
  495. fprintf(stderr, "Processing complete. Press the <enter> key to end\n");
  496. do
  497. {
  498. usleep(100000);
  499. Fl::check();
  500. FD_ZERO(&rfds);
  501. FD_SET(0, &rfds);
  502. tv.tv_usec = 100000;
  503. tv.tv_sec = 0;
  504. res = select(1, &rfds, NULL, NULL, &tv);
  505. }
  506. while (res <= 0);
  507. }
  508. /*- End of function --------------------------------------------------------*/
  509. #endif
  510. /*- End of file ------------------------------------------------------------*/