Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize OSC Implementation #125

Merged
merged 12 commits into from Mar 28, 2023
Merged

Optimize OSC Implementation #125

merged 12 commits into from Mar 28, 2023

Conversation

benaclejames
Copy link
Owner

This PR utilizes a rust-made .dll to handle the bulk of OSC serialization/deserialization. It helps a little with optimization but also clears up our internal codebase a bit!

@benaclejames benaclejames added the enhancement New feature or request label Mar 25, 2023
Copy link
Collaborator

@regzo2 regzo2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some things that might be worth looking at. I'll leave it up to you if you wanna make those changes! I haven't look at your Rust OSC lib but these are just addressing the interfacing of it (what you're probably looking for). Everything else looks pretty good from looking at the other changes.

Also have yet to test it but just some observations of the code.

VRCFaceTracking/MainStandalone.cs Outdated Show resolved Hide resolved
VRCFaceTracking/MainStandalone.cs Outdated Show resolved Hide resolved
VRCFaceTracking/ConfigParser.cs Outdated Show resolved Hide resolved
VRCFaceTracking/OSC/OSCMessage.cs Outdated Show resolved Hide resolved
Copy link
Collaborator

@regzo2 regzo2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one final thing related to the legacy msg. Everything under the hood works exactly as expected!

VRCFaceTracking/MainStandalone.cs Outdated Show resolved Hide resolved
Copy link
Collaborator

@regzo2 regzo2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Everything is working as expected and the review comments are just for things we might want to do in the future (if at all).

Also for your Rust lib you could bring back the DependencyManager, I had removed it from the SRanipal rejection from the VRCFaceTracking namespace but would make sense for this (or even embedding the compiled binary into the EXE somehow like how ILMerge or Fody.Costura can be used to achieve that).

@@ -9,12 +9,13 @@ namespace VRCFaceTracking.OSC
public class OSCParams
{
private const string DefaultPrefix = "/avatar/parameters/";
private const string CurrentVersionPrefix = "v2/";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda makes me think we should include some sort of versioning within the IParameter side of the parameter eventually, and use OSCParams or another wrapper that enforces it (like with the base parameters getting added to AllParameters for eg.).

I think for now this works pretty good and we can always revisit it ofc!

{
_paramName = paramName;
_negativeParam = new BaseParam<bool>(paramName + "Negative");
_getValueFunc = getValueFunc;
_negativeParam = new BaseParam<bool>(paramName + "Negative", data => getValueFunc.Invoke(data) < 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also another thing we could consider doing in another PR in the future: if there isn't a negative parameter parsed then it won't return the negative values on output (there might be some cases where an avatar creator wants to use the positive part of a combined param and exclude the negative bool to save a little space).

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already the case! Binary bits check to ensure the negative parameter is relevant before sending. If not and the value would be negative, they just return false
https://github.com/benaclejames/VRCFaceTracking/pull/125/files/5fa1874372286802b9c2d04cf6a0c7f6f3f9eca3..fe8709c89c71dcd946767fcb05435204076c54fe#diff-5ed98eabd76f774c20ea2dc83b3436d6ff97b8b5df8f0ea0d7b07facd30a0d27R115-R117

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though maybe you mean allowing it to return a value regardless of whether or not the negative parameter is relevant or not (might be misunderstanding you here). Though as you said, can always be fixed in the future :)

@benaclejames benaclejames merged commit 775759e into master Mar 28, 2023
1 check passed
@benaclejames benaclejames deleted the refactor/osc branch August 6, 2023 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants