⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 erldemo.c

📁 speech signal process tools
💻 C
📖 第 1 页 / 共 3 页
字号:
    xv_set(con_panel, 	   WIN_BACKGROUND_COLOR, CMS_CONTROL_COLORS + EC_GRAY,	   WIN_FOREGROUND_COLOR, CMS_CONTROL_COLORS + EC_BLACK,	   NULL);  }  /* put up a two lines of text*/  message = xv_create(con_panel, PANEL_MESSAGE,		      XV_X, 64,		      XV_Y, 8,		      XV_WIDTH, 233,		      XV_HEIGHT, 13,		      PANEL_LABEL_STRING, "Entropic Research Laboratory, Inc.",		      PANEL_LABEL_BOLD, TRUE,		      NULL);  if (do_color) xv_set(message, 		       PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_RED,		       NULL);  message = xv_create(con_panel, PANEL_MESSAGE,		      XV_X, 20,		      XV_Y, 32,		      XV_WIDTH, 327,		      XV_HEIGHT, 13,		      PANEL_LABEL_STRING, "Unix Signal Processing Software Demonstration",		      PANEL_LABEL_BOLD, TRUE,		      NULL);  if (do_color) xv_set(message, 		       PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_FIREBRICK,		       NULL);  /* put up top panel buttons */  button = (Panel_item) xv_create(con_panel, PANEL_BUTTON,				      XV_X, 11,				      XV_Y, 60,				      XV_WIDTH, 127,				      XV_HEIGHT, 25,				      PANEL_LABEL_STRING, "About this demo...",				      PANEL_CLIENT_DATA, about_file,				      PANEL_NOTIFY_PROC, display_about,				      NULL);  if (do_color)     xv_set(button, PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);  button = (Panel_item) xv_create(con_panel, PANEL_BUTTON,				      XV_X, 155,				      XV_Y, 60,				      XV_WIDTH, 156,				      XV_HEIGHT, 25,				      PANEL_LABEL_STRING, "For more information...",				      PANEL_CLIENT_DATA, info_file,				      PANEL_NOTIFY_PROC, display_info,				      NULL);  if (do_color)     xv_set(button, PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);  button = xv_create(con_panel, PANEL_BUTTON,		       XV_X, 320,		       XV_Y, 60,		       XV_WIDTH, 44,		       XV_HEIGHT, 25,		       PANEL_CLIENT_DATA, frame,		       PANEL_LABEL_STRING,  "Exit",		       PANEL_NOTIFY_PROC,   exit_proc,		       NULL);  if (do_color)     xv_set(button, PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);/*  window_fit_height(con_panel);*/  DEBUG(1) (stderr, "Leaving create_info_panel\n");  return(con_panel);}Panelcreate_control_panel(frame, demo_com, wtry_com, 		     mach_type, demo_choices, tryflag, silent_demo)Frame frame;			/* owner */char *demo_com;			/* demo command script */char *wtry_com;			/* interactive waves+ script */int  mach_type;			/* code for machine type */int  demo_choices;		/* allow intro, slides, or both */                                /* 1 = waves only; 2 = slides only;*/				/* 3 = both OK; */int  tryflag;			/* TRUE if try waves+ enabled */int  silent_demo;		/* TRUE for forced silence */{  Panel demo_panel;		/* panel with all the buttons on it */  Panel_item demo_button;	/* temp handle */  Panel_item repeat_button;	/* handle for single/continous button */  Panel_item message;		/* temp handle */  int feedback_y;		/* vertical position of feedback message */  DEBUG(1) (stderr, "Entered create_control_panel\n");  spsassert(frame != NULL, "null frame passed to create_control_panel");  demo_panel = (Panel)xv_create(frame, PANEL, 				XV_X, 0,				XV_WIDTH, WIN_EXTEND_TO_EDGE,				XV_HEIGHT, WIN_EXTEND_TO_EDGE,				OPENWIN_SHOW_BORDERS, TRUE,				WIN_BORDER, TRUE,				NULL);  if (do_color) {    (void) exv_init_colors(demo_panel);     xv_set(demo_panel, 	   WIN_BACKGROUND_COLOR, CMS_CONTROL_COLORS + EC_LIGHT_YELLOW,	   WIN_FOREGROUND_COLOR, CMS_CONTROL_COLORS + EC_BLACK,	   NULL);  }  /*set demo options */  message  =  xv_create(demo_panel, PANEL_MESSAGE,			XV_X, 233,			XV_Y, 18,			XV_WIDTH, 102,			XV_HEIGHT, 13,			PANEL_LABEL_STRING, "Demo Options:",			PANEL_LABEL_BOLD, TRUE,			NULL);  if (do_color) xv_set(message,		       PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK,		       NULL);  repeat_button = xv_create(demo_panel, PANEL_CHOICE,			  XV_WIDTH, 95,			  XV_HEIGHT, 46,			  PANEL_VALUE_X, 233,			  PANEL_VALUE_Y, 42,			  PANEL_LAYOUT, PANEL_VERTICAL,			  PANEL_CHOICE_NCOLS, 1,			  PANEL_CHOICE_STRINGS,			         "Single",			         "Continuous",			         0,			  PANEL_VALUE,         0,			  PANEL_CHOOSE_ONE,    TRUE,			  PANEL_NOTIFY_PROC, select_repeat,			  NULL);  if (do_color)       xv_set(repeat_button, 	     PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);  demo_button = xv_create(demo_panel, PANEL_CHECK_BOX,			  XV_WIDTH, 115,			  XV_HEIGHT, 52,			  PANEL_VALUE_X, 233,			  PANEL_VALUE_Y, 99,			  PANEL_CHOICE_NCOLS, 1,			  PANEL_CHOICE_STRINGS,			       "waves+ intro",			       "slide show",			  0,			  PANEL_VALUE,       demo_choices,			  PANEL_CLIENT_DATA, demo_choices,		  			  PANEL_NOTIFY_PROC, select_demo,			  NULL);  if (do_color)       xv_set(demo_button, 	     PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);  /* now set the startup buttons*/   demo_button = xv_create(demo_panel, PANEL_BUTTON,			  XV_X, 20,			  XV_Y, 18,			  XV_WIDTH, 85,			  XV_HEIGHT, 19,			  PANEL_LABEL_STRING, "Start demo",			  PANEL_NOTIFY_PROC, start_demo,			  PANEL_CLIENT_DATA, demo_com,			  XV_KEY_DATA, REPEAT_BUTTON_KEY, repeat_button,			  NULL);  if (do_color)       xv_set(demo_button, 	     PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);  /* we do not put up the interactive waves+ button unless -T option   * was used (passed via tryflag).  Note, however, that we could    * still put it up, using NULL as the PANEL_CLIENT_DATA (the    * script to call), since try_waves will just put up a message    * if pressed.     */  if (tryflag){      demo_button = xv_create(demo_panel, PANEL_BUTTON,			  XV_X, 20,			  XV_Y, 48,			  XV_WIDTH, 133,			  XV_HEIGHT, 19,			  PANEL_LABEL_STRING, "Interactive waves+",			  PANEL_NOTIFY_PROC, try_waves,			  PANEL_CLIENT_DATA, wtry_com,			  NULL);      if (do_color)           xv_set(demo_button, 	     PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);  }  /* set audio output options */  demo_button = xv_create(demo_panel, PANEL_CHOICE,			  XV_WIDTH, 152,			  XV_HEIGHT, 86,			  PANEL_VALUE_X, 20,			  PANEL_VALUE_Y, (tryflag ? 97 : 70),			  PANEL_CLIENT_DATA, silent_demo, 			  PANEL_LAYOUT, PANEL_VERTICAL,			  PANEL_LABEL_STRING, "Audio Output:",			  PANEL_CHOOSE_ONE,    TRUE,			  PANEL_CHOICE_NCOLS, 1,			  NULL);  switch (mach_type) {  case SUN_SPARC_AUDIO:    {    int a_fd; 		/*temp file descriptor*/    int audio_dev;  /*is there /dev/audio?*/    /*select default for audio*/    if((a_fd = open("/dev/audio", 1)) < 0)      audio_dev = 0;	     else {      audio_dev = 1;      close(a_fd);    }    xv_set(demo_button, 	   PANEL_CHOICE_STRINGS,	        "None",		"SPARCstation Internal",		"SPARCstation External",		NULL,	   PANEL_VALUE,         audio_dev,	   PANEL_NOTIFY_PROC, set_sparc_output,	   NULL);    /* invoke call-back directly to get default behavior */    set_sparc_output(demo_button, NULL);    }    break;  case SUN_VME_AUDIO:    xv_set(demo_button, 	   PANEL_CHOICE_STRINGS,	        "None",		"VME (AT&T DSP32)",		NULL,	   PANEL_VALUE,  0,	   PANEL_NOTIFY_PROC, set_sun4_output,	   NULL);    /* invoke call-back directly to get default behavior */    set_sun4_output(demo_button, NULL);    break;  case MC5600_AUDIO:    xv_set(demo_button, 	   PANEL_CHOICE_STRINGS,	        "None",		"Concurrent D/A",		NULL,	   PANEL_VALUE,  0,	   PANEL_NOTIFY_PROC, set_mc_output,	   NULL);    /* invoke call-back directly to get default behavior */    set_mc_output(demo_button, NULL);    break;  case SONY_AUDIO:    xv_set(demo_button, 	   PANEL_CHOICE_STRINGS,	        "None",		"Sony D/A",		NULL,	   PANEL_VALUE,  0,	   PANEL_NOTIFY_PROC, set_sony_output,	   NULL);    /* invoke call-back directly to get default behavior */    set_sony_output(demo_button, NULL);    break;  case NETWORK_AUDIO:    xv_set(demo_button, 	   PANEL_CHOICE_STRINGS,	        "None",		"Network play",		NULL,	   PANEL_VALUE,  0,	   PANEL_NOTIFY_PROC, set_net_output,	   NULL);    /* invoke call-back directly to get default behavior */    set_net_output(demo_button, NULL);    break;  case SGI_AUDIO:    xv_set(demo_button, 	   PANEL_CHOICE_STRINGS,	        "None",		"SGI D/A",		NULL,	   PANEL_VALUE,  1, /* set up internal audio as default*/	   PANEL_NOTIFY_PROC, set_sgi_output,	   NULL);    /* invoke call-back directly to get default behavior */    set_sgi_output(demo_button, NULL);    break;  case NO_AUDIO:  default:    link_file("play_scripts/play.none", "/tmp/play");    break;  }  if (mach_type != NO_AUDIO) {    if (do_color)       xv_set(demo_button, 	     PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_BLACK, NULL);  }  /*set global item for feedback messages; since the overall size of the   *panel varies (with -m option causing different length of I/O options),    *we calculate the Y position to be at the bottom of the panel    */  feedback_y = xv_get(demo_panel, XV_HEIGHT) - 17;  feedback = xv_create(demo_panel, PANEL_MESSAGE,		       XV_X, 3,		       XV_Y, feedback_y,		       XV_WIDTH, 233,		       XV_HEIGHT, 13,		       PANEL_LABEL_BOLD, TRUE,		       NULL);  if (do_color) xv_set(feedback,		       PANEL_ITEM_COLOR, CMS_CONTROL_COLORS + EC_RED,		       NULL);  DEBUG(1) (stderr, "Leaving create_control_panel\n");  return(demo_panel);}voidexit_proc(item, event)    Panel_item item;    Event      *event;{  /*This function gets called when the user is done, so all it has to do    is destroy the main window, causing the termination of the notifier    loop; before doing so, we also run the stop_waves stuff*/    /* if we think a demo is running, stop it*/    DEBUG(1) (stderr,"Inside of exit_proc.\n");    if (file_exists(DEMO_RUNNING_FLAG) || file_exists(WTRY_RUNNING_FLAG))      stop_demo();    remove_file(ERLDEMO_RUNNING_FLAG);    remove_file(WAVES_DEMO_FLAG);    remove_file(SINGLE_DEMO_FLAG);    remove_file(SLIDE_SHOW_FLAG);    remove_file(WAVES_DEMO_SCRIPT);    remove_file(SLIDE_SHOW_SCRIPT);    remove_file(WTRY_SCRIPT);    remove_file("/tmp/play");    remove_file("/tmp/ENTROPIC.log");    remove_file("/tmp/erldemo.log");        xv_destroy_safe(mainframe);    return;}Notify_valuedestroy_func(client, status)Notify_client client;Destroy_status status;{    DEBUG(1) (stderr,"Inside of destroy_func.\n");    if (status == DESTROY_CHECKING) {	}    else  if (status == DESTROY_CLEANUP) {    DEBUG(1) (stderr,"Inside of destroy_func. CLEANUP\n");	if (file_exists(DEMO_RUNNING_FLAG) || file_exists(WTRY_RUNNING_FLAG))      		stop_demo();	remove_file(ERLDEMO_RUNNING_FLAG);        return notify_next_destroy_func(client, status);	}    else if (status == DESTROY_SAVE_YOURSELF) {	}    else {    DEBUG(1) (stderr,"Inside of destroy_func. DEATH\n");	if (file_exists(DEMO_RUNNING_FLAG) || file_exists(WTRY_RUNNING_FLAG))      		stop_demo();	remove_file(ERLDEMO_RUNNING_FLAG);	}	    return NOTIFY_DONE;}Notify_valuesigint_func(client, sig, when)Notify_client client;int sig, when;{     DEBUG(1) (stderr,"Killed due to signal; cleaning up...\n");    if (file_exists(DEMO_RUNNING_FLAG) || file_exists(WTRY_RUNNING_FLAG))      stop_demo();    remove_file(ERLDEMO_RUNNING_FLAG);    xv_destroy_safe(mainframe);    return NOTIFY_DONE;}	voidstop_demo(){/* called when EXIT button pressed and a demo or tryout is running */  if (file_exists(WTRY_RUNNING_FLAG)) {    /*wtr is running, must quit that by hand*/    feedback_message("When finished with waves+ tryout, click on QUIT.", 3);  }  else {  /*automated demo running, setup for quickest stop*/    set_flag_file(SINGLE_DEMO_FLAG);    remove_file(WAVES_DEMO_FLAG);    remove_file(SLIDE_SHOW_FLAG);    feedback_message("Demo will stop after waves+ intro or slide show.", 3);    if (file_exists(WAVES_RUNNING_FLAG))       feedback_message("For faster exit, click on QUIT from waves+.", 3);  }  return;}voidselect_repeat(item, event)     Panel_item item;		/* parameter panel item */     Event      *event;{  switch (xv_get(item, PANEL_VALUE)) {  case 0: /*single*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -