Javascript Macros
-
- KVRian
- 1272 posts since 11 Apr, 2002 from Nashville, TN
-
- KVRian
- Topic Starter
- 1272 posts since 11 Apr, 2002 from Nashville, TN
Maximize Track to Full View and Center Vertically - IMO, This has always seemed sorely missing in Tracktion.
Select any track, clip, or plug and run to have the track zoomed into max and centered vertically.
You may need to change "740" to a number that works better for your working window size / monitor resolution.
var selectedtrack = Tracktion.getTrackFromSelectedObject();
Tracktion.setTrackHeight (selectedtrack, 740);
Tracktion.scrollToShowTrack (selectedtrack)
I replaced the default F9 key function (set all tracks to the default track height). I can already tell I will be switching back and fourth between the standard F8 and this new macro so I wanted them side by side.
Select any track, clip, or plug and run to have the track zoomed into max and centered vertically.
You may need to change "740" to a number that works better for your working window size / monitor resolution.
var selectedtrack = Tracktion.getTrackFromSelectedObject();
Tracktion.setTrackHeight (selectedtrack, 740);
Tracktion.scrollToShowTrack (selectedtrack)
I replaced the default F9 key function (set all tracks to the default track height). I can already tell I will be switching back and fourth between the standard F8 and this new macro so I wanted them side by side.
-
- KVRist
- 39 posts since 6 May, 2003 from Berlin
Zoom to Clip and Play Looped
Tracktion.zoomAroundSelection();
var track = Tracktion.getTrackFromSelectedObject();
var height = Tracktion.getTrackAreaHeight();
Tracktion.setTrackHeight (track, height);
Tracktion.scrollToShowTrack (track);
Tracktion.markAroundSelected();
Tracktion.jumpToMarkIn();
Tracktion.toggleTransport ('loop');
Tracktion.startStopPlayback();
------------------------------------------------
Zoom Out Unloop and Deselect All
Tracktion.stopPlayback();
// Stop Playback - optional
Tracktion.zoomToFit();
Tracktion.toggleTransport ('loop');
Tracktion.selectItem ('none');
Tracktion.moveTransportToStart();
Tracktion.markIn();
Tracktion.markOut();
------------------------------------------------
Tracktion.zoomAroundSelection();
var track = Tracktion.getTrackFromSelectedObject();
var height = Tracktion.getTrackAreaHeight();
Tracktion.setTrackHeight (track, height);
Tracktion.scrollToShowTrack (track);
Tracktion.markAroundSelected();
Tracktion.jumpToMarkIn();
Tracktion.toggleTransport ('loop');
Tracktion.startStopPlayback();
------------------------------------------------
Zoom Out Unloop and Deselect All
Tracktion.stopPlayback();
// Stop Playback - optional
Tracktion.zoomToFit();
Tracktion.toggleTransport ('loop');
Tracktion.selectItem ('none');
Tracktion.moveTransportToStart();
Tracktion.markIn();
Tracktion.markOut();
------------------------------------------------
-
- KVRAF
- 1790 posts since 30 Dec, 2012
Great start guys! We'll be adding some of our own macros here as well so stay tuned!
-
- KVRist
- 39 posts since 6 May, 2003 from Berlin
Hi Dave,
I have a question regarding my 'Zoom to Clip and Play Looped' script above.
>>I'd like to expand it so that the clip could be soloed.<<
How can I solo the track (with an action) on which I have selected a clip, to be played in loop mode.
Or: Selecting a clip also selects the 'parent' track.
Is that possible?
Cheers
I have a question regarding my 'Zoom to Clip and Play Looped' script above.
>>I'd like to expand it so that the clip could be soloed.<<
How can I solo the track (with an action) on which I have selected a clip, to be played in loop mode.
Or: Selecting a clip also selects the 'parent' track.
Is that possible?
Cheers
-
- KVRAF
- 6159 posts since 4 Dec, 2004
Where, pray tell, is the list of methods like the ones being used here?
Tracktion.getTrackFromSelectedObject();
Kinda hard to script without any documentation or intellisense leading you to methods and properties.
Tracktion.getTrackFromSelectedObject();
Kinda hard to script without any documentation or intellisense leading you to methods and properties.
- Beware the Quoth
- 35508 posts since 4 Sep, 2001 from R'lyeh Oceanic Amusement Park and Funfair
open the script editor, right click on the text area in the editor, and check out what's available under 'Actions' on the hierarchic menu.LawrenceF wrote:Where, pray tell, is the list of methods like the ones being used here?
Tracktion.getTrackFromSelectedObject();
Kinda hard to script without any documentation or intellisense leading you to methods and properties.
eg Tracktion.getTrackFromSelectedObject() is under Actions>Advanced Actions>Edit Element interaction
An idiot on Set Theory:
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."
- Beware the Quoth
- 35508 posts since 4 Sep, 2001 from R'lyeh Oceanic Amusement Park and Funfair
Not sure what you mean. One of those what? The right-click Action menu pastes code into the editor.LawrenceF wrote:Yes, I'm trying to bring one of those in to the editor to edit, view, study. How?
Yes, documentation is lacking at present. But we're already significanrly OT for this thread, which is for sharing code. Better to discuss useage etc at
http://www.kvraudio.com/forum/viewtopic.php?p=6174737
An idiot on Set Theory:
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."
-
- KVRer
- 3 posts since 20 Nov, 2017
AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Slight variation - I am using this one a lot ...Zoom in for Midi edit
From the default view - select macro to close all panels, open selected track and zoom in on the time cursor +- 2.5 seconds. Select again to toggle panels ... since I can't find any useful way of telling if controlsVisible, etc.
Code: Select all (#)
Tracktion.toggleVisibility ('allPanels');
Tracktion.zoomAroundSelection();
var track = Tracktion.getTrackFromSelectedObject();
var height = Tracktion.getTrackAreaHeight();
Tracktion.setTrackHeight (track, height);
Tracktion.scrollToShowTrack (track);
var cursorPos = Tracktion.getPosition ('cursor');
var numSeconds = 2.5;
Tracktion.setViewBounds (cursorPos - numSeconds, cursorPos + numSeconds);
