Javascript Macros

Discussion about: tracktion.com
Post Reply New Topic
RELATED
PRODUCTS

Post

Let's start a repository...

Post

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.

Post

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();

------------------------------------------------

Post

JAVA SCRIPT COMMENTS

Single Line Comment:
// ...

Multi Line Comment:
/*
...
...
...
*/

Post

Great start guys! We'll be adding some of our own macros here as well so stay tuned!

Post

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

Post

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.

Post

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.
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.

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."

Post

Yes, I'm trying to bring one of those in to the editor to edit, view, study. How?

Ah, I see now. Thanks.

Post

LawrenceF wrote:Yes, I'm trying to bring one of those in to the editor to edit, view, study. How?
Not sure what you mean. One of those what? The right-click Action menu pastes code into the editor.

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."

Post

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); 

Post Reply

Return to “Tracktion”