-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release Update region start to playhead position by ID v1.2 #1485
base: master
Are you sure you want to change the base?
Release Update region start to playhead position by ID v1.2 #1485
Conversation
v1.2 Update region start to playhead position by ID
@@ -0,0 +1,80 @@ | |||
-- @description Update region start to playhead position by ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad naming. Better: "Set region start to edit cursor, define region by ID"
-- @description Update region start to playhead position by ID | ||
-- @author Edson Del Santoro | ||
-- @version 1.2 | ||
-- @changelog v1.2 Update region start to playhead position by ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- @changelog
-- + initial release
reaper.SetProjectMarkerByIndex(0, region_marker_index, true, new_start, rgn_end, selected_region.rgn_index, rgn_name, 0) | ||
|
||
-- End undo-block | ||
reaper.Undo_EndBlock2(0, SCRIPT_NAME, -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 0xFFFFFFFF instead -1
https://www.reaper.fm/sdk/plugin/reaper_plugin.h
UNDO_STATE_ALL
UNDO_STATE_ALL 0xFFFFFFFF
UNDO_STATE_TRACKCFG 1 // has track/master vol/pan/routing, ALL envelopes (matser included)
UNDO_STATE_FX 2 // track/master fx
UNDO_STATE_ITEMS 4 // track items
UNDO_STATE_MISCCFG 8 // loop selection, markers, regions, extensions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the choice between -1 and 0xFFFFFFFF affect the result or reliability?
-1 was recommended by Schwa and as far as i understand in C that's one and the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the choice between -1 and 0xFFFFFFFF affect the result or reliability? -1 was recommended by Schwa and as far as i understand in C that's one and the same
It is not the same. -1 stay for "all byte set" while 0xFFFFFFFF stay for "first 8 bytes set", I remember I got different results somewhere using -1, nothing serious but I don`t remember where it differs I just remember 0xFFFFFFFF worked as expected and -1 did not. I use it everythere since that time, maybe they changed that in API in the past (3+ years ago) and that was really rarely undocumented corner case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 bytes*
In this case it's equivalent: Undo_EndBlock2
's extraflags
is a 32-bit integer so -1 and 0xFFFFFFFF both set all 32 bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MichaelPilyavskiy for these improvements.
v1.2 Update region start to playhead position by ID