Porting c# from a beta plugin to gamma

I’m trying to update an old (10 years beta31.2) patch to gamma
First obstacle, it uses Max/Jitter Matrix Nodes | vvvv beta contributions
Which has all the c# in it, but whether to try and patch it, or c#, it I dont really know. I thought to start, I tried to make a vl doc in beta so I can compare outputs, but even the header doesn’t look right, before I even think about what endian it should work with or how to convert it…
jit_VL_01.zip (189.7 KB)
Would it be easier to just c# it? I have no idea about how to do that though tbh, although it doesnt look that complex.

Do you need the Decoder, Encoder or both?

Both, its for a sensacell display, which I dont think are made anymore, so I hope they never break!

Where did you get the code from? It’s not on the contribution page and seems different from the compiled plugin that’s available.

There’s a good question! I’ll be honest I have no idea! It’s the one I’m using in the patch that is in the working version, maybe motzi or someone else had it in a reply on the forums, but I can’t find the thread, it’s possible I’ve hacked it about too :D

Ah the source is here,

lazy me would probably just go for c#.
the whole gist of it is contained in the spreadmax loop (no external functions or class inheritance things). maybe even chatgpt can do the refactoring.

  • start with the c# template in gamma
  • copy&paste everthing inside of the for (int i = 0; i < spreadMax; i++) loop into the template function body
  • take the plugin inputs (Input<string> FId,...) and apply them as function parameters (string Id)
  • change outputs need to out function parameters
  • work through the function body code and change the pin read/writes from array access (FId[i] = ...) to direct assignments (FId = ...)

It’s not that straight forward because the input in VL isn’t a Stream.

Updated the plugin so it works in beta42 and added a patched decoder (for 6.x previews).

jit_VL_b.7z (7.8 MB)

2 Likes

Cool Thanks! I’ll have a crack at the encoder when I get home on wednesday!

Oh, wow - what time portal is being opened here…

I even have still some of those modules lying around (and the modules we installed 10 years ago are are still in use). If time permits i’ll have a look if this works as expected. Thanks @bjoern for being faster than my shadow ;)

3 Likes

time portal is being opened here…
I know!

csharp.zip (107.2 KB)
Thought I’d try @woei suggestion of c# and I’ve got no errors, but it doesnt appeatr in the browser and vsstudio says

The current .NET SDK does not support targeting .NET 8.0. Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 8.0.
I didn’t even know there was a net8, nor how to change the target! So Woei’s lazy is my whahhaaatt?

Found & fixed a bug and tried to make it a little more tidy.

jit_VL_b2.7z (288.0 KB)

1 Like

Travelling home today, so I’ll give a look tomorrow
Thanks so much for your help

nerd-sniped

Encoder, Decoder, Help patch.

VL.IO.JitterMatrix.7z (55.2 KB)

3 Likes

quite direct port of the original code.
unfortunately .NET doesn’t support the BinaryReader.ReadInt32(BigEndian) overload anymore, therefore some things had to change.
the rest is more an example, how you’d could go about converting from beta plugins to gamma.

untested though
SensaCell.zip (131.5 KB)

3 Likes

@woei
Gives a error. ArgumentOutOfRangeException
Specified argument was out of the range of valid values. (Parameter ‘start’)
@bjoern That looks perfect!
Thanks for both your help, even patching that would have (and did!) stump me!
I hope some other people need jitter matrixes as well!
Remind me to buy you both a (few) drink(s) next node/when we meet again, its been too long!

1 Like

well, that’s why it makes sense to actually test stuff like bjoern does…

blind copy pasting resulted in wrong parsing of the datasize ~L86 and the next line as well

here you go
SensaCell_fix.zip (165.4 KB)

VL.IO.JitterMatrix.zip (84.3 KB)

Some slight changes to @bjoern 's patch, some of the header wasn’t quite right, as I don’t have the hardware here, I want to try and get things as close to the known working as possible, as the tiles might not like a malformed header. I’ve also put the decoder in a try region as the patch was halting every now and again, when recieving from beta, it might be the lower frame rate?
I did try and get an encoder in woei’s plugin, but again I failed with .net 7/8 errors, and I have no idea how to retarget.
I also added a second help patch that pipets the data from a texture.

@catweasel
what are your .net errors?
i thought you got the csproj running and loaded in gamma? (since you noticed the runtime argument out of range error.
do you have visual studio installed?