Ejemplo n.º 1
0
// edit the current seleciton
static void select_edit(s32 inc) {
    s16 tmptmp;
    //  print_dbg("\r\n page_outs: select_edit");
    // enter target-select mode
    if(targetSelect == 0) {
        //    print_dbg(" , set targetSelect mode");
        targetSelect = 1;
        /// only change tmp target selection if connected
        /// thus, unconnected outputs should default in editor to last connection made.
        tmptmp = net_get_target(*pageSelect);
        if(tmptmp > -1) {
            tmpTarget = tmptmp;
        }
    }
    /* print_dbg("\r\n tmpTarget: "); */
    /* print_dbg_ulong(tmpTarget); */
    //  if(inc > 0) {
    /* print_dbg(" , inc tmpTarget"); */
    /* print_dbg(" , value: "); */
    /* print_dbg_ulong(tmpTarget); */
    // increment tmpTarget
    tmpTarget += inc;
    if(tmpTarget >= net_num_ins() ) {
        tmpTarget -= (net_num_ins() + 1);
    }
    if(tmpTarget < -1) {
        tmpTarget += (net_num_ins() + 1);
    }
    /* ++tmpTarget; */
    /* if(tmpTarget == net_num_ins()) { */
    /*   //      print_dbg(" , tmpTarget at max"); */
    /*   // scroll past all inputs : disconnect and wrap */
    /*   tmpTarget = -1; */
    /* }  */
    /* } else { */
    /*   --tmpTarget; */
    /*   if (tmpTarget == -2) { */
    /*     //      print_dbg(" , tmpTarget at min"); */
    /*     //  scrolled down from disconnect: connect and wrap */
    /*     tmpTarget = net_num_ins() - 1; */
    /*   } */
    /* } */

    // render to tmp buffer
    render_line(*pageSelect, 0xf);
    // copy to scroll with highlight
    render_to_scroll_line(SCROLL_CENTER_LINE, 1);
    show_foot();
    //  }
}
Ejemplo n.º 2
0
// store everything enabled in given preset
void preset_store(u32 preIdx) {
  u16 i;
  // ins
  for(i=0; i<net_num_ins(); ++i) {
    if( net_get_in_preset(i) ) {
      presets[preIdx].ins[i].value = net_get_in_value(i);
      presets[preIdx].ins[i].enabled = 1;
    }
  }
  // outs
  for(i=0; i<net_num_outs(); ++i) {
    if(net_get_out_preset(i)) {
      presets[preIdx].outs[i].target = net_get_target(i);
      presets[preIdx].outs[i].enabled = 1;
    }
  }
  // params
  /* for(i=0; i<net_num_params(); ++i) { */
  /*   if(get_param_preset(i)) { */
  /*     presets[preIdx].params[i].value =  get_param_value( i ); */
  /*     presets[preIdx].params[i].enabled = 1; */
  /*   } */
  /* } */
  select = preIdx;
}
Ejemplo n.º 3
0
// redraw all lines, force selection
void redraw_ins(void) {
  u8 i=0;
  s32 n = *pageSelect - 3;
  // num_ins() includes param count!
  const s32 max = net_num_ins() - 1;

  // set scroll region
  // FIXME: should be separate function i guess
  render_set_scroll(&centerScroll);

  print_dbg("\r\n redraw_ins() ");

  while(i<8) {

    if(n == -1) {
      // draw a blank line
      region_fill(lineRegion, 0);
    } else if(n == (max+1)) {
      // draw a blank line
      region_fill(lineRegion, 0);
    } else {
      if(n < -1) {
	n += (max + 2);
      }
      if( n > max ) {
	n -= (max + 2);
      }

      render_line( n, 0xa );
    }
    render_to_scroll_line(i, n == *pageSelect ? 1 : 0);
    ++i;
    ++n;
  }
}
Ejemplo n.º 4
0
// edit the current seleciton
static void select_edit(s32 inc) {
  //  print_dbg("\r\n page_outs: select_edit");
  // enter target-select mode
  if(targetSelect == 0) {
    //    print_dbg(" , set targetSelect mode");
    targetSelect = 1;
    tmpTarget = net_get_target(*pageSelect);
  }
  /* print_dbg("\r\n tmpTarget: "); */
  /* print_dbg_ulong(tmpTarget); */
  if(inc > 0) {
    /* print_dbg(" , inc tmpTarget"); */
    /* print_dbg(" , value: "); */
    /* print_dbg_ulong(tmpTarget); */
    // increment tmpTarget
    ++tmpTarget;
    if(tmpTarget == net_num_ins()) {
      //      print_dbg(" , tmpTarget at max");
      // scroll past all inputs : disconnect and wrap
      tmpTarget = -1;
    } 
  } else {
    --tmpTarget;
    if (tmpTarget == -2) {
      //      print_dbg(" , tmpTarget at min");
      //  scrolled down from disconnect: connect and wrap
      tmpTarget = net_num_ins() - 1;
    }
  }    
  
  // render to tmp buffer
  render_line(*pageSelect, 0xf);
  // copy to scroll with highlight
  render_to_scroll_line(SCROLL_CENTER_LINE, 1);
  show_foot();
  //  }
}
Ejemplo n.º 5
0
// recall everything enabled in given preset
void preset_recall(u32 preIdx) {
  u16 i;
  print_dbg("\r\n preset_recall INS");
  // ins
  for(i=0; i<net_num_ins(); ++i) {
    if(presets[preIdx].ins[i].enabled) {
      print_dbg("\r\n recalling enabled input in target preset, idx: ");
      print_dbg_ulong(i);
      net_set_in_value( i, presets[preIdx].ins[i].value );
    }
  }

  print_dbg("\r\n preset_recall OUTS");
  // outs
  for(i=0; i<net_num_outs(); ++i) {
    if(presets[preIdx].outs[i].enabled) {
      print_dbg("\r\n recalling enabled output in target preset, idx: ");
      print_dbg_ulong(i);
      print_dbg("\r\n , value: 0x");
      print_dbg_hex(presets[preIdx].outs[i].target);

      net_connect( i, presets[preIdx].outs[i].target );
    }
  }

  /* print_dbg("\r\n preset_recall PARAMS"); */
  /* // params */
  /* for(i=0; i<net_num_params(); ++i) { */
  /*   if(presets[preIdx].params[i].enabled) { */

  /*     print_dbg("\r\n recalling enabled input in target preset, idx: "); */
  /*     print_dbg_ulong(i); */

  /*     set_param_value( i, presets[preIdx].params[i].value ); */
  /*   } */
  /* } */

  
  /// process for play mode if we're in play mode
  if(pageIdx == ePagePlay) {
    play_preset(preIdx);
  }

  // update selection
  select = preIdx;
}
Ejemplo n.º 6
0
// redraw based on provisional preset seleciton
void redraw_ins_preset ( void ) {
  s32 max = net_num_ins() - 1;
  u8 i=0;
  u8 n = *pageSelect - 3;
  u8 enabled;
  io_t opVal;
  s32 paramVal;
  s16 opIdx;


  print_dbg("\r\n redraw_ins_preset() ");


  while(i<8) {
    region_fill(lineRegion, 0x0);

    opIdx = net_in_op_idx(n);  

    if(n <= max) {
      enabled = net_get_in_preset(n);
      if(opIdx < 0 ) {
	// parameter...
	clearln();
	appendln_idx_lj( (int)net_param_idx(n)); 
	appendln_char('.');
	appendln( net_in_name(n)) ; 
	endln();
	font_string_region_clip(lineRegion, lineBuf, 4, 0, 0xf, 0);
	clearln();

	if(enabled) {
	  paramVal = preset_get_selected()->ins[n].value;
	  net_get_param_value_string_conversion(lineBuf, net_param_idx(n), paramVal);
	} else {
	  net_get_param_value_string(lineBuf, n);
	}
	font_string_region_clip(lineRegion, lineBuf, LINE_VAL_POS_LONG, 0, 0xf, 0);
      } else {
	// op input
	clearln();
	appendln_idx_lj(opIdx);
	appendln_char('.');
	appendln( net_op_name(opIdx) );
	appendln_char('/');
	appendln( net_in_name(n) );
	endln();

	font_string_region_clip(lineRegion, lineBuf, 4, 0, 0xf, 0);

	if(enabled) {
	  opVal = preset_get_selected()->ins[n].value;
	} else {
	  opVal = net_get_in_value(n);
	}
	op_print(lineBuf, opVal);

	font_string_region_clip(lineRegion, lineBuf, LINE_VAL_POS_SHORT, 0, 0xf, 0);
      }
      // draw something to indicate preset inclusion
      if(enabled) {
	font_string_region_clip(lineRegion, ".", 126, 0, 0xf, 0);
      }
    }
    render_to_scroll_line(i, 0);
    ++i;
    ++n;
  }
  //  print_dbg("\r\n\r\n");
  draw_preset_name();
}
Ejemplo n.º 7
0
// scroll the current selection
static void select_scroll(s32 dir) {
  const s32 max = net_num_ins() - 1;
  // index for new content
  s16 newIdx;
  s16 newSel;
  s16 oldSel;
  int i;

  // wrap with blank line
  newSel = *pageSelect + dir;
  if (newSel < -1) { 
    newSel += (max + 2);
  } 
  if(newSel > max) {
    newSel -= (max + 2);
  }

  //  print_dbg("\r\n scrolled selection on inputs page, old sel: ");
  //  print_dbg_ulong(*pageSelect);
  //  print_dbg(" ,  dir: ");
  //  print_dbg_hex(dir);
  //  print_dbg(" , new idx: ");
  //  print_dbg_ulong(newSel);

  oldSel = *pageSelect;
  *pageSelect = newSel; 
  // remove highlight from old center
  render_scroll_apply_hl(SCROLL_CENTER_LINE, 0);

  // update 'zeroed' flag
  zeroed = (net_get_in_value(*pageSelect) == 0);

  if(dir > 0) { 
    // add content at bottom
    for(i=0; i<dir; ++i) {
      newIdx = oldSel + SCROLL_LINES_BELOW + i + 2;
      
      if(newIdx == (max + 1)) {
	region_fill(lineRegion, 0);
      } else {
	if(newIdx > max) {
	  newIdx = newIdx - (max+2);
	}
	//	print_dbg(" , rendering new line for idx: ");
	//	print_dbg_ulong(newIdx);
	render_line(newIdx, 0xa);
      }
      // render tmp region to bottom of scroll
      // (this also updates scroll byte offset) 
      render_to_scroll_bottom();
      // add highlight to new center
    }
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 1);
  } else {
    // add content at top
    for(i=0; i>dir; --i) {
      newIdx = oldSel - SCROLL_LINES_ABOVE + i;
      if(newIdx == -1) {
	region_fill(lineRegion, 0);
      } else {
	if(newIdx < -1) {
	newIdx = newIdx + max + 2;
	}
	//	print_dbg(" , rendering new line for idx: ");
	//	print_dbg_ulong(newIdx);
	render_line(newIdx, 0xa);
      }
      // render tmp region to top of scroll
      // (this also updates scroll byte offset) 
      render_to_scroll_top();
    }
    // add highlight to new center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 1); 
  }
}
Ejemplo n.º 8
0
// scroll the current selection
static void select_scroll(s32 dir) {
  const s32 max = net_num_ins() - 1;
  // index for new content
  s16 newIdx;
  s16 newSel;

  if(dir < 0) {
    /// SCROLL DOWN
    // wrap with blank line
    if(*pageSelect == -1) {
      newSel = max;
    } else {
      // decrement selection
      newSel = *pageSelect - 1;
      //      print_dbg("\r\n scroll down to new selection on ins page: ");
      //      print_dbg_ulong(newSel);
    }
    *pageSelect = newSel;
    // remove highlight from old center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 0);

    // update 'zeroed' flag
    zeroed = (net_get_in_value(*pageSelect) == 0);

    // add new content at top
    newIdx = newSel - SCROLL_LINES_BELOW;
    if(newIdx == -1) {
      region_fill(lineRegion, 0);
    } else {
      if(newIdx < -1) {
	newIdx = newIdx + max + 2;
      }
      render_line(newIdx, 0xa);
    }
    // render tmp region to bottom of scroll
    // (this also updates scroll byte offset) 
    render_to_scroll_top();
    // add highlight to new center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 1);

  } else {
    // SCROLL UP
    // wrap with a blank line
    if(*pageSelect == max) {
      newSel = -1;
    }  else {
      // increment selection
      newSel = *pageSelect + 1;
    }
    //    print_dbg("\r\n scroll up to new selection on ins page: ");
    //    print_dbg_ulong(newSel);
    
    *pageSelect = newSel;    
    // remove highlight from old center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 0);
    // add new content at bottom of screen
    newIdx = newSel + SCROLL_LINES_ABOVE;

    if(newIdx == (max + 1)) {
      region_fill(lineRegion, 0);
    } else {
      if(newIdx > max) {
	newIdx = newIdx - (max+2);
      }
      render_line(newIdx, 0xa);
    }


    // render tmp region to bottom of scroll
    // (this also updates scroll byte offset) 
    render_to_scroll_bottom();
    // add highlight to new center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 1);
  }
}