Old 08-03-2019, 10:37 AM   #1
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,639
Default v5.981+dev0803 - August 3 2019

v5.981+dev0803 - August 3 2019
  • + Ruler: support more display combinations (Measures,Beats / H:M:S:F, etc)
  • # API: add GetEnvelopeInfo_Value()
  • # API: add I_TCPH/I_TCPY read-only track attributes
  • # GetUserInput() centering fix
  • # envcp: fix drawing of envcps whose tcps are offscreen
  • # midi editor: obey window positioning pref for humanize/quantize/display quantize/note properties/filter/transpose
  • # mixer: fix FX dragging
  • # mixer: fix master context menu
This thread is for pre-release features discussion. Use the Feature Requests forum for other requests.

Changelog - Pre-Releases

Generated by X-Raym's REAPER ChangeLog to BBCode
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan R÷mer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is offline   Reply With Quote
Old 08-03-2019, 10:39 AM   #2
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

lets begin the recoding!

EDIT:
Does GetTrackFromPoint include envelopes? If not then I still cannot do anything (since I'm looking at track/envelope under mouse cursor)

Last edited by Sexan; 08-03-2019 at 11:01 AM.
Sexan is offline   Reply With Quote
Old 08-03-2019, 11:07 AM   #3
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,390
Default

Quote:
Originally Posted by Sexan View Post
lets begin the recoding!

EDIT:
Does GetTrackFromPoint include envelopes? If not then I still cannot do anything (since I'm looking at track/envelope under mouse cursor)
Yes, GetTrackFromPoint() sets the info parameter if the point is within an envelope lane (it doesn't tell you *which* env that is, but there's a new API you can use to figure that out).

Last edited by Justin; 08-03-2019 at 11:24 AM.
Justin is offline   Reply With Quote
Old 08-03-2019, 11:10 AM   #4
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

Quote:
Originally Posted by Justin View Post
Yes, and it sets the info thingy if it's an env lane that contains the point (it doesn't tell you *which* env that is, but there's a new API you can use to figure that out).
You referring to the new API above or there is some new API also in the previous versions (sorry was off some time not much up to date)?
Sexan is offline   Reply With Quote
Old 08-03-2019, 11:23 AM   #5
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,390
Default

Quote:
Originally Posted by Sexan View Post
You referring to the new API above or there is some new API also in the previous versions (sorry was off some time not much up to date)?
editing my original post for clarity -- GetTrackFromPoint() has not changed, the new API added lets you enumerate the position of the env lanes.
Justin is offline   Reply With Quote
Old 08-03-2019, 12:01 PM   #6
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

I'm sure I forgot something really stupid here:

Store all tracks
Code:
function GetTracksXYH()
   TBH = {}
   for i = 1 , reaper.CountTracks(0) do
      local tr = reaper.GetTrack(0, i-1)
      local tr_h = reaper.GetMediaTrackInfo_Value( tr, "I_TCPH" )
      local tr_t = reaper.GetMediaTrackInfo_Value( tr, "I_TCPY" )
      local tr_b = tr_t + tr_h
      for j = 1 , reaper.CountTrackEnvelopes(tr) do
         local env = reaper.GetTrackEnvelope(tr, j-1)
         local env_h = reaper.GetEnvelopeInfo_Value(env,"I_TCPH")
         local env_t = reaper.GetEnvelopeInfo_Value(env,"I_TCPY")
         local env_b = env_t + env_h
         TBH[env] = {t = env_t, b = env_b, h = env_h}
      end
      TBH[tr] = {t = tr_t, b = tr_b, h = tr_h}
   end
end
Retrieve from mouse
Code:
local function GetTracksFromMouse(x, y)
   retval, info = reaper.GetTrackFromPoint(x, y)
   if retval and info == 0 then
      return retval, TBH[retval].t, TBH[retval].b, TBH[retval].h
   elseif retval and info == 1 then
      for i = 1 , reaper.CountTrackEnvelopes(retval) do
         local env = reaper.GetTrackEnvelope(retval, i-1)
         if TBH[env].t < y and TBH[env].b > y then
            return env, TBH[env].t, TBH[env].b, TBH[env].h
         end
      end
   end
end
It very wonky, does not get every envelope,skips some, finds few in same lane.
Must be something stupid did or forgot ?
Sexan is offline   Reply With Quote
Old 08-03-2019, 01:02 PM   #7
MaestroS
Human being with feelings
 
Join Date: Nov 2017
Posts: 34
Default

Check!!!!!!!

Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-
MaestroS is offline   Reply With Quote
Old 08-03-2019, 01:47 PM   #8
Alkamist
Human being with feelings
 
Join Date: Dec 2011
Posts: 458
Default

Thanks for the additions to the API, they are very helpful!

Any chance at getting SetEnvelopeInfo_Value() as well? Setting envelope height through the state chunk performs way too slowly for my purposes. Unless there is some other way I'm not aware of?

This is how I was doing it, maybe this isn't optimal though:

Code:
reaper.SetEnvelopeStateChunk(envelope, envelopeState:gsub("LANEHEIGHT %d+", "LANEHEIGHT " .. tostring(newHeight)), false)
Alkamist is offline   Reply With Quote
Old 08-03-2019, 02:39 PM   #9
nappies
Human being with feelings
 
nappies's Avatar
 
Join Date: Dec 2017
Posts: 126
Default

Quote:
Originally Posted by MaestroS View Post
Check!!!!!!!

Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-

Many of SWS function broken now, but it's worth it!
nappies is online now   Reply With Quote
Old 08-03-2019, 02:57 PM   #10
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,300
Default Minor bug

With no tracks, show master track, then hide master track, it leaves track background...



Windows 10(1903) x64
Edgemeal is offline   Reply With Quote
Old 08-03-2019, 03:32 PM   #11
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

Ok, so in envelope case arrange view Y start needs to be accounted, but on tracks not....

Code:
local function GetTracksFromMouse(y, area)
   retval, info = reaper.GetTrackFromPoint( mouse.x, y )
   if retval and info == 0 then
      return retval, TBH[retval].t, TBH[retval].b, TBH[retval].h
   elseif retval and info == 1 then
      --------------------------------------------
      local _, x_view_start, y_view_start, x_view_end, y_view_end = reaper.JS_Window_GetRect(track_window)
      y = y - y_view_start    -- <-------- THIS NEEDS TO BE ADDED OR IT DOES NOT WORK
     ---------------------------------------------
      for i = 1 , reaper.CountTrackEnvelopes(retval) do
         local env = reaper.GetTrackEnvelope(retval, i-1)
         if TBH[env].t <= y and TBH[env].b > y then
            msg(env)
            return env, TBH[env].t, TBH[env].b, TBH[env].h
         end
      end
   end
end
Edit: Did not read the API well... envelopes are relative like Justin pointed out

EDIT2: Yeah this is needed for now

Last edited by Sexan; 08-03-2019 at 10:57 PM.
Sexan is offline   Reply With Quote
Old 08-03-2019, 03:41 PM   #12
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,390
Default

Quote:
Originally Posted by Sexan View Post
I'm sure I forgot something really stupid here:

Store all tracks
Code:
function GetTracksXYH()
   TBH = {}
   for i = 1 , reaper.CountTracks(0) do
      local tr = reaper.GetTrack(0, i-1)
      local tr_h = reaper.GetMediaTrackInfo_Value( tr, "I_TCPH" )
      local tr_t = reaper.GetMediaTrackInfo_Value( tr, "I_TCPY" )
      local tr_b = tr_t + tr_h
      for j = 1 , reaper.CountTrackEnvelopes(tr) do
         local env = reaper.GetTrackEnvelope(tr, j-1)
         local env_h = reaper.GetEnvelopeInfo_Value(env,"I_TCPH")
         local env_t = reaper.GetEnvelopeInfo_Value(env,"I_TCPY")
         local env_b = env_t + env_h
         TBH[env] = {t = env_t, b = env_b, h = env_h}
      end
      TBH[tr] = {t = tr_t, b = tr_b, h = tr_h}
   end
end
Don't forget
Code:
env_t = env_t + tr_t
(the envelope position is relative to the track position)
Justin is offline   Reply With Quote
Old 08-03-2019, 03:52 PM   #13
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,390
Default

Quote:
Originally Posted by Edgemeal View Post
With no tracks, show master track, then hide master track, it leaves track background...



Windows 10(1903) x64
fixing, thanks!
Justin is offline   Reply With Quote
Old 08-03-2019, 03:57 PM   #14
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

Maybe today I'm genuinely stupid but... are you sure about
Code:
env_t = env_t + tr_t
?

because for the first track which has I_TCPY of 0, adding that to envelope adds nothing?

Nothing changed it still offseted
Sexan is offline   Reply With Quote
Old 08-03-2019, 04:15 PM   #15
nappies
Human being with feelings
 
nappies's Avatar
 
Join Date: Dec 2017
Posts: 126
Default GetTrackFromPoint

It seems GetTrackFromPoint a little bit cpu hungry in defer cycles.

nappies is online now   Reply With Quote
Old 08-03-2019, 04:17 PM   #16
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,639
Default

Could be, that this is only ShowConsoleMsg().
I had similar results with other console outputs.
Only a guess, though.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan R÷mer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is offline   Reply With Quote
Old 08-03-2019, 04:20 PM   #17
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

yeah, I think its the console because I do not have issues with 100+ tracks at all


Glorious 60fps!!! (sorry forgot about it haha)
Sexan is offline   Reply With Quote
Old 08-03-2019, 04:21 PM   #18
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 719
Default

Yeah the console is a real pig when scrolling is involved. Don't log anything when you want to test performance/responsiveness.
tack is offline   Reply With Quote
Old 08-03-2019, 04:52 PM   #19
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,969
Default

Quote:
Originally Posted by _Stevie_ View Post
Could be, that this is only ShowConsoleMsg().
I had similar results with other console outputs.
Only a guess, though.
I'd think so too.
You could print to console only if found track has changed and it should be better I asume, something like this (pseudo-ish)

Code:
lastTr = -1
function cpu()
  tr = ...
  if tr ~= lastTr then
      m(tr)
  end
  lastTr = tr
  reaper.defer(cpu)
end
nofish is offline   Reply With Quote
Old 08-03-2019, 05:25 PM   #20
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,390
Default

Quote:
Originally Posted by Sexan View Post
Maybe today I'm genuinely stupid but... are you sure about
Code:
env_t = env_t + tr_t
?

because for the first track which has I_TCPY of 0, adding that to envelope adds nothing?

Nothing changed it still offseted
Yes. Having said that, you can't pass the mouse screen coordinates in, it must be arrange-view coordinates. and to get that (for now) you probably need to use an extension-provided API (going to add a general coordinate conversion API)...

e.g.:

Code:
local function GetTrackEnvFromMouse(x, y)
  local tr, info = reaper.GetTrackFromPoint(x, y)

  if tr and info == 1 then

   local wnd = reaper.BR_Win32_FindWindowEx(
     reaper.BR_Win32_HwndToString(reaper.BR_Win32_GetMainHwnd()),0,
       "REAPERTrackListWindow","",true,false)

    x,y = reaper.BR_Win32_ScreenToClient(wnd,x,y)
    local tr_t = reaper.GetMediaTrackInfo_Value(tr, "I_TCPY" )
    for i = 1 , reaper.CountTrackEnvelopes(tr) do
       local env = reaper.GetTrackEnvelope(tr, i-1)
       local env_t = reaper.GetEnvelopeInfo_Value(env,"I_TCPY") + tr_t
       local env_h = reaper.GetEnvelopeInfo_Value(env,"I_TCPH")
       
       if y >= env_t and y < env_t + env_h then
         return tr, env
       end
    end
   end
  return tr, nil
end


function run() 
track,env = GetTrackEnvFromMouse(reaper.GetMousePosition())
reaper.defer(run);

if env ~= nil then
_,name  = reaper.GetEnvelopeName(env)
else
name = ""
end

end

run()

Last edited by Justin; 08-03-2019 at 06:07 PM. Reason: oops fixed script
Justin is offline   Reply With Quote
Old 08-04-2019, 02:32 AM   #21
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

Edit...

Last edited by Sexan; 08-04-2019 at 03:47 AM.
Sexan is offline   Reply With Quote
Old 08-04-2019, 07:23 AM   #22
DANIELE
Human being with feelings
 
DANIELE's Avatar
 
Join Date: Aug 2015
Location: Florence, Italy
Posts: 347
Default

Quote:
Originally Posted by MaestroS View Post
Check!!!!!!!

Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-

It's a pity, I use Contextual Toolbars a lot!! I hope SWS developers update their extension.
__________________
Audio: AKG-K240 MKII, Adam A7X, Audient iD22 - Steinberg UR22; Piano: Yamaha P-250 - NI S88 MK1;
!!DANIELE EPIC ORCHESTRAL MUSIC!! |*| STAR WARS SERIES
DANIELE is offline   Reply With Quote
Old 08-04-2019, 07:30 AM   #23
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 2,639
Default

Quote:
Originally Posted by DANIELE View Post
It's a pity, I use Contextual Toolbars a lot!! I hope SWS developers update their extension.
I'm sure they will, it's just a matter of time, since not many people are working on SWS.
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan R÷mer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is offline   Reply With Quote
Old 08-04-2019, 01:48 PM   #24
DANIELE
Human being with feelings
 
DANIELE's Avatar
 
Join Date: Aug 2015
Location: Florence, Italy
Posts: 347
Default

Quote:
Originally Posted by _Stevie_ View Post
I'm sure they will, it's just a matter of time, since not many people are working on SWS.

I know, let's hope they do it soon, I hate to break my workflow like this.
__________________
Audio: AKG-K240 MKII, Adam A7X, Audient iD22 - Steinberg UR22; Piano: Yamaha P-250 - NI S88 MK1;
!!DANIELE EPIC ORCHESTRAL MUSIC!! |*| STAR WARS SERIES
DANIELE is offline   Reply With Quote
Old 08-04-2019, 04:01 PM   #25
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,969
Default

Quote:
Originally Posted by MaestroS View Post
Check!!!!!!!

Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-
@Justin
If tracks no longer have windows how do we detect 'mouse over TCP' now?
TrackFromPoint() works over TCP too but we'd need to know TCP width to be able to differentiate between TCP and track lane I guess?
nofish is offline   Reply With Quote
Old 08-04-2019, 04:34 PM   #26
nappies
Human being with feelings
 
nappies's Avatar
 
Join Date: Dec 2017
Posts: 126
Default

Quote:
Originally Posted by nofish View Post
@Justin
If tracks no longer have windows how do we detect 'mouse over TCP' now?
TrackFromPoint() works over TCP too but we'd need to know TCP width to be able to differentiate between TCP and track lane I guess?
Here how we get tcp panel to combine this two functions. GetTrackFromPoint get only only tcp panel. JS_API required.

Code:
function  get_tcp_win()
local hwnd= reaper.JS_Window_FindChildByID( reaper.GetMainHwnd(), 1259)
 tcp_win = reaper.JS_Window_GetRelated(reaper.JS_Window_GetRelated(hwnd, "NEXT"), "NEXT")
return tcp_win
end


function GetTrackFromPoint(x, y)

if reaper.JS_Window_FromPoint( x, y )==get_tcp_win() then

local _, left, tcptop, right, _ = reaper.JS_Window_GetClientRect(get_tcp_win())

local count_tr=reaper.CountTracks(0) 
if count_tr==0 then return end 
for i=1, count_tr do  
local tr=reaper.GetTrack( 0, i-1)
local tr_h = reaper.GetMediaTrackInfo_Value( tr, "I_TCPH" )
local tr_y = reaper.GetMediaTrackInfo_Value( tr, "I_TCPY" )
local top = (tcptop+tr_y) 
local bottom  = (top+tr_h) 
if x> left and x<right and y>top and y<bottom then track=tr break end 
 
end 
end
return track
end
nappies is online now   Reply With Quote
Old 08-04-2019, 05:27 PM   #27
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,969
Default

Thank you.
nofish is offline   Reply With Quote
Old 08-04-2019, 10:14 PM   #28
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 23,234
Default

Quote:
Originally Posted by DANIELE View Post
I know, let's hope they do it soon, I hate to break my workflow like this.
Then you should stay on official builds
EvilDragon is online now   Reply With Quote
Old 08-05-2019, 01:56 AM   #29
DANIELE
Human being with feelings
 
DANIELE's Avatar
 
Join Date: Aug 2015
Location: Florence, Italy
Posts: 347
Default

Quote:
Originally Posted by EvilDragon View Post
Then you should stay on official builds

Infact, this is what I do. I'm only wondering about the future.
__________________
Audio: AKG-K240 MKII, Adam A7X, Audient iD22 - Steinberg UR22; Piano: Yamaha P-250 - NI S88 MK1;
!!DANIELE EPIC ORCHESTRAL MUSIC!! |*| STAR WARS SERIES
DANIELE is offline   Reply With Quote
Old 08-05-2019, 02:26 AM   #30
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,441
Default

Quote:
Originally Posted by nofish View Post
@Justin
If tracks no longer have windows how do we detect 'mouse over TCP' now?
TrackFromPoint() works over TCP too but we'd need to know TCP width to be able to differentiate between TCP and track lane I guess?
It would be cool if TrackFromPoint could also give additional TCP,MCP info:

retval, info, view = reaper.GetTrackFromPoint( screen_x, screen_y )

view 0
view 1 - tcp
view 2 - mcp
Sexan is offline   Reply With Quote
Old 08-05-2019, 03:22 AM   #31
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,969
Default

Quote:
Originally Posted by Sexan View Post
It would be cool if TrackFromPoint could also give additional TCP,MCP info:

retval, info, view = reaper.GetTrackFromPoint( screen_x, screen_y )

view 0
view 1 - tcp
view 2 - mcp
Yep, something like this.
The way posted by nappies above is rather involved.
nofish is offline   Reply With Quote
Old 08-05-2019, 09:47 AM   #32
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,490
Default

Quote:
Originally Posted by Justin View Post
Yes, GetTrackFromPoint() sets the info parameter if the point is within an envelope lane (it doesn't tell you *which* env that is, but there's a new API you can use to figure that out).
I tried GetTrackFromPoint yesterday and it's working great with one exception: you need to see the tracks. So you can't run a script doing something in the background with trackheights, unless all tracks are visible.
Is there a way to add an option, that allows getting the tracks at the position without having the main-Reaper-window in the front?
Some kind of optional boolean parameter or something?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine 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 10:32 PM.


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