📄 xwaves.c
字号:
/* Copyright (c) 1995 Entropic Research Laboratory, Inc. *//* * This material contains unpublished, proprietary software of * Entropic Research Laboratory, Inc. Any reproduction, distribution, * or publication of this work must be authorized in writing by Entropic * Research Laboratory, Inc., and must bear the notice: * * "Copyright (c) 1987-1990 AT&T, Inc. * "Copyright (c) 1986-1990 Entropic Speech, Inc. * "Copyright (c) 1990-1993 Entropic Research Laboratory, Inc. * All rights reserved" * * The copyright notice above does not evidence any actual or intended * publication of this source code. * * Written by: David Talkin * Checked by: * Revised by: John Shore, Rod Johnson, Alan Parker, ERL * * xwaves.c * a general-purpose speech parameter display program * */static char *sccs_id = "@(#)xwaves.c 1.36 28 Oct 1999 ERL/ATT";#include <stdio.h>#include <esps/esps.h>#include <esps/fea.h>#include <Objects.h>#if !defined(HP400) && !defined(APOLLO_68K) && !defined(DS3100)#include <malloc.h>#endif#include <xview/scrollbar.h>#include <xview/font.h>#include <xview/notice.h>#include <esps/exview.h>#ifndef hpux#include <sys/param.h>#else#define MAXPATHLEN 1024#endif#define SYNTAX USAGE("xwaves [-w wave_pro] [-s] [-n<alternate name>] [-c] [file(s)]...") ;#define REACT_TIME 0.2extern int optind; /* for use of getopt() */extern char *optarg; /* for use of getopt() */extern char *wave_pro; /* .wave_pro file name from command line */extern void repaint();extern void identify_visual();View *create_new_signal_view();char *get_helpfile();static double get_next_time(), get_prev_time();void quit_proc(), doit(), command_proc(), newText_proc(), doub_proc(), show_output_proc(), main_proc();int pause_proc(), resume_proc();int exv_get_help();Notify_value iocatcher(), stdiocatcher();Notify_value destroy_func();Notify_value sigint_func();char *setup_ipc();#if defined(DS3100) || defined(hpux)/* This is an ugly hack because I can't figure out how to fix this correctly on the DS3100 XView port. Without this hack, the aux panels in xvwaves come up black and white.*/Xv_singlecolor ffg, fbg; /* frame foreground/background colors */int dffg = 0x000000, /* default frame foreground color */ dfbg = 0xf0ffff; /* " " background " */#endif/* THE FOLLOWING GLOBALS MAY BE SET FROM <a profile file> */extern char inputname[], /* name of signal input file */ outputname[], /* name of signal output file */ objectname[], /* user-defined object name */ commandname[], /* command name */ init_file[], /* command script for initialization */ funcname[], /* linkage to external process */ wb_spect_params[], nb_spect_params[], overlayname[], def_cm[], def_left_op[], def_middle_op[], def_move_op[];extern int w_verbose;char *savestring(), *basename();extern char wb_spect_params[], nb_spect_params[], cmsname[], def_cm[];FILE *fp_command = NULL; /* file from which commands * are being executed */int command_line = 0; /* line in file being processed */extern scroll_ganged, zoom_ganged, edit_ganged, line_type, /* for plotting waveforms */ ctlwin_x, ctlwin_y, ctlwin_iconized;/* some display creation globals */extern double ref_size, /* size for def. waveform disp.*/ ref_step, /* amount to step in file */ ref_start, /* where reference window display begins */ zoom_ratio;extern int def_w_height, /* dim. of waveform window */ def_w_width, scrollbar_height, readout_bar_height;/* window position parameters */extern int next_x, /* upper left-hand corner of new window */ next_y, w_x_incr, /* increment for next window */ w_y_incr;/* END OF GLOBALS SET FROM CONFIGURATION FILE *//* Args of make command. */extern int new_width, /* dimensions of new window */ new_height;/* Flag to enable debug printout. */int debug_level;/* Waves+ version number */extern char *Version;/* A flag to indicate whether to use the dsp32/VME buss board: */extern int use_dsp32;extern int do_color;Xv_Font def_font;int def_font_height, def_font_width;int menu_item_key; /* key for storing last selected menu item as XV_KEY_DATA for canvas */int file_name_key; /* key for storing selected file name from browser menu as XV_KEY_DATA for canvas */int list_elem_key; /* key for storing list element selected from browser menu as XV_KEY_DATA for canvas */int auxpanel_key; /* key for storing auxiliary control panel list element as XV_KEY_DATA for panel frame */Frame daddy = (Frame)NULL;Panel control_panel;Panel_item attach_panel;Object program = { (char*)NULL, (Signal*)NULL, (Methods*)NULL, (Marks*)NULL, 0, 0, 0, 0, (Object *)NULL,};int child = 0;char *host; /* basename of this program */char *thisprog; /* full runtime name of this program */Notify_value kill_program();Menu spect_menu = (Menu)0, wave_menu = (Menu)0, make_wave_menu(), make_spect_menu();Panel_item help_item, quit_item, newFile_item, newFunct_item, newObj_item, newControl_item, pause_item, resume_item, overlay_item, outputFile_item;/* flags, etc. for interaction with realtime and DSP-32 operations. */extern int da_location, da_done;extern void e_up_down_move_marks(), e_play_between_marks(), menu_operate();int server_mode = 0;char *meth_enable_server();extern int socket_port;extern int use_static_cmap;extern int fullscreendebug;static unsigned int prev_attach_value=0;/*********************************************************************/static void attach_callback(item, value, event) Panel_item item; unsigned int value; Event *event;{ short i, num; unsigned int change, new_value; char *attachment; change = value ^ prev_attach_value; prev_attach_value = value; num = (int) xv_get(item, PANEL_NCHOICES); for (i = 0; i < num; i++) { if (change & 01) { attachment = (char *) xv_get(item, PANEL_CHOICE_STRING, i); if (01 & value) { start_external_function(attachment); } else { terminate(attachment); } } value >>=1; change >>=1; }}/*********************************************************************/void reset_attach_choice(func)char *func;{ unsigned int mask = ~01; unsigned int value, num, i; char *attachment; if (attach_panel) { num = (int) xv_get(attach_panel, PANEL_NCHOICES); value = (unsigned int) xv_get(attach_panel, PANEL_VALUE); for (i = 0; i< num; i++) { attachment = (char *)xv_get(attach_panel, PANEL_CHOICE_STRING, i); if (strcmp(func, attachment) == 0) { value = value & mask; prev_attach_value = value; xv_set(attach_panel, PANEL_VALUE, value, NULL); break; } else mask = (mask << 1) | 1; } return; }}/*********************************************************************/static Panel_item add_attach_choices(panel, xvx, xvy, items) Xv_opaque panel; int xvx, xvy; char *items;{ char *cp, *get_next_item(), choice[100]; Panel_item pi; int i = 0; if(!(items && *items)) items = "xlabel xspectrum"; if(!strcmp(items,"none")) return (int)NULL; cp = items; pi = (Panel_item)xv_create(panel, PANEL_TOGGLE, XV_X, xvx, XV_Y, xvy, PANEL_CHOICE_NROWS, 1, PANEL_LAYOUT, PANEL_HORIZONTAL, PANEL_LABEL_STRING, "Attach:", PANEL_NOTIFY_PROC, attach_callback, PANEL_VALUE, 0, NULL); while(cp && *cp) { sscanf(cp,"%s",choice); xv_set(pi, PANEL_CHOICE_STRING, i, choice, NULL); cp = get_next_item(cp); i++; } return pi;} /*********************************************************************/main(ac, av) int ac; char **av;{ int i; Object *ob; extern Methods bmeth1; extern int command_paused; char frame_label[200]; int ch; /* option letter read by getopt */#ifndef NO_LIC extern void lm_quit();#endif int p_flag=0; extern char attachments[]; extern char *registry_name; char *default_name = "xwaves";#if defined(DS3100) || defined(hpux) ffg.red = (dffg >> 16) & 0xff; /* unpack some colormap values */ ffg.green = (dffg >> 8 ) & 0xff; ffg.blue = dffg & 0xff; fbg.red = (dfbg >> 16) & 0xff; fbg.green = (dfbg >> 8 ) & 0xff; fbg.blue = dfbg & 0xff;#endif check_version(); /* be sure we are running in the correct e/w version*/ fullscreendebug = 1; /* this global inhibits server grabs that cause problems on the SGI */ xv_init(XV_INIT_ARGC_PTR_ARGV, &ac, av, 0); while ((ch = getopt(ac, av, "n:w:sp:cP:V:x:")) != EOF) switch (ch) { case 'n': default_name = optarg; break; case 'w': wave_pro = optarg; /* initialized to ".wave_pro" in globals.c */ break; case 's': server_mode = 1; break; case 'p': server_mode = 1; socket_port = atoi(optarg); p_flag++; break; case 'c': use_static_cmap = 1; break; case 'P': case 'V': fprintf(stderr, "%s%s%s", "The -P and -V options are no longer used, since RPC", " is no longer used in\nxwaves. See the xwaves manual", "and the -n option.\n"); case 'x': debug_level = atoi(optarg); break; default: SYNTAX ; break; } if(!p_flag && getenv("WAVES_PORT")) socket_port = atoi(getenv("WAVES_PORT")); def_font = (Xv_Font) xv_find(XV_NULL, FONT, FONT_FAMILY, FONT_FAMILY_DEFAULT_FIXEDWIDTH, 0); def_font_width = (int) xv_get(def_font, FONT_DEFAULT_CHAR_WIDTH); def_font_height = (int) xv_get(def_font, FONT_DEFAULT_CHAR_HEIGHT); if (debug_level) fprintf(stderr, "default font height %d, width %d.\n", def_font_height, def_font_width); waves_initialize();/*!*//* xv_unique_key unreliable; find better way to pick keys. */ menu_item_key = xv_unique_key(); file_name_key = xv_unique_key(); list_elem_key = xv_unique_key(); auxpanel_key = xv_unique_key(); wave_menu = make_wave_menu(); /* one menu for each generic window */ spect_menu = make_spect_menu(); esps_initialize(); host = basename(av[0]); thisprog = av[0]; child = FALSE; if(do_color) daddy = xv_create(XV_NULL, FRAME,#if defined(DS3100) || defined(hpux) FRAME_FOREGROUND_COLOR, &ffg, FRAME_BACKGROUND_COLOR, &fbg,#endif FRAME_INHERIT_COLORS, FALSE, XV_X, ctlwin_x, XV_Y, ctlwin_y, XV_WIDTH, 665, XV_HEIGHT, 141, FRAME_CLOSED, FALSE, FRAME_SHOW_FOOTER, FALSE, 0); else daddy = xv_create(XV_NULL, FRAME, XV_X, ctlwin_x, XV_Y, ctlwin_y, XV_WIDTH, 665, XV_HEIGHT, 141, FRAME_CLOSED, FALSE, FRAME_SHOW_FOOTER, FALSE, 0); if(!daddy) { printf("Either X needs to be started, or you are out of memory!\n");#ifndef NO_LIC lm_quit();#endif exit(-1); } if (debug_level > 3) XSynchronize((Display *)xv_get(daddy,XV_DISPLAY), True); install_signal_handlers(daddy); notify_interpose_destroy_func(daddy, destroy_func); registry_name = setup_ipc(daddy, default_name);/* export my registry name */ if (registry_name) { char *ptr = (char *)malloc(strlen("WAVES_NAME=")+strlen(registry_name)+3); sprintf(ptr, "WAVES_NAME=%s", registry_name); putenv(ptr); } sprintf(frame_label, "xwaves Multidimensional Signal Display, Version %s (%s)",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -