I am looking for a module that can mute a CV signal, and when it’s muted, its as if there is no cable plugged into the final destination.
example, i have a VCA with a modulator plugged into the cv input of the VCA. i would like to be able to mute the modulator, but when i do that, the VCA closes, because it thinks theres a cable plugged into its CV with zero volts on it.
any help?
i’ve gotten around this problem by cloning my vca and the modules going into and out of it using switches and summing mixers, and instead of hitting a mute button, i switch over to the clone, its annoying and takes up space and processing, hope theres a super slick solution that i’m missing here!!
This is exactly what my module Sapphire Moots does. It can plug/unplug a cable just like you did it manually. When “unplugged”, the cable still appears, but it has 0 channels, and looks thinner on the screen. Moots exploits a quirk of VCV Rack: if you create a cable with 0 channels, it acts exactly like there is no cable at all. In many cases this is different from a 0V signal on a 1-channel cable.
Does that method still work with the latest version of rack? I used to do that with my switch modules but after the latest version of rack was released, it was found that once set to 0 channels, the outputs would cease to function properly and they would no longer update. I tracked this back to the changes in the ABI that were made for input stacking.
Yeah - the API and documentation are definitely wonky. But setting channels to 0 definitely works. In addition to MOOTS, VCV Merge does this, as well as Venom Bypass and Bay Output and Bay Norm.
You just have to be careful with your code. I also had some temporary difficulty during development of Bypass and Bay modules. But clues are in the API documentation.
The only way to set the channel count to 0 with code is to write to the channel attribute directly.
The API looks at the channel count to determine if the port is connected. Once you set it to zero, you can no longer change the value with setChannels() - you have to continue to write to channels directly.
Just remember that if you don’t use setChannels(), then higher unused channel voltages are not automatically cleared.
I don’t know if it is necessary, but I also make sure to set the channels to non-zero before I use setVoltage() and the like whenever I have previously set channels to 0.
Thanks for confirming this, Dave. I was worried for a moment that Moots was suddenly broken. I just verified for myself that Moots still works in Rack 2.5.2. For anyone who wants to try it, here is my test patch:
You can confirm it works by following the text instructions embedded in that patch. Here is the original demo video based on that patch, for reference:
Yes, exactly. Here is the line of code in Moots that does this.
Odd. That’s exactly how I was doing it and I was definitely seeing different behaviour on the ports due to the first condition in setChannels.
void setChannels(uint8_t channels) {
// If disconnected, keep the number of channels at 0.
if (this->channels == 0) {
return;
}
// Set higher channel voltages to 0
for (uint8_t c = channels; c < this->channels; c++) {
voltages[c] = 0.f;
}
// Don't allow caller to set port as disconnected
if (channels == 0) {
channels = 1;
}
this->channels = channels;
}