I would love to be able to specify the track name to mute as an alternative to getting a search window. I would use this to mute/unmute guide tracks.
- Christian Scheuer @chrscheuer2018-11-02 07:14:16.223Z
Hi @sbiss.
You can use this code to toggle the Mute state of the track named "GUIDE":
sf.ui.proTools.trackGetByName({ name: 'GUIDE', makeVisible: true }).track.buttons.getByTitle('Mute').elementClick();
Does that fit what you had in mind?
Christian Scheuer @chrscheuer2018-11-02 09:36:57.391Z
And if you need to not toggle, but to set the mute state to something specific, use this (this script also supports setting for more than one track at a time):
function setMuteState(trackNames, value) { for (var i=0; i<trackNames.length; i++) { var muteBtn = sf.ui.proTools.trackGetByName({ name: trackNames[i], makeVisible: true }).track.buttons.getByTitle('Mute'); if ((muteBtn.invalidate().value.value === "on state") !== value) muteBtn.elementClick(); } } setMuteState([ 'GUIDE1', 'GUIDE2' ], true); //to mute them setMuteState([ 'GUIDE1', 'GUIDE2' ], false); //to un-mute them
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2018-11-02 17:27:34.390Z
Yes, that's exactly what I was looking for. Nice to have that ability on the keyboard. Thanks!
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2018-11-02 17:37:51.348Z
Having some trouble getting the 2nd example to work. Looks like the last two lines are just an example of how I would change the code in the 1st line? So, for instance I would change the 1st line to:
function setMuteState([ 'MX GT', 'DX GT' ], true) {
Christian Scheuer @chrscheuer2018-11-02 17:39:50.225Z
Sorry @sbiss I should have commented this code better.
The last two lines are examples that are mutually exclusive. They both call the function, which should be left untouched.
So this would be one example - mute GUIDE1 and GUIDE2:
function setMuteState(trackNames, value) { for (var i=0; i<trackNames.length; i++) { var muteBtn = sf.ui.proTools.trackGetByName({ name: trackNames[i], makeVisible: true }).track.buttons.getByTitle('Mute'); if ((muteBtn.invalidate().value.value === "on state") !== value) muteBtn.elementClick(); } } setMuteState([ 'GUIDE1', 'GUIDE2' ], true); //to mute them
This would unmute GUIDE1 and GUIDE2:
function setMuteState(trackNames, value) { for (var i=0; i<trackNames.length; i++) { var muteBtn = sf.ui.proTools.trackGetByName({ name: trackNames[i], makeVisible: true }).track.buttons.getByTitle('Mute'); if ((muteBtn.invalidate().value.value === "on state") !== value) muteBtn.elementClick(); } } setMuteState([ 'GUIDE1', 'GUIDE2' ], false); //to unmute them
Christian Scheuer @chrscheuer2018-11-02 17:42:26.409Z
Further (just to clarify the syntax), to unmute even more tracks, you just separate with commas:
setMuteState([ 'GUIDE1', 'GUIDE2', 'GUIDE3', 'GUIDE4' ], false);
The
true
means mute,false
means unmute - in this case.
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2018-11-02 17:42:33.109Z
Got it. Works perfectly. Not sure how I'd use this one, but good to have :)
Christian Scheuer @chrscheuer2018-11-02 17:43:04.943Z
Great to hear - thanks Steve!
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2018-11-02 17:45:03.914Z
And in the 1st example that toggles the mute (more useful to me), how would I alter the code to toggle mute on multiple tracks?
Christian Scheuer @chrscheuer2018-11-02 17:47:17.706Z
This depends on which functionality you'd like.
The simple cases are easy:
- If all are muted, unmute all
- If all are unmuted, mute all
But what if only some are muted. Then toggle each one individually? Or, if any single one is muted, unmute all, else, mute all?
Christian Scheuer @chrscheuer2018-11-02 17:55:25.533Z
Pro Tools just toggles each one individually.
Toggling individually would be like this:
function toggleMuteStateIndividually(trackNames) { trackNames.forEach(function (trackName) { var muteBtn = sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track.buttons.getByTitle('Mute'); muteBtn.elementClick(); }); } toggleMuteStateIndividually(['GUIDE1', 'GUIDE2']);
Toggling as a group (so after invoking, either all are muted or unmuted):
function toggleMuteStateAsGroup(trackNames) { var tracks = trackNames.map(function (trackName) { return sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track; }); var newValue = !tracks.some(function(track){ return track.buttons.getByTitle('Mute').invalidate().value.value === "on state" }); for (var i = 0; i < tracks.length; i++) { var muteBtn = tracks[i].buttons.getByTitle('Mute'); if ((muteBtn.invalidate().value.value === "on state") !== newValue) muteBtn.elementClick(); } } toggleMuteStateAsGroup(['GUIDE1', 'GUIDE2']);
- In reply tochrscheuer⬆:SSteve Bissinger @sbiss2018-11-02 17:55:35.033Z
Good point! It's more likely I would use a VCA to mute toggle a group of tracks, and I have those already set up in my template. I guess if I were to use something like this I would probably want to force them all to the same state. So make them all muted, regardless of their initial state. But I think a VCA is a better solution in this case, since it can mute/unmute tracks without changing the state of the children tracks.
Christian Scheuer @chrscheuer2018-11-02 17:58:19.763Z
Yea, agreed. Maybe it would make sense in some stem routing scenario etc.
But in any case what you'd go for if you wanted to do without VCA is mytoggleMuteStateAsGroup
code from above.Christian Scheuer @chrscheuer2018-11-02 17:59:29.507Z
Would you mind if I move this to the public "How to" section so other users can find it in the future? It has some code examples that would be nice to share :)
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2018-11-02 17:59:54.059Z
Cool. Good to have the option available :)
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2018-11-02 19:46:44.773Z
Sorry just saw you post about moving to the public "How To". Please do! I've made F16-19 my GT Master - DX - MX - FX and it's really efficient.
Christian Scheuer @chrscheuer2018-11-02 19:48:24.407Z
Loving this!
I'm thinking, now that you're diving more deeply into the platform. At some point you should look quickly through some of the other How to... threads and see if you get inspired by some of the questions in there. Lmk if you need any help understanding how to use the code without coding (eg. maybe some of the scripts will just need a little tweak or two before you can use them).
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2018-11-02 19:58:37.128Z
I've attempted writing some code using auto-complete, but it's still a little out of my league. I think you need at least a basic background in coding even with that option. But I'm able to adapt existing code if it's simple. I've looked through the how to section and found some interesting stuff. But I'll check back to see what's there. FYI - I was just talking you up again to Danny Caccavo, who is the Pro Tools guru here. I'd really like to show him and the rest of the team what you're doing. And they have a few people here who can code who could certainly do some cool stuff with this platform. They are insanely busy, but I think interested in checking it out. Perhaps we can get you on a Skype call or something if we can find a time. Would you be interested in that?
Christian Scheuer @chrscheuer2018-11-02 20:02:14.762Z
Yes certainly - that's great to hear. I've been meaning to reach back out for a while, I'm sure we would have lots of interesting stuff to talk about. Let's set it up - but let's take the discussion on email instead of here (since this thread is now public).
- SSteve Bissinger @sbiss2018-11-02 20:04:11.947Z
Sounds good.
- SIn reply tosbiss⬆:Steve Bissinger @sbiss2019-01-11 18:37:56.080Z
This command is great! I'm muting my DX, MX, and FX GT's from my keyboard. BUT it does not work for one track and I cannot figure out why. The track is called "ALL FX". I copied/pasted the code and replaced the track name with ALL FX. But each time it fails Javascript exception: TypeError. I can send screen shots if it helps. Here's the code:
sf.ui.proTools.trackGetByName({
name: ' ALL FX',
makeVisible: true
}).track.buttons.getByTitle('Mute').elementClick();Christian Scheuer @chrscheuer2019-01-11 18:54:13.326Z
Hi @sbiss. It looks like you have an extra space in the start of the track name:
' ALL FX'
should be'ALL FX'
- SSteve Bissinger @sbiss2019-01-11 18:57:23.833Z
Doh! All the other tracks have a space before the name so I copied pasted, not remembering I'd named the tracks that way intentionally. Strange, thought I'd tried removing the space. Sorry for the bother.
Christian Scheuer @chrscheuer2019-01-11 18:58:03.833Z
No worries - this is what the forum is for :) Glad you got it working.
Christian Scheuer @chrscheuer2019-01-11 18:58:54.726Z
The real issue here is that you don't get a better error message actually. I'll report this as a bug, since I believe we can improve this.
- MIn reply tosbiss⬆:Martin Pavey @Martin_Pavey
This is great for muting/Un muting multiple Busses offscreen.
Thanks guys! - S2In reply tosbiss⬆:Sreejesh Nair @Sreejesh_Nair
This code will cycle the mute through the tracks names. I use this to monitor various downmixes. You can provide the track names in the
var headphoneTracks
part in the beginning of the code. If by mistake all are muted, then the first track in the list will be unmuted. If there are more than 2 tracks unmuted, then too all except the first track in the list will be muted. If only one is unmuted, then it will begin the cyclic toggle between the rest.var headphoneTracks = ['Binaural', 'AppleMusic', 'Surround']; // Add more track names as needed function toggleHeadphoneMute() { // Determine the mute state of each track and count how many are unmuted var unmutedTracks = headphoneTracks.filter(function(trackName) { var muteState = sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track.buttons.getByTitle('Mute').invalidate().value.value; return muteState !== "on state"; }); // Logic to handle different mute state scenarios if (unmutedTracks.length === 0) { // If all tracks are muted, unmute the first one toggleMuteState(headphoneTracks[0]); } else if (unmutedTracks.length > 1) { // If more than one track is unmuted, mute all except the first one unmutedTracks.forEach(function(trackName, index) { if (index > 0) toggleMuteState(trackName); // Skip the first track }); } else { // If exactly one track is unmuted, cycle the mute state to the next track var currentIndex = headphoneTracks.indexOf(unmutedTracks[0]); var nextIndex = (currentIndex + 1) % headphoneTracks.length; // Cycle through the array toggleMuteState(unmutedTracks[0]); // Mute the currently unmuted track toggleMuteState(headphoneTracks[nextIndex]); // Unmute the next track } } function toggleMuteState(trackName) { // Toggles the mute state of a given track sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track.buttons.getByTitle('Mute').elementClick(); } // Activate Pro Tools main window and run the toggle function sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); toggleHeadphoneMute();
- Progress