Skip to content

Commit

Permalink
fixed timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
IASpaceAdmin committed Jun 16, 2021
1 parent 41e22c7 commit f1d42f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NatNetThree2OSC 8.7.0
NatNetThree2OSC 8.7.1
===================================


Expand Down
18 changes: 10 additions & 8 deletions source/NatNetThree2OSC/NatNetThree2OSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand All @@ -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);

}
Expand All @@ -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);
}

Expand All @@ -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)
{
Expand Down Expand Up @@ -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<OscMessage> bundle)
static void processFrameData(NatNetML.FrameOfMocapData data, List<OscMessage> bundle, int myTimestamp)
{

var message = new OscMessage("/marker");
Expand Down Expand Up @@ -604,7 +606,7 @@ static void processFrameData(NatNetML.FrameOfMocapData data, List<OscMessage> 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 */
Expand Down Expand Up @@ -741,7 +743,7 @@ static void processFrameData(NatNetML.FrameOfMocapData data, List<OscMessage> 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);
}

Expand Down

0 comments on commit f1d42f5

Please sign in to comment.