VSCode might keep the file open constantly then, Visual Studio creates a temp file, removes original, renames temp file on each save.
I’ll see if a file change can be detected.
You are not hijacking anything. If Internal is not connected then you cant control it. And you can only control it via Internal:: actions.
In your plugin you have to handle MediaSeekMessage and publish MediaPositionChangedMessage with force seek.
For anybody interested, this is the updated script that uses the new toggles that will be released in 1.32.1. It’s improved in various ways and now uses System.Net.Http instead of TCP. This unfortunately will require you to start mfp as administrator though (can be solved by using a different library but this is fine for me for now). I’ll probably change it to a web socket in the future anyways. The plugin could potentially host a basic web page you can go to in your quest, getting similar functionality to deovr with all the MFP benefits. I didn’t add that here as for me it’s part of a larger app of mine but you can see my earlier post for details on how to do this yourself: MultiFunPlayer v1.32.0 - Multi axis funscript player - Now with SLR script streaming - #1261 by fenderwq
Mkay I’ve got problems
MFP with my plugin is too slow to update multiaxis script at 60fps
2-axis is fine, but when I make it 3-axis it starts lagging behind
I wonder if it’s problem with my code or the MFP
Gonna test
The script change message was not designed for what you are doing, you should set the axis value via Axis::Value::Set (with invokeDirectly: true) and it should work better.
Any change to the internal axis state requires a lock.
You could also try keeping a reference to the keyframe collection that you create the script resource with and add new keyframes without sending a new script. But I dont know how well will that work if at all.
As far as I see it requires a lock per axis
Would it be faster is there is only a single lock that is locked once for the whole change?
What are even the use cases where you want to lock each axis separately?
Technically yes, but the lock should be held at most for 0.3-0.5ms.
The multiple locks are from the old versions where the update thread did not lock all axes for an update like it does now.
Btw I experience complete freezes (after which I have to kill MFP) when I click on GUI while it’s updating script in realtime
Should I lock something somewhere?
s.RegisterAction<double>("Media::ScriptOffset::Set",
s => s.WithLabel("Value").AsNumericUpDown(stringFormat: "{0:F2}s"), value => GlobalOffset = value);
There is an action for this, but can I read the property?
This is where it hangs it seems
Should I make a lock or something?
Hmm
Maybe I shouldn’t use async where I don’t need it so I can just make a global lock?
Okay makes sense. I search code of public version and it wasn’t there iirc
Have something spam HTTP requests faster then they cane be processed so it’s busy 100% of the time
HTTP requests update script with ChangeScriptMessage
If you publish another message in void HandleMessage(MediaSeekMessage message) => PublishMessage(new MediaPositionChangedMessage(message.Position, true)); from UI thread while it’s still processing ChangeScriptMessage in HTTP thread, it will hang
So, “you shouldn’t use lock in async code” or something?
I’ve hacked in some SemaphoreSlim (idk what’s that) and it seems to work now
A regular lock didn’t work, a SemaphoreSlim sis work