From f1d42f5099d2c7cab4c3246dd0a092efa9c08ea1 Mon Sep 17 00:00:00 2001 From: "IAS-ABSINTHE\\IAAdmin" Date: Wed, 16 Jun 2021 19:19:40 +0200 Subject: [PATCH] fixed timestamp --- readme.md | 2 +- source/NatNetThree2OSC/NatNetThree2OSC.cs | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/readme.md b/readme.md index 2501a95..65667c2 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -NatNetThree2OSC 8.7.0 +NatNetThree2OSC 8.7.1 =================================== diff --git a/source/NatNetThree2OSC/NatNetThree2OSC.cs b/source/NatNetThree2OSC/NatNetThree2OSC.cs index aec995d..62738be 100644 --- a/source/NatNetThree2OSC/NatNetThree2OSC.cs +++ b/source/NatNetThree2OSC/NatNetThree2OSC.cs @@ -231,7 +231,7 @@ static void Run(Options opts) mMatrix = opts.mMatrix; mInvMatrix = opts.mInvMatrix; - Console.WriteLine("\n---- NatNetThree2OSC v. 8.6.0 ----"); + Console.WriteLine("\n---- NatNetThree2OSC v. 8.7.1 ----"); Console.WriteLine("\n---- 20210531 by maybites ----"); Console.WriteLine("\nNatNetThree2OSC"); @@ -492,6 +492,8 @@ in the frame handler is kept minimal. */ else if (data.iFrame % mFrameModulo == 0) { mProxyHS_frameCounter++; + + int myTimestamp = (int)((Int64)(data.fTimestamp * 1000f) % 86400000); /* Processing and ouputting frame data every 200th frame. This conditional statement is included in order to simplify the program output */ var message = new OscMessage("/f/s", data.iFrame); @@ -501,7 +503,7 @@ This conditional statement is included in order to simplify the program output * message = new OscMessage("/f/s", data.iFrame); ; bundle.Add(message); - message = new OscMessage("/f/t", (Int32)(data.fTimestamp * 1000f)); + message = new OscMessage("/f/t", myTimestamp); bundle.Add(message); } @@ -510,10 +512,10 @@ This conditional statement is included in order to simplify the program output * message = new OscMessage("/frame/start", data.iFrame); ; bundle.Add(message); - message = new OscMessage("/frame/timestamp", (Int32)(data.fTimestamp * 1000f)); + message = new OscMessage("/frame/timestamp", myTimestamp); bundle.Add(message); - message = new OscMessage("/frame/timecode", (Int32)data.Timecode, (Int32)data.TimecodeSubframe); + message = new OscMessage("/frame/timecode", (Int64)data.Timecode, (Int64)data.TimecodeSubframe); bundle.Add(message); } @@ -529,7 +531,7 @@ This conditional statement is included in order to simplify the program output * Console.WriteLine("[Recording] Frame #{0} Received:", data.iFrame); */ - processFrameData(data, bundle); + processFrameData(data, bundle, myTimestamp); if (mOscModeSparck) { @@ -558,7 +560,7 @@ This conditional statement is included in order to simplify the program output * mProxyHS_data = 1; } - static void processFrameData(NatNetML.FrameOfMocapData data, List bundle) + static void processFrameData(NatNetML.FrameOfMocapData data, List bundle, int myTimestamp) { var message = new OscMessage("/marker"); @@ -604,7 +606,7 @@ static void processFrameData(NatNetML.FrameOfMocapData data, List bu if (mVerbose == true) { - Console.WriteLine("\tStreaming {0} rigidbodies in frame {1}", mRigidBodies.Count, data.iFrame); + Console.WriteLine("\tStreaming {0} rigidbodies in frame {1} an stamp {2}", mRigidBodies.Count, data.iFrame, myTimestamp); } /* Parsing Rigid Body Frame Data */ @@ -741,7 +743,7 @@ static void processFrameData(NatNetML.FrameOfMocapData data, List bu bundle.Add(message); } } - message = new OscMessage("/rb", rb.ID, 2, (Int32)(data.fTimestamp * 1000f), pxt, pyt, pzt, qxt, qyt, qzt, qwt); + message = new OscMessage("/rb", rb.ID, 2, myTimestamp, pxt, pyt, pzt, qxt, qyt, qzt, qwt); bundle.Add(message); }