surge-synthesizer/surge-rack

Kiss to Connect

baconpaul opened this issue · 11 comments

Over in #983 @ContemporaryInsanity and I got chatting about kiss to connect. This is an idea kinda like how bespoke does connection if you jog two modules into each other they will connect.

It's a super neat idea and NeighborConnectable makes it possible but there's two technical challenges making it hard

  1. Where to store the preference since it is cross module. Tricky. But resovlvable. But then more importantly
  2. My comment in #983 on onExpanderChange at loading patches. Much harder.

So putting this in a 2.3 issue instead of a 2.2.n but may swap it around. It may also not be feasible. Lets see.

I'm not familiar with onExpanderChange.

Have a look here https://github.com/ContemporaryInsanity/RacketScience2/blob/main/src/RSRand.cpp

That's how I detect a new right expander, not sure if this is of any help though.

yeah basically the very first change from null to non-null you need to ignore on each side otherwise unstream will generate the event. that's the trick but requires some testing.

onExpanderChange is just a function that gets called by rack when the expander changes so you don't have to write code like the code you linked :) The resulting data structure is the same it's just you can let rack tell you rather than poll basically.

the problem is, of course, ignoring the 'first' connect would be bad when you add a module. you really need to know whether you are in startup or unstream. it's not an easy problem.

"So if you saved a patch with a pair of adjacent modules with kiss to connect on and loaded it, the naive implementation would connect them."

Not sure I'm understanding this 100%.

So on patch load, the previously connected, then saved modules would already be connected, and part of doing this involves not auto-connecting if already connected so I don't currently comprehend how this is an issue? I know I'm missing something here...

If you saved a patch where you had disconnected two modules on unstream the kiss to connect would kick in and override creating the cables which you had removed

Got it, thanks.

Forearmed with this knowledge, would that be a real world problem? Certainly not a perfect solution, but knowing that would happen under those circumstances would not be an issue for me. Plus the way I patch with Surge is typically always left to right so with my normal workflow it wouldn't be an issue regardless of this side effect.

Yes. Save and restore a parch gives the identical result is a more important constraint than any feature.

So I need to figure it out.

but I can. It’s just a bunch of edge cases

Save an outputDisconnected flag in the module's JSON, check that on kiss and if true don't connect?

But then preset load for a vco wouldn’t connect first time
Etc

but yes it’s something like thst then making sure it acts appropriately in all the cases

Thanks for indulging me, I'm not as sharp as I once was.

Good luck with it and thanks for everything so far :)

Ha no problem

like I said it’s not intractable it’s just the easy idea I had doesn’t work