Example #1
0
// function key handlers
void handle_key_0(s32 val) {
    if(val == 0) {
        return;
    }
    if(altMode) {
        ///// follow
        // select target on ins page
        tmpTarget = net_get_target(*pageSelect);
        if(tmpTarget >= 0) {
            pages[ePageIns].select = tmpTarget;
            set_page(ePageIns);
            redraw_ins();
        }
    } else {
        // store
        // show selected preset name
        draw_preset_name();
        if(check_key(0)) {
            // store in preset
            net_set_out_preset(*pageSelect, 1);
            preset_store_out(preset_get_select(), *pageSelect);
            // redraw selected line
            render_line(*pageSelect, 0xa);
            render_scroll_apply_hl(SCROLL_CENTER_LINE, 1);
            // TODO: store directly in scene?
        }
    }
    show_foot();
}
Example #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;
}
Example #3
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();
    //  }
}
Example #4
0
static json_t* net_write_json_outs(void) {
    json_t* outs = json_object();
    json_t* l = json_array();
    json_t* o;
    int i;
    json_object_set(outs, "count", json_integer(net->numOuts));

    for(i=0; i<net->numOuts; i++) {
        o = json_object();
        json_object_set(o, "idx", json_integer(i));
        json_object_set(o, "opIdx", json_integer(net->outs[i].opIdx));
        json_object_set(o, "opOutIdx", json_integer(net->outs[i].opOutIdx));
        json_object_set(o, "name", json_string(net_out_name(i)));
        json_object_set(o, "target", json_integer(net_get_target(i)));
        json_array_append(l, o);
    }
    json_object_set(outs, "data", l);

    return outs;
}
Example #5
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();
  //  }
}
Example #6
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);
}
Example #7
0
// store a particular output
void preset_store_out(u32 preIdx, u32 outIdx) {
  presets[preIdx].outs[outIdx].enabled = 1; //net_get_out_preset(outIdx);
  presets[preIdx].outs[outIdx].target = net_get_target(outIdx);  
}