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

📄 view_setter.c

📁 speech signal process tools
💻 C
📖 第 1 页 / 共 2 页
字号:
/* 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) 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 * *  view_setter.c *  a collection of routines for setting view attributes in "xwaves" * */static char *sccs_id = "@(#)view_setter.c	1.12	12/6/95	ATT/ERL";#include <Objects.h>#include <spectrogram.h>#include <file_ext.h>#include <esps/esps.h>#include <esps/fea.h>extern Object program;extern int 	debug_level, w_verbose;extern char *get_line_item(), *get_next_item(), *read_all_types();/* The rule is this: If the channel is not specified, the setting will   be applied to all active channels. */static  char view_channels[MES_BUF_SIZE] = ""; /* used for channel-specific attr. */static Object *view_object = NULL;static View *the_view;/***********************************************************************/view_assimilate_args(alist, adscr)     register char *alist;     Menuop *adscr;{  register int gotsome = 0, gotone, n;  char name[NAMELEN], buffer[MES_BUF_SIZE];  char *parsed_as;  register Menuop *ad, *ad2;  if(alist && *alist && adscr) {    *view_channels = 0;    while((*alist == ' ') || (*alist == '\t'))      alist++;			/* skip initial blanks */    while(*alist && (*alist != '\n')) {      strnscan(alist,name,sizeof(name));      if(! *(alist = get_line_item(alist))) {	sprintf(notice_msg,"No argument for selector %s",name);        show_notice(1,notice_msg);	if (debug_level > 1 || w_verbose > 1)	    fprintf(stderr,"Got %d args\n", gotsome);	return(gotsome);      }      n = strlen(name);      ad = adscr;      gotone = 0;      while(ad) {	if(!strncmp(name,ad->name,n)) {	  parsed_as = ad->name;	  if(strlen(ad->name) != n) {	    ad2 = ad->next;		/* check for uniqueness */	    while(ad2) {	      if(!strncmp(name,ad2->name,n)) /* found another match... */		break;	      ad2 = ad2->next;	    }	  } else	    ad2 = NULL;	  if(!ad2) {		/* reached end with no dups. */	    alist = read_all_types(alist,ad->data,buffer);/*	    if(ad->proc && *buffer) { changed 7/27/95 dt */	    if(ad->proc) {	      ad->proc(the_view,buffer);	      gotsome++;	      gotone = 1;	    }	  }	  break;	} else	  ad = ad->next;      }      if (debug_level > 1 || w_verbose > 1) {	if(gotone)	  fprintf(stderr,"View parsed attribute %s as %s\n", name, parsed_as);	else	  fprintf(stderr,"View attribute %s not found in Selector list.\n", name);      }	      if(! gotone) {		/* keyword not found in adscr list */	strnscan(alist,buffer,sizeof(buffer));	if((*buffer == '%') || (*buffer == '#')) { /* looks like a format spec. */	  alist = get_line_item(alist);	/* skip the non-standard item */	  alist = read_all_types(alist,buffer,NULL);	} else {		/* punt */	  sprintf(notice_msg,                 "Unknown or non-unique selector %s; argument %s ignored\n",		 name,buffer);          show_notice(1,notice_msg);	  alist = get_line_item(alist);	}      }    }  }  if (debug_level > 1 || w_verbose > 1)         fprintf(stderr,"Got %d args\n", gotsome);  return(gotsome);}static char *cur_ch;/***********************************************************************/channel_access(str)     char *str;{  int tst;  if(str && *str) {    cur_ch = str;    if(sscanf(cur_ch,"%d",&tst))      return(TRUE);  }  cur_ch = NULL;  return(FALSE);}/***********************************************************************/next_chan(){int tmp;if(cur_ch && *cur_ch && sscanf(cur_ch,"%d", &tmp)) {    cur_ch = get_next_item(cur_ch);    return(tmp);  }  cur_ch = NULL;  return(-1);}/***********************************************************************/void view_set_background(v, val)     View *v;     char *val;{  v->background = atoi(val);}/***********************************************************************/void view_set_zoom_ratio(v, val)     View *v;     char *val;{  v->zoom_ratio = atof(val);}  /***********************************************************************/void view_set_cross_level(v, val)     View *v;     char *val;{  v->cross_level = atof(val);}  /***********************************************************************/void view_set_page_step(v, val)     View *v;     char *val;{  v->page_step = atof(val);}/* These need to be done (sometime...) start_time(end_time)loc_yloc_xheightwidth*//***********************************************************************/void view_set_invert_dither(v, val)     View *v;     char *val;{  v->invert_dither = atoi(val);}/***********************************************************************/void view_set_overlay_as_number(v, val)     View *v;     char *val;{  v->overlay_as_number = atoi(val);}/***********************************************************************/void set_view_channels(v, val)     View *v;     char *val;{  strcpy(view_channels,val);}/***********************************************************************/void view_set_redraw_on_release(v, val)     View *v;     char *val;{  v->redraw_on_release = atoi(val);}/***********************************************************************/void view_set_rewrite_after_edit(v, val)     View *v;     char *val;{  v->rewrite_after_edit = atoi(val);}/***********************************************************************/void view_set_edit_ganged(v, val)     View *v;     char *val;{  if(v->sig && v->sig->obj)    ((Object*)(v->sig->obj))->edit_ganged = atoi(val);}/***********************************************************************/void view_set_zoom_ganged(v, val)     View *v;     char *val;{  if(v->sig && v->sig->obj)    ((Object*)(v->sig->obj))->zoom_ganged = atoi(val);}/***********************************************************************/void view_set_find_crossing(v, val)     View *v;     char *val;{    v->find_crossing = atoi(val);}/***********************************************************************/void view_set_scroll_ganged(v, val)     View *v;     char *val;{  if(v->sig && v->sig->obj)    ((Object*)(v->sig->obj))->scroll_ganged = atoi(val);}/***********************************************************************/void view_set_scrollbar_height(v, val)     View *v;     char *val;{  if(v->scrollbar)    v->scrollbar->height = atoi(val);}/***********************************************************************/void view_set_readout_height(v, val)     View *v;     char *val;{  v->readout_height = atoi(val);}/***********************************************************************/void view_set_line_color(v, val)     View *v;     char *val;{  int chan, ival = atoi(val);  if(channel_access(view_channels)) {    while((chan = next_chan()) >= 0) {      if(v->sig && (chan < v->sig->dim))	v->colors[view_invert_display_index(v,chan)] = ival;    }  } else    for(chan = 0; chan < v->dims; chan++)      v->colors[chan] = ival;}/***********************************************************************/void view_set_line_type(v, val)     View *v;     char *val;{  int chan, ival = atoi(val);  if(channel_access(view_channels)) {    while((chan = next_chan()) >= 0) {      if(v->sig && (chan < v->sig->dim))	v->line_types[view_invert_display_index(v,chan)] = ival;    }  } else    for(chan = 0; chan < v->dims; chan++)      v->line_types[chan] = ival;}/***********************************************************************/void view_set_val_offset(v, val)     View *v;     char *val;{  int chan;  double dval = atof(val);  if(isa_spectrogram_view(v))    v->val_offset[0] = dval;  else    if(channel_access(view_channels)) {      while((chan = next_chan()) >= 0) {	if(v->sig && (chan < v->sig->dim))	  v->val_offset[view_invert_display_index(v,chan)] = dval;      }    } else      for(chan = 0; chan < v->dims; chan++)	v->val_offset[chan] = dval;}/***********************************************************************/void view_set_val_scale(v, val)     View *v;     char *val;{  int chan;  double dval = atof(val);  if(isa_spectrogram_view(v))    v->val_scale[0] = dval;  else    if(channel_access(view_channels)) {      while((chan = next_chan()) >= 0) {	if(v->sig && (chan < v->sig->dim))	  v->val_scale[view_invert_display_index(v,chan)] = dval;      }    } else      for(chan = 0; chan < v->dims; chan++)	v->val_scale[chan] = dval;}/***********************************************************************/void view_set_show_vals(v, val)     View *v;     char *val;{  int chan, ival = atoi(val);  if(channel_access(view_channels)) {    while((chan = next_chan()) >= 0) {      if(v->sig && (chan < v->sig->dim))	v->show_vals[view_invert_display_index(v,chan)] = ival;    }  } else    for(chan = 0; chan < v->dims; chan++)      v->show_vals[chan] = ival;}/***********************************************************************/void view_set_show_current_chan(v, val)     View *v;     char *val;{  int chan, ival = atoi(val);  v->show_current_chan = ival;}/***********************************************************************/void view_set_show_labels(v, val)     View *v;     char *val;{  int chan, ival = atoi(val);  if(channel_access(view_channels)) {    while((chan = next_chan()) >= 0) {      if(v->sig && (chan < v->sig->dim))	v->show_labels[view_invert_display_index(v,chan)] = ival;    }  } else    for(chan = 0; chan < v->dims; chan++)      v->show_labels[chan] = ival;}/***********************************************************************/void view_set_reticle_on(v, val)     View *v;     char *val;{  int chan, ival = atoi(val);  if(channel_access(view_channels)) {    while((chan = next_chan()) >= 0) {      if(v->sig && (chan < v->sig->dim))	v->reticle_on[view_invert_display_index(v,chan)] = ival;    }  } else    for(chan = 0; chan < v->dims; chan++)      v->reticle_on[chan] = ival;}/***********************************************************************/void view_set_spect_interp(v, val)     View *v;     char *val;{  v->spect_interp = atoi(val);}/***********************************************************************/void view_set_h_rescale(v, val)     View *v;     char *val;{  v->h_rescale = atoi(val);

⌨️ 快捷键说明

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