Old 06-22-2016, 02:19 AM   #1
PitchSlap
Human being with feelings
 
PitchSlap's Avatar
 
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,795
Default REQ: Select every other unmuted item on selected track(s)

A script to "selects every other unmuted item on the selected track(s)" would save me a lot of time. (if the mute status was ignored it wouldn't be a big deal)

When working on older projects one thing I always do is select every other version of the same item on a track and reverse the stereo.

I find it's a very simple way to add subtle variation to what otherwise could be a similar section.

It can be a bit tedious with many items and I'd love to be able to speed up the process, but lack the scripting ability.

If anyone else would find this useful and wants to take a crack at it I'd be quite grateful!

Thanks.
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
PitchSlap is offline   Reply With Quote
Old 06-22-2016, 03:06 AM   #2
Sumalc
Human being with feelings
 
Join Date: Oct 2009
Location: France
Posts: 745
Default

may be something like ?
SWS SEL UNMUTED ITEMS on selected track
Sumalc is offline   Reply With Quote
Old 06-22-2016, 05:35 AM   #3
PitchSlap
Human being with feelings
 
PitchSlap's Avatar
 
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,795
Default

Quote:
Originally Posted by Sumalc View Post
may be something like ?
SWS SEL UNMUTED ITEMS on selected track
That could be part of it. The tricky part is selecting only half of the items (one selected, the next unselected etc.).
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
PitchSlap is offline   Reply With Quote
Old 06-22-2016, 06:54 AM   #4
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Try this EEL script.

It's the "Item selector" script from ReaPack. I edited it a little bit - changes are in red color:

Code:
function highlight_mouse_hover()
(
  gfx_r += 0.1;
  gfx_g += 0.1;
  gfx_b += 0.1;
);

function highlight_mouse_on_press()
(
  gfx_r += 0.2;
  gfx_g += 0.2;
  gfx_b += 0.2;
);

 function draw_string_step(x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;
  
  step_s = sprintf(#, "%d", step);
  gfx_measurestr(step_s, w, h);
  // is mouse on string?
  mouse_x >= x && mouse_x <= x + gfx_w && mouse_y >= y && mouse_y <= y + h ? (
    highlight_mouse_hover();
    mouse_wheel != 0 ? (
      highlight_mouse_on_press();
      step += (mouse_wheel / abs(mouse_wheel));
      step < 1 ? step = 1;
      mouse_wheel = 0;
    );
    mouse_cap == 5 ? (
      step = 1;
    );
  );
  gfx_printf("Select every ");
  gfx_printf("%d", step);
  gfx_printf(". item");
);

 function draw_string_offset(x, y, r, g, b, a) local (w, h)
( 
  gfx_r = r;
  gfx_g = g;
  gfx_b = b;
  gfx_a = a;
  
  offset_s = sprintf(#, "%d", offset);
  gfx_measurestr(offset_s, w, h);
  // is mouse on string?
  mouse_x >= x && mouse_x <= x + gfx_w && mouse_y >= y && mouse_y <= y + h ? (
    highlight_mouse_hover();
    mouse_wheel != 0 ? (
      highlight_mouse_on_press();
      offset += (mouse_wheel / abs(mouse_wheel));
      offset < 0 ? offset = 0;
      offset > step - 1 ? offset = step - 1;
      mouse_wheel = 0;
    );
    mouse_cap == 5 ? (
      offset = 0;
    );
  );
  gfx_printf("Offset: ");
  gfx_printf("%d", offset);
);

function is_item_within_timerange(itemId, range_start, range_end)
(
  itemId ? (
    pos = GetMediaItemInfo_Value(itemId, "D_POSITION"); // item start
    length = GetMediaItemInfo_Value(itemId, "D_LENGTH"); // item end
    end_pos = pos + length;
    pos >= time_sel_start && end_pos <= time_sel_end ? 1 : 0; // if item is within time range -> return 1, else 0
  ) : -1; // else return -1
);

function select_items()
(
  GetSet_LoopTimeRange(0, 0, time_sel_start, time_sel_end, 0);
  index = 0;
  k = -offset;
  tr = GetSelectedTrack(0, 0);
  time_sel_start != time_sel_end ? (
    loop(CountTrackMediaItems(tr),
      item = GetTrackMediaItem(tr, index);
      is_item_within_timerange(item, time_sel_start, time_sel_end) && !GetMediaItemInfo_Value(item, "B_MUTE") ? (
        k % step == 0 ? ( 
          SetMediaItemSelected(item, 1);
        ) : (
          SetMediaItemSelected(item, 0);
        );
        k += 1; 
      );
      index += 1;
    );
  ) : (
    loop(CountTrackMediaItems(tr),
      item = GetTrackMediaItem(tr, index);
      !GetMediaItemInfo_Value(item, "B_MUTE") ? (
        k % step == 0 ? ( 
          SetMediaItemSelected(item, 1);
        ) : (
          SetMediaItemSelected(item, 0);
        );
        k += 1;
      );
      index += 1;
    );
  );
  UpdateArrange();
  last_step = step;
  last_offset = offset;
);

function run()
(
  gfx_x = gfx_y = 20;
  gfx_r = 0.5;
  gfx_g = 0.8;
  gfx_b = 0.5;
  gfx_a = 1; 
  //draw_string_mode(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);
  
  draw_string_step(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);
  gfx_x = 20;
  gfx_y += 2 * gfx_texth;
 
  draw_string_offset(gfx_x, gfx_y, 0.5, 0.8, 0.5, 1);

  (mouse_x >= 0 && mouse_x <= gfx_w && mouse_y >= 0 && mouse_y <= gfx_h) && (last_step != step || last_offset != offset  || need_update == 1) ? (
    select_items();
    last_step = step;
    last_offset = offset;
  );
  need_update = 0;
  mouse_cap == 1 ? lmb_down = 1 : lmb_down = 0;
  
  gfx_update();
  gfx_getchar() >= 0 ? defer("run();");
);

gfx_init("Item selector", 200, 100);
gfx_setfont(1, "Arial", 16);

step = 1;
last_step = 1;
offset = 0;
last_offset = 0;

need_update = 0;

lmb_down = 0;

run();

Last edited by spk77; 06-22-2016 at 06:59 AM.
spk77 is offline   Reply With Quote
Old 06-22-2016, 07:02 AM   #5
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Edited the last post - should work now.

spk77 is offline   Reply With Quote
Old 06-22-2016, 10:22 PM   #6
PitchSlap
Human being with feelings
 
PitchSlap's Avatar
 
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,795
Default

THANK YOU! This is exactly what I was hoping for! This will save me so much time.

The offset and that it only works within the time selection is great too.

I like that I can keep the window open and the items stay selected when changing tracks.

I didn't even know about Reapack until now, finding some useful things. I noticed you made a selection script that works on multiple tracks, would it be possible to to create a modified version like this one (nth item + offset) when you find time? It would speed things up even more since I usually have way too many tracks in my projects (the one I'm working on now is 292 tracks lol).


Also it took me a bit to figure out how to change the numbers. I usually have an external mouse plugged into my laptop while at home, but with the built in trackpad (which I hate lol) it's pretty hard to change the numbers since using there's no mousewheel, only a small section on the side that's super jumpy.

If we could also use text entry, or the + or - keys while hovered over the text it would be a big help for track pad users...


Thanks again!
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
PitchSlap is offline   Reply With Quote
Old 09-19-2016, 01:47 AM   #7
PitchSlap
Human being with feelings
 
PitchSlap's Avatar
 
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,795
Default

I use this a ton.

The only issue is currently for each track the "select every" needs to be changed, then returned to the original value for the items to be selected.


If it's an easy tweak, I'd love for it to work on all selected tracks since I often do this process for 50 or more tracks in a project.
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
PitchSlap is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.