Skip to content

Commit

Permalink
added framerate to stream info output
Browse files Browse the repository at this point in the history
  • Loading branch information
IASpaceAdmin committed Jun 15, 2021
1 parent 4d14129 commit 41e22c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 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.6.0
NatNetThree2OSC 8.7.0
===================================


Expand Down
9 changes: 7 additions & 2 deletions source/NatNetThree2OSC/NatNetThree2OSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Options
[Option("yup2zup", Required = false, Default = false, HelpText = "transform y-up to z-up")]
public bool myUp2zUp { get; set; }

[Option("dataStreamInfo", Required = false, Default = 0, HelpText = "sends streaminfo message to the console as feedback")]
[Option("dataStreamInfo", Required = false, Default = 0, HelpText = "sends each specified [ms] a streaminfo message to the console as feedback")]
public int mDataStreamInfo { get; set; }

[Option("leftHanded", Required = false, Default = false, HelpText = "transform right handed to left handed coordinate system")]
Expand Down Expand Up @@ -148,6 +148,8 @@ public class NatNetThree2OSC
private static Int16 mProxyHS_data = 0;
private static Int16 mProxyHS_ctrl = 0;

private static Int16 mProxyHS_frameCounter = 0;

private static bool mMatrix = false;
private static bool mInvMatrix = false;

Expand Down Expand Up @@ -200,9 +202,11 @@ public static void StreamInfoThread()
{
while (true)
{
Console.WriteLine("streaminfo {0} {1}", mProxyHS_data, mProxyHS_ctrl);
float fps = (float)mProxyHS_frameCounter / (float)mDataStreamInfo * 1000.0f;
Console.WriteLine("streaminfo {0} {1} {2}", mProxyHS_data, mProxyHS_ctrl, fps);
mProxyHS_data = 0;
mProxyHS_ctrl = 0;
mProxyHS_frameCounter = 0;
Thread.Sleep(mDataStreamInfo);
}
}
Expand Down Expand Up @@ -487,6 +491,7 @@ in the frame handler is kept minimal. */
}
else if (data.iFrame % mFrameModulo == 0)
{
mProxyHS_frameCounter++;
/* 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 Down

0 comments on commit 41e22c7

Please sign in to comment.