No internet connection
  1. Home
  2. How to

Platane Joystick

By Tom Weber @Tom_Weber
    2024-11-07 10:13:57.853Z

    Hi out there, I am using Platane Joysticks to control panning. Works quite fin. Of course there are better ones on the market. But this one is 109$ each and you need 2 of them, X and y axis. The only annoying thing is that I always have to click with the mous on the tiny little "window output button" of the selecetd track. If there is a possibility in soundflow for a script which simulates a mouseclick on this tiny "window outout button" of the attentioned track it should work - just an "open" command will not work for Platane. Can you help. I will let a link to the platane Joysticks. I do not know if this is ok in the forum. If not please forgive and tell me, I will delete it.
    Cheers Tom

    https://www.platane.us/index.php/products/daw-controller/js.html

    • 17 replies

    There are 17 replies. Estimated reading time: 12 minutes

    1. B
      Brandon Jiaconia @Brandon_Jiaconia
        2024-11-07 17:11:42.077Z

        Courtesy of @raphaelsepulveda :

        if (!sf.ui.proTools.mainTrackOutputWindow.exists) {
            sf.ui.proTools.selectedTrack.trackOutputToggleShow();
        }
        

        Lots of good info in the thread:

        1. TTom Weber @Tom_Weber
            2024-11-07 18:58:30.682Z

            Hi Brandon, thnx for trying to help. but thei command does not help. Indeed it opens the output window but the very important "Mouse CLICK" on the small spot is not there . I do not know if the "mouse click" is possible in soundflow. After a click the joystick os working on the desired track. Without the click not!
            Cheers Tom

          • O
            In reply toTom_Weber:

            Hey Tom,

            We had some discussions on the field recording slack about this issue. I solved it by SF following track select like this worked for me for having the plantane chase.

            var lastFocusedTrackName;
            
            globalState.runAutoFollowOutputWin = !globalState.runAutoFollowOutputWin
            
            function main() {
                try {
            
                    var newName = sf.ui.proTools.selectedTrackNames[0];
                    if (newName === lastFocusedTrackName || newName === undefined) return;
            
                    lastFocusedTrackName = newName;
            
                    if (sf.ui.proTools.selectedTrack.outputWindowButton.value.invalidate().value !== 'open')
                        sf.ui.proTools.selectedTrack.trackOutputToggleShow({ onError: 'Continue' });
            
                } catch (err) {
                }
            }
            
            function runForever(name, action, interval, timeout) {
                var now = (new Date).valueOf();
                if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
            
                globalState[name] = now;
                sf.engine.runInBackground(function () {
                    try {
                        while (true && globalState.runAutoFollowOutputWin) {
                            sf.engine.checkForCancellation();
                            globalState[name] = (new Date).valueOf();
            
                            action();
            
                            sf.wait({ intervalMs: interval, executionMode: 'Background' });
                        }
                    } finally {
                        globalState[name] = null;
                    }
                });
            }
            
            runForever("isFollowFocusedTrackRunning", main, 500, 5000);
            
            

            Press once to start the script running, it will then open the output window on whatever track you have selected in a way that the plantane likes... at least mine did. Don't have it in front of me to test currently.

            But give it a swing. Run the command again to make it stop having output window chase.

            1. TTom Weber @Tom_Weber
                2024-11-07 20:41:41.963Z

                Thnx Owen, this works. Great makes the mix with the joystick very handy.
                Cheers Tom

                1. Owen beat me to it.
                  This script will position the mouse onto the panner dot and mouse down when you run it the first time.
                  When you run it again it will release the mouse and return it to its original position.
                  I don't have that joystick so it may not work. It works great with my track ball.

                  // Ensure globalState.pannerMouseClick exists
                  if (!globalState.pannerMouseClick) globalState.pannerMouseClick = "down";
                  
                  let pannerMouseClick = globalState.pannerMouseClick;
                  
                  let panWindow = sf.ui.proTools.mainTrackOutputWindow;
                  
                  //Check for output window and if output window is multichannel
                  if (!panWindow.exists) {
                      log("Set Mouse For Joystick", "No open output window")
                      throw 0
                  };
                  if (panWindow.frame.w < 300) {
                      log("Set Mouse For Joystick", "Output window is not multi-channel")
                      throw 0
                  }
                  
                  // If pannerMouseClick is up then press down on panner window
                  if (pannerMouseClick == "up") {
                  
                      //Get and store current mouse position in global state
                      globalState.origMousePosition = {
                          x: sf.mouse.getPosition().position.x,
                          y: sf.mouse.getPosition().position.y
                      }
                      let origMousePosition = globalState.origMousePosition
                  
                  // Click in panner field to select panner puck
                      sf.mouse.click({
                          position: {
                              x: panWindow.frame.x + 140,
                              y: panWindow.frame.y + 175
                          }
                      });
                      sf.wait({ intervalMs: 50 })
                  
                      // Get current mouse position (puck) and press mouse down
                      let curserPosition = sf.mouse.getPosition().position;
                  
                      sf.mouse.down({
                          position: {
                              x: curserPosition.x,
                              y: curserPosition.y
                          }
                      })
                  
                      // Set mouse to it's original position to prevent puck from moving form orig position when user moves mouse
                      sf.mouse.setPosition({
                          position: {
                              x: origMousePosition.x,
                              y: origMousePosition.y
                          }
                      })
                      // Set pannerMouseClick state to down
                      globalState.pannerMouseClick = "down";
                  
                  } else {
                  // If pannerMouseClick is down then release mouse (mouse up) 
                      let origMousePosition = globalState.origMousePosition;
                  
                      let curserPosition = sf.mouse.getPosition().position;
                  
                      sf.mouse.click({
                          position: {
                              x: curserPosition.x,
                              y: curserPosition.y
                          }
                      })
                      //Return mouse to original position
                      sf.mouse.setPosition({
                          position: {
                              x: origMousePosition.x,
                              y: origMousePosition.y
                          }
                      })
                  
                      // Set pannerMouseClick state to up
                      globalState.pannerMouseClick = "up"
                  }
                  
                  1. TTom Weber @Tom_Weber
                      2024-11-07 23:24:29.154Z

                      Hi I do not understand well. You do need an open output window. and the red dot of the panner must be in some kind of default position. The script positions the mouse arrow over the red dot and click - holding holding pannig - till the second click which will release the panner dot. is this right?

                      After firing the command of owens script the joysticks stays aktiv even I change tracks with the keys or selecting by clicking in it. Strange is that I do not have to fire owens comand again - open output window with the default command is ok, Joystick stays aktiv.
                      Cheers Tom

                      1. I think what @Chris_Shaw Built is something totally different and pretty cool. It's designed to turn your trackball into a joystick until you click to disable it again. Which is pretty nifty. I have to try it out.

                        1. TTom Weber @Tom_Weber
                            2024-11-07 23:43:31.020Z

                            Yes this is a very different approach.
                            Thanks to all
                            Tom

                          • In reply toTom_Weber:

                            You probably could embed the script inside of a runForever script that would stop when it detects PT playback.
                            I'll see if I can whip one up later today.

                            1. TTom Weber @Tom_Weber
                                2025-01-29 14:45:19.681Z

                                This sounds great, indded.

                            2. In reply toChris_Shaw:

                              This is WAY better then the Plantane. I just had to unplug mine cuz the detail is SO COARSE its unusable. Not sure if it's user error.

                              ANYWAYS, I wanted to ask you chris if you thought there was any way this script could instead of needing to be pressed again to 'unlock' the mouse, if PT playback Stopped it would 'unlock'

                              1. How would you be using this wrt playback?
                                Would you start playback then run this script which would then quit on the transport stopping or would you run it, start the transport, then have it quit when the transport is stopped?
                                The logic gets a bit complex if you want to do both

                                1. If I had to pick one, I think it would be run. Scripty start playback on playback stop and clicks/unlocks mouse.

                                  1. If i'm reading this correctly, you'd prefer:

                                    • run script (" run. Scripty"),
                                    • start playback (initiated by user or the script?)
                                    • script quits on playback
                                    1. Yes... or heck how about running the script starts playback? i can handle that I think :P

                          • TTom Weber @Tom_Weber
                              2024-11-08 14:16:51.619Z2024-11-08 14:36:01.338Z

                              Hi Owen, what does not work is that the process stopps and the window closes with the 2nd hit on the button. In fact it would be very helpfull if the the windows closes and the joystick stopps working. For the next joystick move we should hit the butten again, the window opens and the Joystick stats to work the selected track. Thnx and Cheers Tom

                              1. So yeah this one is designed with that intention. It's a 'run forever script' so press it once to chase your track slection without having to keep pressing the button. And then when you're done panning press it again to turn it off. Feels sleeker to me to not have to press the button every time you want to pan. But in theory you should be able to just pull the guts out of this to open the window. Try out @Brandon_Jiaconia 's sent channel. That is all this script is using anyways, due to the nature of how it's targeting the panner it skips that mouse click needed step, unlike follwing with Eucon which does not trigger the joystick.