No internet connection
  1. Home
  2. How to

Solo selected track

By olafnoise @olafnoise
    2021-01-21 17:25:19.963Z

    Hi
    Is there a way to:
    click somewhere a track, therefore select the track, then solo it ...
    And store that as a new PT function with an on/off toggle button

    A sort of solo on click function ....

    Thanks in advance for any help
    Ølafnoise

    Solved in post #14, click to view
    • 16 replies
    1. Hi Olaf,

      Is this what you're looking for? Set Track Solo is a built-in SoundFlow action:

      1. O
        In reply toolafnoise:
        olafnoise @olafnoise
          2021-01-22 13:00:58.165Z

          Hi Christian
          thanks for your reply but I already did that of course but want to go a little further...
          What I'd like is to assign a button so that this command could be triggered by a click on the track (or not)
          And I didn't find how

          best
          Ølaf

          1. Hi Olaf,

            SoundFlow unfortunately doesn't have a built-in trigger that reacts to track selections.
            I don't know the full workflow you're looking for, but you could consider instead making a macro that both selects the track and soloes it.

          2. O
            In reply toolafnoise:
            olafnoise @olafnoise
              2021-01-23 14:09:03.981Z

              Thanks Christian,
              So, if I understand well, a click in a track in the timeline can't trigger a macro?
              That would be very nice

              1. samuel henriques @samuel_henriques
                  2021-01-23 16:14:15.858Z2021-01-23 23:31:19.000Z

                  Hello @olafnoise,

                  There is a workaround for what I think you are asking.
                  But its not the greatest idea, as it envolves a "run forever" script.

                  This looks stable if you don't need to run other scripts while this one is running.
                  If you need, thy'll probably run, but will stop this one.
                  And you'll need a script to stop it. I use a command to stop all commands but you can figure out if there is a readable state in pro tools, for when you want it to stop, check this thread:
                  How to control/pause/stop a specific runForever script.

                  The following script works if you have Solo Mode X-OR (Cancels Previous Solo) enabled:

                  and will keep checking every 100ms if the selected track has solo on, if it doesn't it will press solo.
                  Hope it hepls.

                  //How often to check in milliseconds
                  var pollingIntervalMs = 100;
                  
                  //sf.engine.runInBackground means: Run in background so other commands may run while we're running
                  sf.engine.runInBackground(function () {
                  
                      //while(true) is an endless loop
                      while (true) {
                  
                          //Check if anyone requested us to cancel all running commands every time we enter the loop
                          //The action will take care of aborting this command if necessary
                          sf.engine.checkForCancellation();
                  
                          const soloState = sf.ui.proTools.selectedTrack.buttons.whoseTitle.is('Solo').first.invalidate().value.value;
                  
                          if (soloState !== "on")
                  
                              sf.keyboard.press({
                                  fast: true,
                                  keys: "shift+s",
                              });
                  
                  
                          //Done with this iteration of the loop.
                          //To not eat up all the CPU, insert a 'wait' here so we wait until next time we want to check
                          sf.wait({
                              intervalMs: pollingIntervalMs,
                              executionMode: 'Background'
                          });
                      }
                  
                  });
                  
                • O
                  In reply toolafnoise:
                  olafnoise @olafnoise
                    2021-01-23 16:17:37.146Z

                    Thanks a lot .. I'll try that asap....

                    1. O
                      In reply toolafnoise:
                      olafnoise @olafnoise
                        2021-01-23 21:43:45.221Z

                        Sorry but nothing happens here when triggering this script !!

                        1. samuel henriques @samuel_henriques
                            2021-01-23 23:32:39.991Z

                            yep, sorry made a mistake when I pasted the script.

                            It's fixed now, let me know if it works.

                          • O
                            In reply toolafnoise:
                            olafnoise @olafnoise
                              2021-01-24 10:15:33.592Z

                              Thank you very much
                              it's working as expected now.
                              I assigned the script to a SD button but what would be great now is a toggle that stop the loop and bring back normal solo behavoir with a second press on the same button

                              best
                              Ølafnoise

                              1. samuel henriques @samuel_henriques
                                  2021-01-24 10:52:13.005Z

                                  Christian showd me in the past what I think might work for the toggle thing. I'm away from my computer today, I'll try something when I can.

                                • O
                                  In reply toolafnoise:
                                  olafnoise @olafnoise
                                    2021-01-24 10:53:35.455Z

                                    Thanks Samuel

                                    1. samuel henriques @samuel_henriques
                                        2021-01-24 16:15:28.142Z

                                        hello @olafnoise,

                                        almost ready with the script.
                                        Did you notice, when you stop the loop, the last selected track is soloed.
                                        Would you like to clear all solos when you stop the loop?

                                        1. samuel henriques @samuel_henriques
                                            2021-01-24 16:25:12.426Z

                                            Here you go, let me know how it goes. Remember these "run forever" are not the greatest in stability, mostly, as I understand, there are to many variables with the OSX that can disrupt it. But for the ones I use, stating the script again will work just fine.

                                            function autoSoloSelectedTracks(runScript) {
                                            
                                                log("Auto Solo Selected Track Running")
                                            
                                                //How often to check in milliseconds
                                                var pollingIntervalMs = 50;
                                            
                                                //sf.engine.runInBackground means: Run in background so other commands may run while we're running
                                                sf.engine.runInBackground(function () {
                                            
                                                    //while(true) is an endless loop
                                                    while (true) {
                                            
                                                        if (globalState.stopTheLoop) break;
                                            
                                                        //Check if anyone requested us to cancel all running commands every time we enter the loop
                                                        //The action will take care of aborting this command if necessary
                                                        sf.engine.checkForCancellation();
                                            
                                                        const soloState = sf.ui.proTools.selectedTrack.buttons.whoseTitle.is('Solo').first.invalidate().value.value;
                                            
                                                        if (soloState !== "on")
                                            
                                                            sf.keyboard.press({
                                                                fast: true,
                                                                keys: "shift+s",
                                                            });
                                            
                                            
                                                        //Done with this iteration of the loop.
                                                        //To not eat up all the CPU, insert a 'wait' here so we wait until next time we want to check
                                                        sf.wait({
                                                            intervalMs: pollingIntervalMs,
                                                            executionMode: 'Background'
                                                        });
                                                    }
                                                });
                                            }
                                            
                                            
                                            globalState.state = !globalState.state
                                            
                                            if (globalState.state) {
                                            
                                                globalState.stopTheLoop = false
                                            
                                                autoSoloSelectedTracks()
                                            
                                            } else {
                                            
                                                globalState.stopTheLoop = true
                                            
                                                sf.ui.proTools.mainWindow.groups.whoseTitle.is('Counter Display Cluster').first.mouseClickElement({
                                                    relativePosition: { "x": -41, "y": -19 },
                                                    anchor: "BottomRight",
                                                });
                                            
                                                log("Auto Solo Selected Track Canceled")
                                            }
                                            
                                            Reply1 LikeSolution
                                            1. Oolafnoise @olafnoise
                                                2021-01-24 16:31:05.056Z

                                                Great!!

                                                working fine .....
                                                just a little thing ... is it possible to avoid SF notifications when you start and stop the script
                                                Thanks very much

                                                I owe you a (virtual for the moment ) beer

                                                1. samuel henriques @samuel_henriques
                                                    2021-01-24 16:45:42.298Z

                                                    Nice one. Thank you so much!
                                                    Just delete the lines starting with 'log'

                                                    1. Oolafnoise @olafnoise
                                                        2021-01-24 17:12:02.513Z

                                                        ok thanks
                                                        best
                                                        Ølaf