Ejemplo n.º 1
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.º 2
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.º 3
0
// fill tmp region with new content
// given input index and foreground color
static void render_line(s16 idx, u8 fg) {
    //  const s16 opIdx = net_in_op_idx(idx);
    s16 target;
    s16 targetOpIdx = -1;
    s16 srcOpIdx;
    region_fill(lineRegion, 0x0);

    //  print_dbg("\r\n page_outs: render_line");
    if(idx >= net_num_outs() ) {
        return;
    }
    if(targetSelect) {
        //      print_dbg(" , in targetSelect");
        target = tmpTarget;
    } else {
        target = net_get_target(idx);
    }
    srcOpIdx = net_out_op_idx(idx);
    targetOpIdx = net_in_op_idx(target);

    /* print_dbg(" , target: "); */
    /* print_dbg_ulong(target); */

    if(target >= 0) {
        //// output has target
        // the network doesn't actually execute connections from an op to itself.
        // reflect this in UI by dimming this line
        if(targetOpIdx == srcOpIdx) {
            fg = 0x5;
        }
        // render output
        clearln();
        appendln_idx_lj(srcOpIdx);
        appendln_char('.');
        appendln( net_op_name(srcOpIdx));
        appendln_char('/');
        appendln( net_out_name(idx) );
        endln();
        font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
        // render target
        targetOpIdx = net_in_op_idx(target);
        clearln();
        appendln("-> ");
        if(targetOpIdx >= 0) {
            //      print_dbg(" , target is op in");
            // target is operator input
            appendln_idx_lj(net_in_op_idx(target));
            appendln_char('.');
            appendln( net_op_name(net_in_op_idx(target)) );
            appendln_char('/');
            appendln( net_in_name(target) );
        } else {
            //      print_dbg(" , target is param in");
            // target is parameter input
            appendln_idx_lj( (int)net_param_idx(target));
            appendln_char('.');
            appendln( net_in_name(target));
        }
        endln();
        font_string_region_clip(lineRegion, lineBuf, 60, 0, fg, 0);
        clearln();
    } else {
        //// no target
        // render output
        clearln();
        appendln_idx_lj(net_out_op_idx(idx));
        appendln_char('.');
        appendln( net_op_name(net_out_op_idx(idx)));
        appendln_char('/');
        appendln( net_out_name(idx) );
        endln();
        font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
    }
    // draw something to indicate preset inclusion
    if(net_get_out_preset(idx)) {
        font_string_region_clip(lineRegion, ".", 125, 0, fg, 0);
    }
    // underline
    //  region_fill_part(lineRegion, LINE_UNDERLINE_FSET, LINE_UNDERLINE_LEN, 0x1);
}
Ejemplo n.º 4
0
// scroll the current selection
static void select_scroll(s32 dir) {
    const s32 max = net_num_outs() - 1;
    // index for new content
    s16 newIdx;
    s16 newSel;
    s16 oldSel;
    int i;

    // cancel actions
    pages_reset_keypressed();

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

    oldSel = *pageSelect;
    *pageSelect = newSel;

    // remove highlight from old center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 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.º 5
0
// redraw based on provisional preset seleciton
void redraw_outs_preset (void) {
  //  s32 max = net_num_outs() - 1;
  u8 i=0;
  u8 idx = *pageSelect - 3;
  u8 fg;
  u8 enabled;
  s16 target;
  s16 targetOpIdx = -1;
  s16 srcOpIdx; 
  s32 preSel = preset_get_select();
  //  print_dbg("\r\n redraw_outs_preset()");

  while(i<8) {
    region_fill(lineRegion, 0x0);
    if(idx >= net_num_outs() ) { return; }

    enabled = preset_out_enabled(preSel, idx);
    if(enabled) {
      // if it's enabled, show the preset's target (including if blank)
      target = preset_get_selected()->outs[idx].target;
      srcOpIdx = net_out_op_idx(idx);
      targetOpIdx = net_in_op_idx(target);
      if(target >= 0) {
	//// output has target
	// the network doesn't actually execute connections from an op to itself.
	// reflect this in UI by dimming this line
	if(targetOpIdx == srcOpIdx) { fg = 0x5; }
	// render output
	clearln();
	appendln_idx_lj(srcOpIdx);
	appendln_char('.');
	appendln( net_op_name(srcOpIdx));
	appendln_char('/');
	appendln( net_out_name(idx) );
	endln();
	font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
	// render target
	targetOpIdx = net_in_op_idx(target);
	clearln();
	appendln("-> ");
	if(targetOpIdx >= 0) {
	  // target is operator input
	  appendln_idx_lj(net_in_op_idx(target));
	  appendln_char('.');
	  appendln( net_op_name(net_in_op_idx(target)) );
	  appendln_char('/');
	  appendln( net_in_name(target) );
	} else {
	  // target is parameter input
	  appendln_idx_lj( (int)net_param_idx(target)); 
	  appendln_char('.');
	  appendln( net_in_name(target)); 
	}
	endln();
	font_string_region_clip(lineRegion, lineBuf, 60, 0, fg, 0);
	clearln();
      } else {
	//// no target
	// render output
	clearln();
	appendln_idx_lj(net_out_op_idx(idx));
	appendln_char('.');
	appendln( net_op_name(net_out_op_idx(idx)));
	appendln_char('/');
	appendln( net_out_name(idx) );
	endln();
	font_string_region_clip(lineRegion, lineBuf, 2, 0, fg, 0);
      }
      // draw something to indicate preset inclusion
      if(net_get_out_preset(idx)) {
	font_string_region_clip(lineRegion, ".", 126, 0, fg, 0);
      }
    
    } else {
      // not enabled, draw as normal with dim coloring
      render_line(idx, 0x5);
    }

    render_to_scroll_line(i, 0);
    ++i;
    ++idx;
  }
  draw_preset_name();
}
Ejemplo n.º 6
0
// scroll the current selection
static void select_scroll(s32 dir) {
  const s32 max = net_num_outs() - 1;
  // index for new content
  s16 newIdx;
  s16 newSel;
  // new flags

  targetSelect = 0;
  
  if(dir < 0) {
    /// SCROLL DOWN
    // if selection is already zero, do nothing 
    if(*pageSelect == 0) {
      //      print_dbg("\r\n reached min selection in inputs scroll. ");
      return;
    }
    // remove highlight from old center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 0);
    // decrement selection
    newSel = *pageSelect - 1;
    ///// these bounds checks shouldn't really be needed here...
    //    if(newSel < 0) { newSel = 0; }
    //    if(newSel > max ) { newSel = max; }
    *pageSelect = newSel;    
    newIdx = newSel - SCROLL_LINES_BELOW;
    if(newIdx < 0) { 
      // empty row
      region_fill(lineRegion, 0);
    } else {
      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
    // if selection is already max, do nothing 
    if(*pageSelect == max) {
      //      print_dbg("\r\n reached max selection in inputs scroll. ");
      return;
    }
    // remove highlight from old center
    render_scroll_apply_hl(SCROLL_CENTER_LINE, 0);
    // increment selection
    newSel = *pageSelect + 1;
    ///// these bounds checks shouldn't really be needed here...
    //    if(newSel < 0) { newSel = 0; }
    //    if(newSel > max ) { newSel = max; }
    /////
    *pageSelect = newSel;    
    // add new content at bottom of screen
    newIdx = newSel + SCROLL_LINES_ABOVE;
    if(newIdx > max) { 
      // empty row
      region_fill(lineRegion, 0);
    } else {
      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);
  }
}