-
Notifications
You must be signed in to change notification settings - Fork 148
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 Protools rudimentary editing tools v1.0 #1469
Open
fredKuko
wants to merge
1
commit into
ReaTeam:master
Choose a base branch
from
fredKuko:reapack.com_upload-1733010772067
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- @description Protools rudimentary editing tools | ||
-- @author Frederic Kukovicic | ||
-- @version 1.0 | ||
-- @provides | ||
-- [main] FKVC_ProtoolsEditingTools1/CutLeft.lua | ||
-- [main] FKVC_ProtoolsEditingTools1/CutRight.lua | ||
-- [main] FKVC_ProtoolsEditingTools1/MoveEditCursorToNextCut.lua | ||
-- [main] FKVC_ProtoolsEditingTools1/MoveEditCursorToPreviousCut.lua | ||
-- [main] FKVC_ProtoolsEditingTools1/NudgeCursorOnTheLeft.lua | ||
-- [main] FKVC_ProtoolsEditingTools1/NudgeCursorOnTheRight.lua | ||
-- @about | ||
-- # Protools rudimentary editing tools | ||
-- | ||
-- As a long-time Pro Tools user, I relied heavily on certain daily tools for audio editing. To replicate those tools and workflows in Reaper, I decided to script similar actions so I could use them in Reaper as well. Here are the actions I recreated: | ||
-- | ||
-- - CutLeft: Removes the left part of the selected media item from the playback position. | ||
-- | ||
-- - CutRight: Removes the right part of the selected media item from the playback position. | ||
-- | ||
-- - MoveEditCursorToNextCut: Moves the edit cursor to the next cut in any media item and selects it. | ||
-- | ||
-- - MoveEditCursorToPreviousCut: Moves the edit cursor to the previous cut in any media item and selects it. | ||
-- | ||
-- Note: The "move edit cursor" actions work on the currently selected track, or only on the first track if multiple tracks are selected. | ||
-- | ||
-- - NudgeCursorToTheLeft: Moves the playback cursor 1 frame to the left and plays the audio. | ||
-- | ||
-- - NudgeCursorToTheRight: Moves the playback cursor 1 frame to the right and plays the audio. | ||
|
||
reaper.ShowMessageBox("Thank you for using this tool. Have fun!", "Message", 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file (the main package file containing the metadata but, in this case, no useful code) should not be added to the user's action list nor installed on their computer. Set the "Resource type" to "Don't install" and leave the file contents empty of code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
-- @noindex | ||
|
||
-- Global variables -- | ||
|
||
item = reaper.GetSelectedMediaItem(0,0); | ||
itemLength = reaper.GetMediaItemInfo_Value(item,"D_LENGTH"); | ||
itemPosition = reaper.GetMediaItemInfo_Value(item,"D_POSITION"); | ||
cursorPosition = reaper.GetCursorPosition(); | ||
refreshUI = true; | ||
|
||
---------------------------------------------------------------------- | ||
function Reverse() | ||
reaper.Main_OnCommand(41051,0); | ||
end | ||
---------------------------------------------------------------------- | ||
function Cut() | ||
|
||
local refrshUI = false; | ||
reaper.SetMediaItemLength(item, right, refreshUI); | ||
end | ||
---------------------------------------------------------------------- | ||
function MoveToCursor() | ||
|
||
reaper.SetMediaItemPosition(item, cursorPosition, refreshUI); | ||
end | ||
---------------------------------------------------------------------- | ||
function Operations() | ||
itemEnd = itemPosition + itemLength; | ||
right = itemEnd - cursorPosition; | ||
end | ||
---------------------------------------------------------------------- | ||
-- Main Function -- | ||
|
||
function CutLeft() | ||
|
||
reaper.Undo_BeginBlock() | ||
Operations(); | ||
Reverse(); | ||
Cut(); | ||
Reverse(); | ||
MoveToCursor(); | ||
reaper.Undo_EndBlock("Cut Left",0) | ||
end | ||
---------------------------------------------------------------------- | ||
-- Action -- | ||
|
||
CutLeft(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-- @noindex | ||
|
||
-- Global variables -- | ||
|
||
item = reaper.GetSelectedMediaItem(0,0); | ||
itemPosition = reaper.GetMediaItemInfo_Value(item,"D_POSITION"); | ||
cursorPosition = reaper.GetCursorPosition(); | ||
refreshUI = true; | ||
|
||
---------------------------------------------------------------------------------------------------------------------- | ||
function Operations() | ||
|
||
itemStart = itemPosition; | ||
left = cursorPosition - itemStart; | ||
|
||
end | ||
|
||
function Cut() | ||
|
||
local refrshUI = false; | ||
reaper.SetMediaItemLength(item, left, refreshUI); -- resize the item to the length of "left" by cutting "right". | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------- | ||
-- Main Function -- | ||
|
||
function CutRight() | ||
|
||
Operations(); | ||
Cut(); | ||
|
||
end | ||
|
||
---------------------------------------------------------------------------------------------------------------------- | ||
-- Action -- | ||
|
||
CutRight(); |
134 changes: 134 additions & 0 deletions
134
Items Editing/FKVC_ProtoolsEditingTools1/MoveEditCursorToNextCut.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
-- @noindex | ||
|
||
-- Global Variables -- | ||
|
||
cursorPos = reaper.GetCursorPosition(0); | ||
currentTrack = reaper.GetSelectedTrack(0,0); | ||
|
||
i = 0; | ||
t = 0; | ||
|
||
iMax = reaper.CountTrackMediaItems(currentTrack); | ||
iLast = iMax - 1; | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToStartOfFirstItem() | ||
|
||
reaper.SetEditCurPos(firstItemStart, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToStartOfItem() | ||
|
||
reaper.SetEditCurPos(nextItemStart, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToEndOfItem() | ||
|
||
reaper.SetEditCurPos(iEnd, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToEndOfLastItem() | ||
|
||
reaper.SetEditCurPos(lastItemEnd, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function SelectNextItem() | ||
|
||
reaper.SetMediaItemSelected(nextItem, 1); | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function SelectFirstItem() | ||
|
||
reaper.SetMediaItemSelected(firstItem, 1); | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function UnselectAllItems() | ||
|
||
reaper.SelectAllMediaItems(0,0); | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveEditCursorToNextCut() | ||
|
||
if iMax == 0 | ||
then return | ||
end | ||
|
||
for i = 0, iMax do | ||
|
||
firstItem = reaper.GetTrackMediaItem(currentTrack,0) | ||
firstItemStart = reaper.GetMediaItemInfo_Value(firstItem, "D_POSITION") | ||
|
||
if cursorPos < firstItemStart | ||
|
||
then | ||
|
||
MoveCursorToStartOfFirstItem() | ||
SelectFirstItem() | ||
|
||
else | ||
|
||
currentItem = reaper.GetTrackMediaItem(currentTrack,i); | ||
iStart = reaper.GetMediaItemInfo_Value(currentItem,"D_POSITION"); | ||
iLength = reaper.GetMediaItemInfo_Value(currentItem,"D_LENGTH"); | ||
iEnd = iStart + iLength; | ||
|
||
n = i + 1; | ||
nextItem = reaper.GetTrackMediaItem(currentTrack,n); | ||
|
||
if n ~= iMax | ||
then nextItemStart = reaper.GetMediaItemInfo_Value(nextItem,"D_POSITION"); | ||
end | ||
|
||
lastItem = reaper.GetTrackMediaItem(currentTrack,iLast); | ||
lastItemStart = reaper.GetMediaItemInfo_Value(lastItem,"D_POSITION"); | ||
lastItemLength = reaper.GetMediaItemInfo_Value(lastItem,"D_LENGTH"); | ||
lastItemEnd = lastItemStart + lastItemLength; | ||
|
||
if cursorPos >= iStart and cursorPos < iEnd | ||
then | ||
if nextItemStart == iEnd | ||
then | ||
UnselectAllItems(); | ||
SelectNextItem(); | ||
MoveCursorToEndOfItem(); | ||
break | ||
else | ||
MoveCursorToEndOfItem(); | ||
break | ||
end | ||
end | ||
|
||
if iMax > 1 | ||
then | ||
if cursorPos < nextItemStart and cursorPos >= iEnd | ||
then | ||
UnselectAllItems(); | ||
SelectNextItem(); | ||
MoveCursorToStartOfItem(); | ||
SelectNextItem(); | ||
break | ||
end | ||
else return | ||
end | ||
|
||
if cursorPos >= lastItemEnd | ||
then break | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
-- Action -- | ||
MoveEditCursorToNextCut(); | ||
|
134 changes: 134 additions & 0 deletions
134
Items Editing/FKVC_ProtoolsEditingTools1/MoveEditCursorToPreviousCut.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
-- @noindex | ||
|
||
-- Global Variables -- | ||
|
||
cursorPos = reaper.GetCursorPosition(0); | ||
currentTrack = reaper.GetSelectedTrack(0,0); | ||
|
||
i = 0; | ||
t = 0; | ||
|
||
iMax = reaper.CountTrackMediaItems(currentTrack); | ||
iLast = iMax-1; | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToStartOfFirstItem() | ||
|
||
reaper.SetEditCurPos(firstItemStart, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToStartOfItem() | ||
|
||
reaper.SetEditCurPos(iStart, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToEndOfPreviousItem() | ||
|
||
reaper.SetEditCurPos(previousItemEnd, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function MoveCursorToEndOfLastItem() | ||
|
||
reaper.SetEditCurPos(lastItemEnd, moveview == true, seekplay == true) | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function SelectPreviousItem() | ||
|
||
reaper.SetMediaItemSelected(previousItem, 1); | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function SelectLastItem() | ||
|
||
reaper.SetMediaItemSelected(lastItem, 1); | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
function UnselectAllItems() | ||
|
||
reaper.SelectAllMediaItems(0,0); | ||
|
||
end | ||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
-- Main Function -- | ||
|
||
function MoveEditCursorToNextCut() | ||
|
||
if iMax == 0 | ||
then return | ||
end | ||
|
||
for i = 0, iLast do | ||
|
||
firstItem = reaper.GetTrackMediaItem(currentTrack,0) | ||
firstItemStart = reaper.GetMediaItemInfo_Value(firstItem, "D_POSITION") | ||
|
||
if cursorPos <= firstItemStart | ||
|
||
then break | ||
|
||
else if cursorPos > firstItemStart | ||
|
||
then | ||
|
||
currentItem = reaper.GetTrackMediaItem(currentTrack,i); | ||
iStart = reaper.GetMediaItemInfo_Value(currentItem,"D_POSITION"); | ||
iLength = reaper.GetMediaItemInfo_Value(currentItem,"D_LENGTH"); | ||
iEnd = iStart + iLength; | ||
|
||
p = i-1; | ||
previousItem = reaper.GetTrackMediaItem(currentTrack,p); | ||
|
||
if p ~= -1 | ||
then | ||
previousItemStart = reaper.GetMediaItemInfo_Value(previousItem,"D_POSITION"); | ||
previousItemLength = reaper.GetMediaItemInfo_Value(previousItem,"D_LENGTH"); | ||
previousItemEnd = previousItemStart + previousItemLength; | ||
else previousItem = firstItem; | ||
end | ||
|
||
lastItem = reaper.GetTrackMediaItem(currentTrack,iLast); | ||
lastItemStart = reaper.GetMediaItemInfo_Value(lastItem,"D_POSITION"); | ||
lastItemLength = reaper.GetMediaItemInfo_Value(lastItem,"D_LENGTH"); | ||
lastItemEnd = lastItemStart + lastItemLength; | ||
|
||
if cursorPos > iStart and cursorPos <= iEnd | ||
then | ||
if iStart == previousItemEnd | ||
then | ||
UnselectAllItems(); | ||
SelectPreviousItem(); | ||
MoveCursorToStartOfItem(); | ||
break | ||
else | ||
MoveCursorToStartOfItem(); | ||
break | ||
end | ||
end | ||
|
||
if cursorPos <= iStart and cursorPos > previousItemEnd | ||
then | ||
UnselectAllItems(); | ||
SelectPreviousItem(); | ||
MoveCursorToEndOfPreviousItem(); | ||
break | ||
end | ||
|
||
if cursorPos > lastItemEnd | ||
then | ||
MoveCursorToEndOfLastItem() | ||
SelectLastItem() | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
---------------------------------------------------------------------------------------------------------------------------------------------------- | ||
-- Action -- | ||
|
||
MoveEditCursorToNextCut(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Action filenames (what the user sees in their Action List window) must use the AuthorPrefix_Sentence-case description.lua form.
For example: CutLeft.lua ➡️ FKVC_Protools editing tools - Cut left.lua