Skip to content

add reorganize button #15

@santolucito

Description

@santolucito

It can get difficult to keep track of all the tracks one is controlling at the same time. It would be nice to have a "reorganize" button that rearranged the code so that all lines of code that affected a particular track number were next to each other. For example

turn this code:

function genBeat(b, s, currentTimestep){

  b.track1vol = pattern((val,i) => 1 - (i % 2));
  //b.track1vol.splice(3,13,...Array(13).fill(0));
  b.track1dur = pattern((val,i) => 1);
  b.track6vol = pattern((val,i) => 1 % (2 - (i % 4)));
  //b.track6vol.splice(9,7,...Array(7).fill(0));
  
  b.track4dur[2] = 4;
  b.track3dur[6] = 3;
  b.track3vol = pattern((val,i) => 1 % (6 % (i - 2)));
  b.track3vol.splice(10,6,...Array(6).fill(0));
  b.track6dur = pattern((val,i) => (i+4) % 3);
  s.track6_thumb = 1 //currentTimestep/16;
 
  s.track4_thumb = Math.random()*0.3 + 0.7;
  return {beat:b, sliders:s};
};

into this code

function genBeat(b, s, currentTimestep){

  b.track1vol = pattern((val,i) => 1 - (i % 2));
  //b.track1vol.splice(3,13,...Array(13).fill(0));
  b.track1dur = pattern((val,i) => 1);

  b.track3dur[6] = 3;
  b.track3vol = pattern((val,i) => 1 % (6 % (i - 2)));
  b.track3vol.splice(10,6,...Array(6).fill(0));
  
  b.track4dur[2] = 4;
  s.track4_thumb = Math.random()*0.3 + 0.7;

  b.track6dur = pattern((val,i) => (i+4) % 3);
  s.track6_thumb = 1 //currentTimestep/16;
  b.track6vol = pattern((val,i) => 1 % (2 - (i % 4)));
  //b.track6vol.splice(9,7,...Array(7).fill(0));

  return {beat:b, sliders:s};
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions