macro help
-
- KVRist
- 358 posts since 3 Dec, 2004
I'm trying to make a "reference listen" macro, so with a hotkey I can solo a muted reference track and visa-versa, without worrying about it playing along with the edit
This works when the track or something on the track is selected, which is cool. just make sure nothing else is solo'd if you use additive solo option.
Tracktion.muteSelectedTracks();
Tracktion.soloSelectedTracks();
I want it to work in any scenario though. I initially tried to make the reference be my top track, but due to the fact that I think waveform considers the chord, marker, tempo tracks 'tracks' I was having a hard time. So I decided to try the bottom track and I'm getting closer.
Tracktion.selectItem ('bottom');
Tracktion.muteSelectedTracks();
Tracktion.soloSelectedTracks();
Yes I know, I am a master-coder.
Only problem is it only works with a track selected, if you have a clip or plugin selected then it works on whatever track they are on. I think 'bottom' part of Tracktion.selectItem command doesn't work on plugins or clips, even though 'down' does, so it feels like it should. <--Bug report?
Pretty happy to get this far, but like I said it'd cool to have it so that it works no matter what is selected in the edit.
I can't figure out a way to get a track actually selected with macros, as if you clicked it with the mouse. Or, is there a way to specifically point to a track? Like select track [1], 'bottom', 'top', etc. (or select track="reference')? Can you make a Track the "Item'? Whatever gets me to a track while anything is selected.
Or any other ideas? I'm sure it's simple, I have very very basic coding knowledge.
Also, if you throw the above macro directly between the two from this thread (viewtopic.php?t=525343) you have a hotkey that solos your hidden muted reference track, and then mutes and hides it again with the same hotkey. Super cool but hopefully I can perfect it with someone's help.
This works when the track or something on the track is selected, which is cool. just make sure nothing else is solo'd if you use additive solo option.
Tracktion.muteSelectedTracks();
Tracktion.soloSelectedTracks();
I want it to work in any scenario though. I initially tried to make the reference be my top track, but due to the fact that I think waveform considers the chord, marker, tempo tracks 'tracks' I was having a hard time. So I decided to try the bottom track and I'm getting closer.
Tracktion.selectItem ('bottom');
Tracktion.muteSelectedTracks();
Tracktion.soloSelectedTracks();
Yes I know, I am a master-coder.
Only problem is it only works with a track selected, if you have a clip or plugin selected then it works on whatever track they are on. I think 'bottom' part of Tracktion.selectItem command doesn't work on plugins or clips, even though 'down' does, so it feels like it should. <--Bug report?
Pretty happy to get this far, but like I said it'd cool to have it so that it works no matter what is selected in the edit.
I can't figure out a way to get a track actually selected with macros, as if you clicked it with the mouse. Or, is there a way to specifically point to a track? Like select track [1], 'bottom', 'top', etc. (or select track="reference')? Can you make a Track the "Item'? Whatever gets me to a track while anything is selected.
Or any other ideas? I'm sure it's simple, I have very very basic coding knowledge.
Also, if you throw the above macro directly between the two from this thread (viewtopic.php?t=525343) you have a hotkey that solos your hidden muted reference track, and then mutes and hides it again with the same hotkey. Super cool but hopefully I can perfect it with someone's help.
-
- KVRian
- 524 posts since 16 Mar, 2017
Actually, no, that just leaves nothing selected as the selectItem routine works relative to the current selection.
This is a great example of why I previously described the Tracktion scripting API as being "anemic" in another thread - instead of presenting a proper DOM they opted to provide a collection of seemingly arbitrary operations which do not comprehensively cover the range of what someone might want to do. The inability to do something as straightforward as ensure that some track is selected demonstrates how poor the scripting API really is.
The task you are trying to accomplish really should look something like this:
const t = Tracktion.currentEdit.tracks;
t[t.length - 1].muted = true;
t[t.length - 1].soloed = true;
In which case it would not care about the selection at all.
This is a great example of why I previously described the Tracktion scripting API as being "anemic" in another thread - instead of presenting a proper DOM they opted to provide a collection of seemingly arbitrary operations which do not comprehensively cover the range of what someone might want to do. The inability to do something as straightforward as ensure that some track is selected demonstrates how poor the scripting API really is.
The task you are trying to accomplish really should look something like this:
const t = Tracktion.currentEdit.tracks;
t[t.length - 1].muted = true;
t[t.length - 1].soloed = true;
In which case it would not care about the selection at all.
-
- KVRist
- Topic Starter
- 358 posts since 3 Dec, 2004
When they first introduced macros they were asking for input and there wasn't a ton, and it also seems pretty daunting to get all the random stuff that people want included. I can't blame a small dev team for shifting priorities. I've been pretty happy with the few macros I use, and pretty optimistic there's some way to get this to work. I get what you are saying though.
As I mentioned before, I think this would work great if Tracktion.selectItem ('bottom') worked on clips and plugins. Also Tracktion.selectItem ('down') should be able to cross an empty track to select clips. It works if there's clips on the track directly below it, but if not it does nothing.
There's a way to get a track from selected item, but it doesn't make the track THE selected item. I noticed in the hide muted tracks macro something like "trackProperties ('hidden')". Is there a way to see all the options for trackProperties?
As I mentioned before, I think this would work great if Tracktion.selectItem ('bottom') worked on clips and plugins. Also Tracktion.selectItem ('down') should be able to cross an empty track to select clips. It works if there's clips on the track directly below it, but if not it does nothing.
There's a way to get a track from selected item, but it doesn't make the track THE selected item. I noticed in the hide muted tracks macro something like "trackProperties ('hidden')". Is there a way to see all the options for trackProperties?
-
- KVRist
- Topic Starter
- 358 posts since 3 Dec, 2004
Lol, this actually solved it for me, can't believe I didn't notice that one. It's kinda convoluted, but works (I think). You use it with 'make a new track' which creates a track selection. Let me figure out how to post macros correctly and I'll post it.fde101 wrote: Mon Feb 08, 2021 11:16 am Have you tried tossing in a "Tracktion.deselectAll();" before all of that?
It seems to work better than I was hoping because it now works in any state, thanks!
-
- KVRist
- Topic Starter
- 358 posts since 3 Dec, 2004
Code: Select all
//Solo Muted Hidden Bottom Track, or Mute and Hide Solo'd Bottom Track
var tracks = Tracktion.getEditElements ('track');
var numTracks = tracks.length;
for (var i = 0; i < numTracks; ++i)
{
if(Tracktion.isMute (tracks[i]) == true)
{
tracks[i].setProperty ('hidden', '0');
}
}
Tracktion.deselectAll();
Tracktion.insertTrack ('audio');
Tracktion.selectItem ('up');
Tracktion.muteSelectedTracks();
Tracktion.soloSelectedTracks();
Tracktion.selectItem ('down');
Tracktion.deleteSelected();
var tracks = Tracktion.getEditElements ('track');
var numTracks = tracks.length;
for (var i = 0; i < numTracks; ++i)
{
if(Tracktion.isMute (tracks[i]) == true)
{
tracks[i].setProperty ('hidden', '1');
}
}Doesn't hide other muted tracks when hiding the reference.
Unsolos any solo'd tracks while reference is solo'd, then resolos them when the reference is muted.
both those feel doable, but I'm not sure I'm there yet.
I've only VERY basically tested this, so if anyone tries it let me know.
Also, the hiding and unhiding part of the macros were not mine. Much thanks to the person who posted those.
Last edited by Kang on Mon Feb 08, 2021 8:02 pm, edited 1 time in total.
-
- KVRist
- Topic Starter
- 358 posts since 3 Dec, 2004
Here's the basic one for if you have the reference track as a muted bottom track, but don't need it hidden.
I'm sure there's better ways to do it, but whatever.
Code: Select all
//Solo Muted Bottom Track
Tracktion.deselectAll();
Tracktion.insertTrack ('audio');
Tracktion.selectItem ('up');
Tracktion.muteSelectedTracks();
Tracktion.soloSelectedTracks();
Tracktion.selectItem ('down');
Tracktion.deleteSelected();
-
- KVRist
- Topic Starter
- 358 posts since 3 Dec, 2004
Probably just talking to myself, and I realize this is laughably primitive, but here's a top track version that I'll probably use. Found a few extra commands from one of AGreens macros that I missed. The other catch on this one is that you need at least one track above the main tracks open (chord, tempo, marker, arranger). If you don't like to have any of those tracks open then just remove Tracktion.selectionItem ('down'). I did basic tests, but haven't tested it with a full blown mix at my desk so just be aware of that. It does appear to be instant and noise free.
TLDR
Reference listen macro:
Put reference mix in top track, solo it, then use this to toggle between mute/hiding and solo/showing it. It will also hide any other muted tracks. (bottom track version posted earlier)
Let me know if you use it.
TLDR
Reference listen macro:
Put reference mix in top track, solo it, then use this to toggle between mute/hiding and solo/showing it. It will also hide any other muted tracks. (bottom track version posted earlier)
Code: Select all
var tracks = Tracktion.getEditElements ('track');
var numTracks = tracks.length;
for (var i = 0; i < numTracks; ++i)
{
if(Tracktion.isMute (tracks[i]) == true)
{
tracks[i].setProperty ('hidden', '0');
}
}
var tracks = Tracktion.getEditElements ('track');
var numTracks = tracks.length;
for (var i = 0; i < numTracks; ++i)
{Tracktion.addObjectsToSelection (tracks[i]);}
Tracktion.selectItem ('up');
Tracktion.selectItem ('down');
Tracktion.muteSelectedTracks();
Tracktion.soloSelectedTracks();
Tracktion.selectItem ('none');
var tracks = Tracktion.getEditElements ('track');
var numTracks = tracks.length;
for (var i = 0; i < numTracks; ++i)
{
if(Tracktion.isMute (tracks[i]) == true)
{
tracks[i].setProperty ('hidden', '1');
}
}
