I am developing a CV generating module.
Its outputs are always connected to CV inputs of other modules.
Because of this, the knobs sometimes stop working on the receiving modules (they are blocked due to the connected cable).
Is it possible on the side of my module to emulate a cable disconnect?
In order not to block the knobs when I am not generating any CV.
the only thing I found out is APP->scene->rack->getCablesOnPort(PortWidget *port) may be a starting point … but I haven’t coded anything that deals with cables so far
I agree. This came up recently here. Most modules do not disable their knobs when a cable is connected. There are a minority that do. That’s just they way they are designed. It first approximation your attempt to re-design these odd-ball modules at run time is maybe not something you need to do?
FWIW, I consider these modules to be broken by design. At least one other person here likes modules that do this. I didn’t quite understand the logic, but they seemed to know what they were talking about.
Anyway, most modules won’t do this. Why not release your module without the heroics and see what people think?
It strikes me that the best way to resolve this, would be to create an intermediate module with an input, an output and a knob. (And probably some more controls for flexibility).
Put that between the source module and the module you consider broken. Then you still have a knob to turn, albeit not the original.
The long-delayed TapPatch (whose cable-management code is based on Stoermelder T7, which is what’s used by the Midilar controller) connects and disconnects actual Rack cables programmatically (just as if you’d done it by mouse), but I’m not sure that’s what you’re wanting to do.
If I understand, you’re trying to trick an actually connected module into thinking it doesn’t have a cable connection, right? In that case, I think your only option is a zero-channel cable (see the manual).
I agree with @carbon14 and @Squinky that using an intermediate module is a much simpler (and possibly better) solution, but if you really need this as a module-level feature, switch the polyphony to zero when you’re not generating CV and it should work. I haven’t tried this myself, but it’s possible in theory and according to the manual description.
[edit: I just looked at the V2 API for setChannels() and I’m not sure this is supported in V2. I’ll investigate.]
[edit 2: ok, setChannels() doesn’t let you do this. You could try setting channels directly, but direct access to this is deprecated. These are really obscure features (see Andrew’s note in the docs asking anybody who did this to email him ) I’ll try this next time I’m working on TapPatch and see what it does, or I’ll glance at the cable/port code if I have a moment before then.]