macros help request

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

Post

Can anyone figure out how to set the PUNCH state? You can toggle it obviously, but I'd like to have it set to on, whether it's on already or not.

I tried:

Tracktion.toggleTransport ('punch', 1);
Tracktion.toggleTransport ('punch', 0);

To no avail. I'm trying to make this macro better (so it works whether PUNCH selected or not.) It pre-rolls from the IN marker and starts a punch record.

Code: Select all

Tracktion.toggleTransport ('punch');
Tracktion.jumpToMarkIn();
var currentPos = Tracktion.getPosition ('transport');
Tracktion.setPosition ('transport', currentPos - 7.0);
Tracktion.record ();
Also trying to get new named tracks, but with the name based on the current selection. So creating a new track with a track selected would create a track with the same name. Ideally it would have a +1 style identifier, but I'll take what I can get. Even like "create 4 new tracks" all in one go, but with name +1 identifiers would be great, if that's possible. I'm trying to get a quicker comping setup and I prefer not working in loop mode, so this would let me use "pack clips to takes" option more efficiently and have everything named based off the main track.

Post

Unfortunately, Tracktion.toggleTransport ('punch'); returns a void so there's no way of checking if punch is on or not. If it returned true/false you could use an if statement to toggle the punch state.

The following macro will create 4 tracks with the same name plus number identifier. Edit the first line to change number of tracks:

Code: Select all

var numTracksToCreate = 4;
var trackCount = 0;
var selected = Tracktion.getSelectedEditElements ('track');
trackName = Tracktion.getName (selected[0]);

for (var i = 0; i < numTracksToCreate; ++i)
{
    trackCount += 1;
    Tracktion.insertTrack ('audio');
    selected = Tracktion.getSelectedEditElements ('track');
    Tracktion.setName (selected[0], trackName + ' ' + trackCount);
}
If the track isn't named it will create a numbered track.

Post

AGreen wrote: Mon Mar 22, 2021 1:51 pm Unfortunately, Tracktion.toggleTransport ('punch'); returns a void so there's no way of checking if punch is on or not. If it returned true/false you could use an if statement to toggle the punch state.

The following macro will create 4 tracks with the same name plus number identifier. Edit the first line to change number of tracks:

Code: Select all

var numTracksToCreate = 4;
var trackCount = 0;
var selected = Tracktion.getSelectedEditElements ('track');
trackName = Tracktion.getName (selected[0]);

for (var i = 0; i < numTracksToCreate; ++i)
{
    trackCount += 1;
    Tracktion.insertTrack ('audio');
    selected = Tracktion.getSelectedEditElements ('track');
    Tracktion.setName (selected[0], trackName + ' ' + trackCount);
}
If the track isn't named it will create a numbered track.
Brilliant, thank you so much! This will be my new ALT+T.

I suspected that about the PUNCH one, I'll just get rid of that first line and only use it in conjunction with the punch key.

I was gonna mention in another thread that I use your "hide/show muted tracks" macros all the time (puts my reference listen macro over the top) and I've learned a bunch from the macros you've posted, so thanks again.

How does one tell that PUNCH returns a void (out of curiosity)?

Post

Kang wrote: Mon Mar 22, 2021 3:19 pm Brilliant, thank you so much! This will be my new ALT+T.

I suspected that about the PUNCH one, I'll just get rid of that first line and only use it in conjunction with the punch key.

I was gonna mention in another thread that I use your "hide/show muted tracks" macros all the time (puts my reference listen macro over the top) and I've learned a bunch from the macros you've posted, so thanks again.

How does one tell that PUNCH returns a void (out of curiosity)?
No problem, glad some of those macros are useful. If you hover your mouse over a macro command in the editor, it'll pop up information about the commands usage and what it returns. The online API also gives this information.

Post Reply

Return to “Tracktion”