ctl.trace_playing = !ctl.trace_playing; 
ctl.trace_playing = (ctl.trace_playing) ? 0 : 1; 
static int ctl_read(int32 *valp){  int c, i;  static int u_prefix = 1, u_flag = 1;  if(ctl_cmdmode)      mini_buff_refresh(command_buffer);  while ((c=getch())!=ERR)    {#if SCREEN_BUGFIX      re_init_screen();#endif      if(u_flag == 0)      {	  u_prefix = 1;	  u_flag = 1;      }      if(ctl_ncurs_mode == NCURS_MODE_HELP)      {	  switch(c)	  {	    case 'h':	    case '?':	    case KEY_F(1):	      ctl_help_mode();	      break;	    case 'q':	      return RC_QUIT;	  }	  u_prefix = 1;	  continue;      }      if(ctl_cmdmode && ' ' <= c && c < 256)      {	  if(!mini_buff_insertc(command_buffer, c))	      beep();	  u_prefix = 1;	  continue;      }      if(!ctl_cmdmode && c == 21)      {	  u_prefix <<= 1;	  if(u_prefix > MAX_U_PREFIX)	      u_prefix = MAX_U_PREFIX;	  u_flag = 1;	  continue;      }      else	  u_flag = 0;      switch(c)	{	case 'h':	case '?':	case KEY_F(1):	  ctl_help_mode();	  continue;	case 'V': 	  *valp = 10 * u_prefix;	  return RC_CHANGE_VOLUME;	case 'v':	  *valp = -10 * u_prefix; 	  return RC_CHANGE_VOLUME;	case 16:	case 'P':	case KEY_UP:	  if(ctl_cmdmode == NCURS_MODE_CMD_J)	      ctl_cmd_J_move(1);	  else if(ctl_cmdmode == NCURS_MODE_CMD_L)	      ctl_cmd_L_phist();	  else if(ctl_ncurs_mode == NCURS_MODE_LIST)	      ctl_list_mode(NC_LIST_UP);	  else	  {	      *valp = 10 * u_prefix;	      return RC_CHANGE_VOLUME;	  }	  continue;	case 14:	case 'N':	case KEY_DOWN:	  if(ctl_cmdmode == NCURS_MODE_CMD_J)	      ctl_cmd_J_move(-1);	  else if(ctl_cmdmode == NCURS_MODE_CMD_L)	      ctl_cmd_L_nhist();	  else if(ctl_ncurs_mode == NCURS_MODE_LIST)	      ctl_list_mode(NC_LIST_DOWN);	  else	  {	      *valp = -10 * u_prefix;	      return RC_CHANGE_VOLUME;	  }	  continue;	case KEY_PPAGE:	  if(ctl_ncurs_mode == NCURS_MODE_LIST)	  {	      ctl_list_mode(NC_LIST_UPPAGE);	      continue;	  }	  else	      return RC_REALLY_PREVIOUS;	case 22: /* ^V */	case KEY_NPAGE:	  if(ctl_ncurs_mode == NCURS_MODE_LIST)	  {	      ctl_list_mode(NC_LIST_DOWNPAGE);	      continue;	  }	  else	      return RC_NEXT;#if 0	case '1':	case '2':	case '3':	  *valp = c - '2';	  return RC_CHANGE_REV_EFFB;	case '4':	case '5':	case '6':	  *valp = c - '5';	  return RC_CHANGE_REV_TIME;#endif	case 'q':	case 3: /* ^C */	case KEY_END:	  trace_flush();	  sleep(1);	  return RC_QUIT;	case 'n':	  return RC_NEXT;	case 'p':	  return RC_REALLY_PREVIOUS;	case 'r':	case KEY_HOME:	  return RC_RESTART;	case 'f':	case KEY_RIGHT:	case 6: /* ^F */	  if(ctl_cmdmode)	  {	      if(!mini_buff_forward(command_buffer))		  beep();	      continue;	  }	  *valp = play_mode->rate * u_prefix;	  return RC_FORWARD;	case 'b':	case KEY_LEFT:	case 2: /* ^B */	  if(ctl_cmdmode)	  {	      if(!mini_buff_backward(command_buffer))		  beep();	      continue;	  }	  *valp = play_mode->rate * u_prefix;	  return RC_BACK;	case 's':	  return RC_TOGGLE_PAUSE;	case 'l':	  display_key_helpmsg();	  ctl_list_mode(NC_LIST_PLAY);	  continue;	case ' ':	case KEY_ENTER:	case '\r':	case '\n':	  if(ctl_cmdmode == NCURS_MODE_CMD_J)	      return ctl_cmd_J_enter();	  if(ctl_cmdmode == NCURS_MODE_CMD_L)	      return ctl_cmd_L_enter();	  if(ctl_cmdmode == NCURS_MODE_CMD_D)	      return ctl_cmd_D_enter(valp);	  if(ctl_cmdmode == NCURS_MODE_CMD_E)	      return ctl_cmd_E_enter(valp);	  if(ctl_cmdmode == NCURS_MODE_CMD_S)	      return ctl_cmd_S_enter();	  if(ctl_cmdmode == NCURS_MODE_CMD_R)	      return ctl_cmd_R_enter(valp);	  if(ctl_cmdmode == NCURS_MODE_CMD_FSEARCH)	  {	      if(!ctl_cmd_forward_search())		  beep();	      continue;	  }	  if(ctl_ncurs_mode == NCURS_MODE_LIST)	  {	      /* ctl_list_mode(NC_LIST_SELECT); */	      return RC_LOAD_FILE;	  }		if (ctl_ncurs_mode == NCURS_MODE_TRACE && selected_channel != -1) {			*valp = selected_channel;			return RC_TOGGLE_MUTE;		}	  continue;	case '+':	  *valp = u_prefix;	  return RC_KEYUP;	case '-':	  *valp = -u_prefix;	  return RC_KEYDOWN;	case '>':	  *valp = u_prefix;	  return RC_SPEEDUP;	case '<':	  *valp = u_prefix;	  return RC_SPEEDDOWN;	case 'O':	  *valp = u_prefix;	  return RC_VOICEINCR;	case 'o':	  *valp = u_prefix;	  return RC_VOICEDECR;	case 'c':	  if(ctl_ncurs_mode == NCURS_MODE_TRACE)	  {	      move_select_channel(u_prefix);	      continue;	  }	  break;	case 'j':		if (ctl_ncurs_mode == NCURS_MODE_TRACE)			move_select_channel(u_prefix);		else if (ctl_ncurs_mode == NCURS_MODE_LIST)			ctl_list_mode(NC_LIST_DOWN);		continue;	case 'C':	  if(ctl_ncurs_mode == NCURS_MODE_TRACE)	  {	      move_select_channel(-u_prefix);	      continue;	  }	  break;	case 'k':		if (ctl_ncurs_mode == NCURS_MODE_TRACE)			move_select_channel(-u_prefix);		else if (ctl_ncurs_mode == NCURS_MODE_LIST)			ctl_list_mode(NC_LIST_UP);		continue;	case 'd':	  if(ctl_ncurs_mode == NCURS_MODE_TRACE && selected_channel != -1)	  {	      *valp = selected_channel;	      return RC_TOGGLE_DRUMCHAN;	  }	  break;	case '.':		if (ctl_ncurs_mode == NCURS_MODE_TRACE && selected_channel != -1) {			*valp = selected_channel;			return RC_SOLO_PLAY;		}		break;	case 'g':	  return RC_TOGGLE_SNDSPEC;	case 'G':	  return RC_TOGGLE_CTL_SPEANA;	case 't': /* toggle trace */	  if(ctl.trace_playing)	      trace_flush();	  ctl.trace_playing = !ctl.trace_playing;	  if(ctl_open(0, 0))	      return RC_QUIT; /* Error */	  ctl_total_time(CTL_STATUS_UPDATE);	  ctl_master_volume(CTL_STATUS_UPDATE);	  ctl_metronome(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE);	  ctl_keysig(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE);	  ctl_tempo(CTL_STATUS_UPDATE, CTL_STATUS_UPDATE);	  ctl_file_name(NULL);	  display_key_helpmsg();	  if(ctl.trace_playing)	  {	      *valp = 0;	      return RC_SYNC_RESTART;	  }	  return RC_NONE;	case 7: /* ^G */	case 27: /* cancel */	  if(ctl_cmdmode)	  {	      mini_buff_clear(command_buffer);	      beep();	      ctl_cmdmode = 0;	      ctl_cmd_dir_close();	  }	  continue;	case 1: /* ^A */	  if(ctl_cmdmode)	  {	      while(mini_buff_backward(command_buffer))		  ;	  }	  continue;	case 4: /* ^D */	  if(ctl_cmdmode)	  {	      if(!mini_buff_delc(command_buffer))		  beep();	  }	  continue;	case 5: /* ^E */	  if(ctl_cmdmode)	  {	      while(mini_buff_forward(command_buffer))		  ;	  }	  continue;	case 9: /* TAB: file completion */	  if(ctl_cmdmode == NCURS_MODE_CMD_L ||	     ctl_cmdmode == NCURS_MODE_CMD_S)	  {	      if(!mini_buff_completion(command_buffer))	      {		  /* Completion failure */		  beep();		  ctl_cmd_L_dir(0);	      }	      if(command_buffer->cflag == 1)	      {		  ctl_mode_L_dispstart = 0;		  ctl_cmd_L_dir(0);	      }	      else if(command_buffer->cflag > 1)		  ctl_cmd_L_dir(1);	  }	  continue;	case 11: /* ^K */	  if(ctl_cmdmode)	  {	      while(mini_buff_delc(command_buffer))		  ;	  }	  continue;	case KEY_BACKSPACE:	case 8: /* ^H */	case 127: /* del */	  if(ctl_cmdmode)	  {	      if(mini_buff_backward(command_buffer))		  mini_buff_delc(command_buffer);	      else		  beep();	  }	  continue;	case 21: /* ^U */	  if(ctl_cmdmode)	  {	      while(mini_buff_backward(command_buffer))		  mini_buff_delc(command_buffer);	  }	  continue;	case'J':	  ctl_cmdmode = NCURS_MODE_CMD_J;	  mini_buff_set(command_buffer, dftwin, LINES - 1, "Jump: ");	  continue;	case'L':	  ctl_cmdmode = NCURS_MODE_CMD_L;	  mini_buff_set(command_buffer, dftwin, LINES - 1, "MIDI File: ");	  if(*ctl_mode_L_lastenter == '\0' && current_MFnode != NULL)	  {	      char *p;	      strncpy(ctl_mode_L_lastenter, current_MFnode->file,		      COMMAND_BUFFER_SIZE - 1);	      ctl_mode_L_lastenter[COMMAND_BUFFER_SIZE - 1] = '\0';	      if((p = strrchr(ctl_mode_L_lastenter, '#')) != NULL)		  i = p - ctl_mode_L_lastenter;	      else		  i = strlen(ctl_mode_L_lastenter);	      while(i > 0 && !IS_PATH_SEP(ctl_mode_L_lastenter[i - 1]))		  i--;	      ctl_mode_L_lastenter[i] = '\0';	  }	  mini_buff_sets(command_buffer, ctl_mode_L_lastenter);	  ctl_mode_L_histc = NULL;	  continue;	case 'D':	  ctl_cmdmode = NCURS_MODE_CMD_D;	  mini_buff_set(command_buffer, dftwin, LINES - 1, "DrumCh> ");	  continue;	case 'E':	  ctl_cmdmode = NCURS_MODE_CMD_E;	  mini_buff_set(command_buffer, dftwin, LINES - 1, "ExtMode> ");	  continue;	case 'S':	  ctl_cmdmode = NCURS_MODE_CMD_S;	  mini_buff_set(command_buffer, dftwin, LINES - 1, "SaveAs> ");	  if(*ctl_mode_L_lastenter == '\0' && current_MFnode != NULL)	  {	      int i;	      strncpy(ctl_mode_L_lastenter, current_MFnode->file,		      COMMAND_BUFFER_SIZE - 1);	      ctl_mode_L_lastenter[COMMAND_BUFFER_SIZE - 1] = '\0';	      i = strlen(ctl_mode_L_lastenter);	      while(i > 0 && !IS_PATH_SEP(ctl_mode_L_lastenter[i - 1]))		  i--;	      ctl_mode_L_lastenter[i] = '\0';	  }	  mini_buff_sets(command_buffer, ctl_mode_L_lastenter);	  continue;	case 'R': {	    char currentRate[16];	    ctl_cmdmode = NCURS_MODE_CMD_R;	    mini_buff_set(command_buffer, dftwin, LINES - 1, "Sample rate> ");	    sprintf(currentRate, "%d", (int)play_mode->rate);	    mini_buff_sets(command_buffer, currentRate);	    continue;	  }	case '%':	  display_velocity_flag = !display_velocity_flag;	  continue;	case '/':	  if(ctl_ncurs_mode == NCURS_MODE_LIST)	  {	      ctl_cmdmode = NCURS_MODE_CMD_FSEARCH;	      mini_buff_set(command_buffer, dftwin, LINES - 1, "/");	  }		if (ctl_ncurs_mode == NCURS_MODE_TRACE)			return RC_MUTE_CLEAR;	  continue;	case 12: /* ^L */	  redraw_all();	  continue;	default:	  beep();	  continue;	}    }#if SCREEN_BUGFIX  re_init_screen();#endif  return RC_NONE;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/9e59eddbe3e4058535b0f37a0ac2df8f01323c85/ncurs_c.c/buggy/interface/ncurs_c.c