Browse Source

this is essentially ready for a release. the core parts all work now

John 1 year ago
parent
commit
944426feba
3 changed files with 3 additions and 11 deletions
  1. 3 6
      osc.lua
  2. 0 1
      routing.lua
  3. 0 4
      serverFunction.lua

+ 3 - 6
osc.lua

@@ -63,8 +63,6 @@ end
 function osc.unpack(rawDataGram)
   local msg = {}
   setmetatable(msg,messageMetatable)
-  -- msg.appendArgument = osc.appendArgument
-  -- msg.getArgument = osc.getArgument
 
   -- grab address
   -- this nifty patter to match OSC strings only works if you know there is a non-zero character after
@@ -75,10 +73,11 @@ function osc.unpack(rawDataGram)
   msg.argString = rawDataGram:match("[^%z]+", addressEnd+1)
 
   --       start of arg       len of str       offset for the nulls
-  argEnd = addressStart + 1 + #msg.argString + 2
-
+  argEnd = addressEnd +  #msg.argString + (4 - #msg.argString % 4)
+  
   -- grab the arguments
   local dataStart = argEnd+1
+
   for index=1,#msg.argString,1 do
     local c = msg.argString:sub(index,index)
 
@@ -119,8 +118,6 @@ function osc.create(addr, ...)
   local arg = {...}
   local msg = {
     addr = osc.toOSCString(addr),
-    --appendArgument = osc.appendArgument,
-    --getArgument = osc.getArgument,
     argString = ",",
   }
 

+ 0 - 1
routing.lua

@@ -1,7 +1,6 @@
 local osc = require("osc")
 
 local routing = {}
-local pretty = require("pl.pretty")
 
 -- a map of incoming to outgoing addresses
 -- each entry will contain a collection of entries

+ 0 - 4
serverFunction.lua

@@ -18,10 +18,6 @@ local function servingFunction (host, port)
   while true do
     local dgram = udp:receivefrom()
     if dgram then
-      print("# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #")
-      print("# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #")
-      print("# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #")
-      print("# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #")
       local incoming = osc.unpack(dgram)
       local outgoings = routing.createRoutedMessages(incoming)
       for _, out in pairs(outgoings) do