Skip to content

Commit

Permalink
Fixed #56 - Tube Unit now supports low-sensitivity attenuverters.
Browse files Browse the repository at this point in the history
  • Loading branch information
cosinekitty committed Jun 25, 2024
1 parent d8b9a3c commit c74e96c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ul>
<li>Galaxy: added option for polyphonic stereo input to a single input port (L or R).</li>
<li>Galaxy: auto-reset if output becomes non-finite or goes outside 100&nbsp;V absolute value.</li>
<li>Tube Unit: [Issue #56](https://github.com/cosinekitty/sapphire/issues/56) - added support for <a href="LowSensitivityAttenuverterKnobs.md">low-sensitivity attenuverters</a>.
</ul>
</td>
</tr>
Expand All @@ -34,7 +35,7 @@
<td align="center">2.4.5</td>
<td align="left">
<ul>
<li>The following Sapphire modules already supported <a href="LowSensitivityAttenuverterKnobs.md">low-sensitivity attenuverters attenuverter knobs</a>: Elastika, Nucleus, Polynucleus. Now, in addition to being able to right-click and toggle each attenuverter's sensitivity one at a time, you can right-click on any of the above modules to toggle all of its attenuverters.</li>
<li>The following Sapphire modules already supported <a href="LowSensitivityAttenuverterKnobs.md">low-sensitivity attenuverters</a>: Elastika, Nucleus, Polynucleus. Now, in addition to being able to right-click and toggle each attenuverter's sensitivity one at a time, you can right-click on any of the above modules to toggle all of its attenuverters.</li>
</ul>
</td>
</tr>
Expand Down
6 changes: 6 additions & 0 deletions TubeUnit.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ when the limiter is active. The warning light option
defaults to being enabled.

<a name="vent_seal_toggle"></a>

### Toggling between VENT mode and SEAL mode

As [mentioned above](#vent_port), there is a VENT port in the upper left
corner of the panel.

Expand Down Expand Up @@ -228,3 +230,7 @@ high, Tube Unit starts making sound.

The VENT/SEAL input is polyphonic just like all the
other input ports in Tube Unit.

### Low-sensitivity attenuverters

Tube Unit supports [low-sensitivity attenuverters](LowSensitivityAttenuverterKnobs.md).
15 changes: 14 additions & 1 deletion src/tubeunit_vcv.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <algorithm>
#include "sapphire_vcvrack.hpp"
#include "sapphire_widget.hpp"
#include "tubeunit_engine.hpp"

// Sapphire Tube Unit for VCV Rack 2, by Don Cross <cosinekitty@gmail.com>
Expand Down Expand Up @@ -192,6 +193,8 @@ namespace Sapphire
// Thus we allow the complete range of control for any CV whose
// range is [-5, +5] volts.
float attenu = params[cg.attenId].getValue();
if (isLowSensitive(cg.attenId))
attenu /= AttenuverterLowSensitivityDenom;
slider += attenu*(cv / 5)*(cg.maxValue - cg.minValue);
}
return std::clamp(slider, cg.minValue, cg.maxValue);
Expand Down Expand Up @@ -380,7 +383,14 @@ namespace Sapphire
addParam(createParamCentered<RoundLargeBlackKnob>(knobCenter, tubeUnitModule, cg.paramId));

Vec attenCenter = knobCenter.plus(mm2px(Vec(-10.0*xdir, -4.0)));
addParam(createParamCentered<Trimpot>(attenCenter, tubeUnitModule, cg.attenId));
SapphireAttenuverterKnob* knob = createParamCentered<SapphireAttenuverterKnob>(attenCenter, tubeUnitModule, cg.attenId);
if (module != nullptr)
{
// Allow Tube Unit's attenuverter knobs to participate in the "low-sensitivity" feature.
knob->lowSensitivityMode = module->lowSensitiveFlag(cg.attenId);
module->defineAttenuverterId(cg.attenId);
}
addParam(knob);

Vec portCenter = knobCenter.plus(mm2px(Vec(-10.0*xdir, +4.0)));
addInput(createInputCentered<SapphirePort>(portCenter, tubeUnitModule, cg.inputId));
Expand Down Expand Up @@ -420,6 +430,9 @@ namespace Sapphire

// Add toggle for whether the VENT port should be inverted to a SEAL port.
menu->addChild(createBoolPtrMenuItem<bool>("Toggle VENT/SEAL", "", &tubeUnitModule->isInvertedVentPort));

// Add an option to toggle the low-sensitivity state of all attenuverter knobs.
menu->addChild(tubeUnitModule->createToggleAllSensitivityMenuItem());
}
}
}
Expand Down

0 comments on commit c74e96c

Please sign in to comment.