Old 06-11-2010, 11:56 AM   #1
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default Access the new Nudge function through API?

This was mentioned in the FR section but maybe it fits better here...

Here's an excerpt from the original post explaining the goal:

Quote:
RPR_Main_OnCommand(nudge-function, type, what, count, countof, direction, snap)

Type=0,1 (nudge, set, other)
What=0-6 (seven possibilities of what or how to nudge)
count=numerical time indication
countof=0-9 (what mode or timebase)
direction=0,1 (left or right)
snap=0,1 (off, on)
Basically this would allow us to write scripts that run a very specific combination of the nudge dialog settings, using one action to do it all.

I could write a script that was like so:
RPR_Main_OnCommand([nudge_action_ID], 0, 3, 5, 1, 1, 0)

Which would nudge the left edge of any selected items right by 5ms with no snapping.

Is this possible or something that might be considered in the future? It would be amazing to be able to do the same thing with the Quantize dialog for example.
AdamWathan is offline   Reply With Quote
Old 06-11-2010, 02:59 PM   #2
sfzgeek
Human being with feelings
 
sfzgeek's Avatar
 
Join Date: Feb 2009
Location: Dunedin, New Zealand
Posts: 205
Default

Quote:
Originally Posted by AdamWathan View Post
Is this possible or something that might be considered in the future?
I would have thought something like nudge could already be achieved using the current API set. Maybe I'm wrong. Certainly, I have written some of my own nudge-type actions in the past. The new nudge features would seem to bring something new to typical end-users rather than DIY action builders and users.

I'm all for expansion of the API but would personally prefer the REAPER team to focus on expanding the API to provide a comprehensive set of building blocks that let's us build whatever we like, however we like.
__________________
My rawk band: The Hidden Venture.
sfzgeek is offline   Reply With Quote
Old 06-13-2010, 12:25 AM   #3
sfzgeek
Human being with feelings
 
sfzgeek's Avatar
 
Join Date: Feb 2009
Location: Dunedin, New Zealand
Posts: 205
Default

Then again... this looks way easier than building your own. (From the ReaScript docs)

Code:
nudgeflag: &1=set to value (otherwise nudge by value), &2=snap
nudgewhat: 0=position, 1=left trim, 2=left edge, 3=right edge, 4=contents, 5=duplicate, 6=edit cursor
nudgeunit: 0=ms, 1=seconds, 2=grid, 3=256th notes, ..., 15=whole notes, 16=measures.beats (1.15 = 1 measure + 1.5 beats), 17=samples, 18=frames, 19=pixels, 20=item lengths, 21=item selections
value: amount to nudge by, or value to set to
reverse: in nudge mode, nudges left (otherwise ignored)
copies: in nudge duplicate mode, number of copies (otherwise ignored)

bool ApplyNudge(ReaProject* project, int nudgeflag, int nudgewhat, int nudgeunits, double value, bool reverse, int copies)
Enjoy!
__________________
My rawk band: The Hidden Venture.
sfzgeek is offline   Reply With Quote
Old 06-14-2010, 06:08 AM   #4
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default

Yup very excited to see we got it! Already putting it to good use!

One thing I'm confused about though, this parameter:

ReaProject* project

...I've just been using 0 because I don't know what else to put here, what exactly is it expecting?

Edit: Also, the "nudgeflag", what does the &1 for set and &2 for snap mean? It's just an integer no? The & sign has me a bit confused... Sorry for being a noob.

Last edited by AdamWathan; 06-14-2010 at 06:17 AM.
AdamWathan 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:06 AM.


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