No internet connection
  1. Home
  2. How to

How to read send and insert states on a track (bypass, mute, active)

By Andrew Scheps @Andrew_Scheps
    2020-04-22 14:08:00.228Z

    I feel like I've seen this somewhere in the forums but I can't find it now. Is there a way to get the current status of an insert and send (bypass, mute, active etc.)?

    Solved in post #3, click to view
    • 4 replies
    1. You can get the states like this:

      
      /** 
       * @param {1|2|3|4|5|6|7|8|9|10} insertNumber
       */
      function getInsertState(insertNumber) {
          var val = sf.ui.proTools.selectedTrack.insertSelectorButtons[insertNumber - 1].value.invalidate().value;
          return {
              isBypassed: val.indexOf('bypassed') >= 0,
              isInactive: val.indexOf('inactive') >= 0,
          };
      }
      
      /** 
       * @param {1|2|3|4|5|6|7|8|9|10} sendNumber
       */
      function getSendState(sendNumber) {
          var val = sf.ui.proTools.selectedTrack.sendSelectorButtons[sendNumber - 1].value.invalidate().value;
          return {
              isMuted: val.indexOf('muted') >= 0,
              isInactive: val.indexOf('inactive') >= 0,
          };
      }
      
      log(JSON.stringify(getInsertState(1), null, 4));
      log(JSON.stringify(getSendState(1), null, 4));
      
      1. And if you want to pass in the track it should look for, do like this:

        
        /** 
         * @param {AxPtTrackHeader} track
         * @param {1|2|3|4|5|6|7|8|9|10} insertNumber
         */
        function getInsertState(track, insertNumber) {
            var val = track.insertSelectorButtons[insertNumber - 1].value.invalidate().value;
            return {
                isBypassed: val.indexOf('bypassed') >= 0,
                isInactive: val.indexOf('inactive') >= 0,
            };
        }
        
        /** 
         * @param {AxPtTrackHeader} track
         * @param {1|2|3|4|5|6|7|8|9|10} sendNumber
         */
        function getSendState(track, sendNumber) {
            var val = track.sendSelectorButtons[sendNumber - 1].value.invalidate().value;
            return {
                isMuted: val.indexOf('muted') >= 0,
                isInactive: val.indexOf('inactive') >= 0,
            };
        }
        
        log(JSON.stringify(getInsertState(sf.ui.proTools.selectedTrack, 1), null, 4));
        log(JSON.stringify(getSendState(sf.ui.proTools.selectedTrack, 1), null, 4));
        
        ReplySolution
        1. Andrew Scheps @Andrew_Scheps
            2020-04-22 18:38:26.386Z

            Brilliant, thanks!

            1. In reply tochrscheuer:
              TTristan Hoogland @Tristan
                2022-10-19 23:35:06.953Z

                Hey @chrscheuer

                This is really helpful - I think because both insert + sends have two arrays (track, insertNumber) I'm having a bit of trouble returning the true/false info so I can fire off another function.

                What I'm trying to accomplish is, on a LEAD VOCAL - find out:

                • Are there sends on the selected track, and if so are they active?
                • If yes, select the corresponding aux tracks those sends are returning to
                • Commit those tracks and the source LEAD VOCAL track

                an example result then would be :
                LEAD VOCAL DRY
                LV PITCH SHIFT
                LV REVERB #1
                LV REVERB #2
                LV DELAY #1

                Thanks!