UDP close on exit

Home Forums General Programming UDP close on exit

Tagged: , , , ,

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #70542
    fundorin
    Participant
      • Topics: 8
      • Replies: 66
      • Total: 74

      I need a way to automatically close opened ports (mainly, UDP) on the following occasions: panel close, standalone quit, vst remove from host.
      I also need a way to open udp port back with desired settings, so I could add a modulator button, which will close and then open udp port on button press (reset port).

      #70543
      proton
      Participant
        • Topics: 19
        • Replies: 94
        • Total: 113
        • ★★

        Hi fundorin, use variation of this in your method to switch stuff:

        panel:getProperty(“panelOSCEnabled”)
        panel:setPropertyString(“panelOSCEnabled”,”0″)
        —–/// 0 = OFF, 1 = ON ///—–

        panel:getProperty(“panelOSCPort”)
        panel:setPropertyString(“panelOSCPort”,”7777″)
        —–/// 7777 = port number to listen on ///—–

        panel:getProperty(“panelOSCProtocol”)
        panel:setPropertyString(“panelOSCProtocol”,”4″)
        —–/// 0 = Default, 1 = UDC, 2 = UNIX/LOCAL, 3 = TCP ///—–

        #70544
        fundorin
        Participant
          • Topics: 8
          • Replies: 66
          • Total: 74

          Thanks, proton. Where did you get this info?

          Did you try to get full string arguments instead of only first character today?
          Could this issue be connected with atom’s announcement about luabind problems in Lua 5.3?

          #70545
          proton
          Participant
            • Topics: 19
            • Replies: 94
            • Total: 113
            • ★★

            Hi, I checked the Utility panel on the right to see all the available properties and no, sorry, I am still at work and will have to stay longer today so maybe on the weekend I will try the string thing. Let us know how is the progress, cheers!

            #70546
            fundorin
            Participant
              • Topics: 8
              • Replies: 66
              • Total: 74

              23:40 here, in Russia, now. 😉

              #70547
              fundorin
              Participant
                • Topics: 8
                • Replies: 66
                • Total: 74

                I’ve been able to add button that enables UDP port and sets it to 9999. That’s fine.

                The thing is that if I remove Ctrlr vst from Reaper and add it again, osc commands aren’t showing in console, anymore.

                I believe, this is happening because when vst plugin is deleted from FX chain, Ctrlr doesn’t close UDP port, so the new instance can’t communicate via that port.
                Is there a trigger in Ctrlr, that will launch Lua script on panel close/Ctrlr remove from host?

                #70548
                atom
                Keymaster
                  • Topics: 159
                  • Replies: 2945
                  • Total: 3104
                  • ★★★★★

                  you might be right, the destructor of the OSC subsystem wasn’ calling close, i fixed that, once i do a new build this will be fixed

                  #70550
                  fundorin
                  Participant
                    • Topics: 8
                    • Replies: 66
                    • Total: 74

                    Glad to here from you, atom.
                    This and OSC handler method in CtrlrPanelOSС.cpp (lines 159-185) are the only two things preventing me from making a fully working MIDI<>OSC bridge. If Ctrlr would correctly open/close udp ports and handle strings, I would be happy.

                    #70556
                    atom
                    Keymaster
                      • Topics: 159
                      • Replies: 2945
                      • Total: 3104
                      • ★★★★★

                      i’ll fix the port closing issue, what about the handler functions what do you need from them ?

                      #70557
                      fundorin
                      Participant
                        • Topics: 8
                        • Replies: 66
                        • Total: 74

                        I wrote about it at Github. I can’t find a way to get string agrument/value from OSC command. Only float or int numbers.
                        Instead of returning a string, this function returns only the first character.
                        arguments table contains some userdata and I don’t know how to retreive string value out of it.
                        The code below is what I’m using.

                        
                        onOSCMessage = function(path, types, arguments)
                        
                        	action = path
                        	oscType = types	
                        
                        	if types=='f' then
                        		value = tonumber(arguments[0].f)
                        	elseif types=='s' then
                        		value = string.format('%s', arguments[0].s)
                        	end
                        	console('OSC: '..action..' Value: '..value..' Type: '..oscType)
                        

                        And this is the console output. When I’m selecting a track, Reaper returns track name. In this case, the name of the track is “qwerty”, but the value shown is 113, which is a decimal representation of the first character in the name, which is “q”.

                        
                        LUA>> OSC: /device/track/select/2 Value: 1 Type: f
                        LUA>> OSC: /track/name Value: 113 Type: s
                        LUA>> OSC: /track/2/name Value: 113 Type: s
                        

                        I’ve tried different ways to get the full string, but nothing worked.

                        #70563
                        atom
                        Keymaster
                          • Topics: 159
                          • Replies: 2945
                          • Total: 3104
                          • ★★★★★

                          i found the problem, fixing it now, its a hard one

                          #70567
                          fundorin
                          Participant
                            • Topics: 8
                            • Replies: 66
                            • Total: 74

                            Thank you. Will be waiting for an update.

                            P.S. Sent you a private message, that might be important.

                          Viewing 12 posts - 1 through 12 (of 12 total)
                          • The forum ‘Programming’ is closed to new topics and replies.
                          There is currently 0 users and 65 guests online
                          No users are currently active
                          Forum Statistics
                          Threads: 2,495, Posts: 17,374, Members: 77,605
                          Most users ever online was 12 on January 22, 2019 3:47 pm
                          Ctrlr