AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

commit 11d304cb3fc5d1c91d6f201302024dacbcf2927e
parent ce6cae1b45de0bb8deed6f0714f0b17026d6c25c
Author: Kai Mikkelsen <43660096+KaiMikkelsen@users.noreply.github.com>
Date:   Sat,  9 Jul 2022 03:44:36 -0700

UI scaling fix (#281)

* improved minimum track width

* better scaling or horizontal slider and xml

* Updated Gui

* More work on UI scaling

* Bring back regular InfoProvider

* More tweaks to gui.xml

* Update gui.xml

* Apply clang-format

* Tweaks to UI scaling for iOS

Co-authored-by: Jatin Chowdhury <jatinchowdhury18@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Diffstat:
M.gitignore | 1+
MPlugin/Source/GUI/Assets/gui.xml | 126++++++++++++++++++++++++++++++++++++++++----------------------------------------
MPlugin/Source/GUI/Assets/gui_ios.xml | 32+++++++++++++++-----------------
MPlugin/Source/GUI/ModulatableSlider.cpp | 32+++++++++++++++++++++++++-------
MPlugin/Source/GUI/ModulatableSlider.h | 5+++++
MPlugin/Source/GUI/MyLNF.cpp | 12++++++++----
MPlugin/Source/GUI/MyLNF.h | 7+++++++
7 files changed, 124 insertions(+), 91 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -31,6 +31,7 @@ LV2.mak # IDE settings .vscode/ .idea/ +Plugin/xcode/ # Other files I don't want *.asd diff --git a/Plugin/Source/GUI/Assets/gui.xml b/Plugin/Source/GUI/Assets/gui.xml @@ -51,25 +51,25 @@ flex-grow="1.5" group="Basic Controls"> <View flex-direction="column" tab-color="" background-color="FF31323A" padding="0" tab-caption="Gain" group="Gain Controls Tab"> - <ModSlider caption="Input Gain" parameter="ingain" class="Slider" name="Input Gain" + <ModSlider caption="Input Gain" parameter="ingain" class="Slider" name="Input Gain" default-height="120" padding="0" margin="0" tooltip="Sets the input gain to the tape model in Decibels."/> <ModSlider caption="Dry/Wet" parameter="drywet" class="Slider" tooltip="Sets dry/wet mix of the entire plugin." - padding="0" margin="0" name="Dry/Wet" slider-track="FF0BBDC2"/> - <ModSlider caption="Output Gain" parameter="outgain" class="Slider" + padding="0" margin="0" name="Dry/Wet" slider-track="FF0BBDC2" default-height="120"/> + <ModSlider caption="Output Gain" parameter="outgain" class="Slider" default-height="120" padding="0" margin="0" name="Output Gain" tooltip="Sets the output gain from the tape model in Decibels."/> </View> <View flex-direction="column" tab-color="" background-color="FF31323A" padding="0" tab-caption="Filters" margin="0" group="Input/Output Filter Controls Tab"> - <ModSlider caption="Low Cut" parameter="ifilt_low" class="Slider" name="Low Cut" + <ModSlider caption="Low Cut" parameter="ifilt_low" class="Slider" name="Low Cut" default-height="120" tooltip="Applies a low cut filter before applying tape processing."/> - <ModSlider caption="High Cut" parameter="ifilt_high" class="Slider" name="High Cut" + <ModSlider caption="High Cut" parameter="ifilt_high" class="Slider" name="High Cut" default-height="120" tooltip="Applies a high cut filter before applying tape processing."/> <TextButton parameter="ifilt_makeup" text="Makeup" text_on="Makeup" background-color="00000000" margin="0" padding="5" button-color="FF33343D" flex-grow="0.35" button-on-color="FFB41717" lookAndFeel="LookAndFeel_V3" name="Makeup" tooltip="Adds the signal cut out by the cut filters back to the processed signal." button-off-text="FFFFFFFF" button-on-text="FFFFFFFF"/> - <PowerButton background-color="00000000" max-height="25" min-height="20" margin="0" + <PowerButton background-color="00000000" max-height="30" flex-grow="0.1" min-height="20" margin="0" padding="0" button-color="ff595c6b" button-on-color="FFEAA92C" parameter="ifilt_onoff" name="Filters On/Off" tooltip="Turns the pre-processing filters on or off."/> </View> @@ -82,7 +82,7 @@ button-on-text="FFFFFFFF" enabled="plugin:is_stereo"/> <View margin="0" padding="0" flex-grow="0.2" background-color="00000000"/> <ModSlider caption="Balance" parameter="stereo_balance" class="Slider" name="Stereo Balance" - padding="5" margin="0" enabled="plugin:is_stereo" + padding="5" margin="0" enabled="plugin:is_stereo" default-height="120" tooltip="Controls the balance between the two channels (stereo or mid/side)."/> <View margin="0" padding="0" flex-grow="0.2" background-color="00000000"/> <TextButton parameter="stereo_makeup" text="Makeup" text_on="Makeup" background-color="00000000" @@ -97,39 +97,39 @@ <View flex-direction="column" tab-color="" background-color="FF31323A" padding="0" tab-caption="Tape" margin="0" group="Tape Controls Tab"> <View margin="0" padding="0" flex-grow="0.05" background-color="00000000"/> - <ModSlider caption="Bias" parameter="width" class="Slider" name="Bias" padding="0" + <ModSlider caption="Bias" parameter="width" class="Slider" name="Bias" padding="0" default-height="120" margin="0" tooltip="Controls the amount of bias used by the tape recorder. Turning down the bias can create &quot;deadzone&quot; distortion."/> - <ModSlider caption="Saturation" parameter="sat" class="Slider" name="Saturation" + <ModSlider caption="Saturation" parameter="sat" class="Slider" name="Saturation" default-height="120" padding="0" margin="0" tooltip="Controls the amount of tape saturation applied to the signal."/> - <ModSlider caption="Drive" parameter="drive" class="Slider" name="Drive" + <ModSlider caption="Drive" parameter="drive" class="Slider" name="Drive" default-height="120" padding="0" margin="0" tooltip="Controls the amount of amplification done during the tape magnetisation process. Note that unlike the &quot;Input Gain&quot;, this amplification is highly nonlinear."/> - <PowerButton flex-grow="1.0" margin="0" padding="0" background-color="00000000" - button-on-color="FFEAA92C" min-height="20" max-height="25" button-color="ff595c6b" + <PowerButton margin="0" padding="0" background-color="00000000" max-height="30" flex-grow="0.1" + button-on-color="FFEAA92C" min-height="20" button-color="ff595c6b" parameter="hyst_onoff" name="Tape On/Off" tooltip="Turns the tape processing on or off."/> </View> <View flex-direction="column" tab-color="" background-color="FF31323A" padding="0" tab-caption="Comp" margin="0" group="Compression Controls Tab"> <View margin="0" padding="0" flex-grow="0.05" background-color="00000000"/> - <ModSlider caption="Amount" parameter="comp_amt" class="Slider" name="Compression Amount" + <ModSlider caption="Amount" parameter="comp_amt" class="Slider" name="Compression Amount" default-height="120" padding="0" margin="0" tooltip="Controls the amount of tape compression applied by the effect."/> - <ModSlider caption="Attack" parameter="comp_attack" class="Slider" + <ModSlider caption="Attack" parameter="comp_attack" class="Slider" default-height="120" name="Compression Attack" padding="0" margin="0" tooltip="Controls the attack speed of the tape compression."/> - <ModSlider caption="Release" parameter="comp_release" class="Slider" + <ModSlider caption="Release" parameter="comp_release" class="Slider" default-height="120" name="Compression Release" padding="0" margin="0" tooltip="Controls the release speed of the tape compression."/> - <PowerButton flex-grow="1.0" margin="0" padding="0" background-color="00000000" - button-on-color="FFEAA92C" min-height="20" max-height="25" button-color="ff595c6b" + <PowerButton margin="0" padding="0" background-color="00000000" max-height="30" flex-grow="0.1" + button-on-color="FFEAA92C" min-height="20" button-color="ff595c6b" parameter="comp_onoff" name="Comp. On/Off" tooltip="Turns the tape compression on or off."/> </View> <View flex-direction="column" tab-color="" background-color="FF31323A" padding="0" tab-caption="Tone" margin="0" group="Tape Tone Controls Tab"> <View margin="0" padding="0" flex-grow="0.05" background-color="00000000"/> - <ModSlider caption="Treble" parameter="h_treble" class="Slider" name="Treble" + <ModSlider caption="Treble" parameter="h_treble" class="Slider" name="Treble" default-height="120" padding="0" margin="0" tooltip="Controls the treble response of the pre/post-emphasis filters."/> - <ModSlider caption="Bass" parameter="h_bass" class="Slider" name="Bass" + <ModSlider caption="Bass" parameter="h_bass" class="Slider" name="Bass" default-height="120" padding="0" margin="0" tooltip="Controls the bass response of the pre/post-emphasis filters."/> - <ModSlider caption="Frequency" parameter="h_tfreq" class="Slider" name="Transition Frequency" + <ModSlider caption="Frequency" parameter="h_tfreq" class="Slider" name="Transition Frequency" default-height="120" padding="0" margin="0" tooltip="Controls the transition frequency between the bass and treble sections of the EQ."/> - <PowerButton max-height="25" min-height="20" margin="0" padding="0" background-color="00000000" + <PowerButton max-height="30" flex-grow="0.1" min-height="20" margin="0" padding="0" background-color="00000000" button-color="ff595c6b" button-on-color="FFEAA92C" parameter="tone_onoff" name="Tone On/Off" tooltip="Turns the tone control processing on or off."/> </View> @@ -138,26 +138,26 @@ lookAndFeel="MyLNF" group="Degradation Controls"> <View flex-direction="column" tab-caption="Loss" tab-color="" background-color="FF31323A" padding="0" margin="0" group="Loss Controls Tab"> - <ModSlider caption="Gap [microns]" parameter="gap" slider-type="linear-horizontal" + <ModSlider caption="Gap [microns]" parameter="gap" slider-type="linear-horizontal" default-height="60" class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Gap" tooltip="Sets the width of the playhead gap. Certain frequencies that resonate with the gap width will be emphasized." - slidertext-height="18" caption-placement="top-left"/> - <ModSlider caption="Thickness [microns]" parameter="thick" class="Slider" + slidertext-height="15" caption-placement="top-left"/> + <ModSlider caption="Thickness [microns]" parameter="thick" class="Slider" default-height="60" slider-type="linear-horizontal" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Thickness" tooltip="Sets the thickness of the tape. Thicker tape has a more muted high-frequency response." - caption-placement="top-left"/> - <ModSlider caption="Spacing [microns]" parameter="spacing" slider-type="linear-horizontal" + caption-placement="top-left" slidertext-height="15"/> + <ModSlider caption="Spacing [microns]" parameter="spacing" slider-type="linear-horizontal" default-height="60" class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Spacing" tooltip="Sets the spacing between the tape and the playhead. A larger spacing means more high frequency signal is lost during playback." - caption-placement="top-left"/> - <ModSlider caption="Azimuth [degrees]" parameter="azimuth" slider-type="linear-horizontal" - class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" + caption-placement="top-left" slidertext-height="15"/> + <ModSlider caption="Azimuth [degrees]" parameter="azimuth" slider-type="linear-horizontal" default-height="60" + class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" slidertext-height="15" name="Azimuth" tooltip="Sets the azimuth angle between the playhead and the tape. This can create a stereo widening effect at higher tape speeds. (Stereo only)" caption-placement="top-left" enabled="plugin:is_stereo"/> - <ModSlider caption="Speed [ips]" parameter="speed" slider-type="linear-horizontal" + <ModSlider caption="Speed [ips]" parameter="speed" slider-type="linear-horizontal" default-height="60" class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Speed" tooltip="Sets the speed of the tape as it affects the playhead loss effects. Note that this control does not affect the wow/flutter processing." - caption-placement="top-left"/> + caption-placement="top-left" slidertext-height="15"/> <View flex-grow="0.53" margin="0" padding="2" background-color="00000000" group="Discrete Tape Speed Options"> <TextButton margin="0" padding="2" text="3.75" button-color="00000000" background-color="00000000" onClick="set_speed_3.75" lookAndFeel="SpeedButtonLNF" button-on-color="00000000" @@ -173,7 +173,7 @@ button-on-color="00000000" name="30 ips" tooltip="Snaps the tape speed to 30 inches per second."/> </View> <View flex-grow="0.01" background-color="00000000"/> - <PowerButton margin="0" padding="0" background-color="00000000" max-height="25" + <PowerButton margin="0" padding="0" background-color="00000000" max-height="30" flex-grow="0.1" min-height="20" button-color="ff595c6b" button-on-color="FFEAA92C" parameter="loss_onoff" name="Loss On/Off" tooltip="Turns the loss filters on or off."/> </View> @@ -182,84 +182,84 @@ <View flex-direction="column" max-height="140" background-color="FF1E1F22" flex-grow="2.0" flex-shrink="2.0" padding="0"> <View max-height="5"/> - <ModSlider parameter="deg_depth" caption="Depth" class="Slider" name="Depth" + <ModSlider parameter="deg_depth" caption="Depth" class="Slider" name="Depth" default-height="60" tooltip="Sets the depth of the tape degradation." slider-type="linear-horizontal" max-height="70" margin="0" min-height="0" slidertext-width="80" - flex-grow="2.5" flex-shrink="2.5" padding=""/> + flex-grow="2.5" flex-shrink="2.5" padding="" slidertext-height="15"/> <TextButton parameter="deg_point1x" text="0.1x" text_on="0.1x" background-color="00000000" margin="0" padding="5" button-color="FF33343D" flex-grow="0.35" button-on-color="FFB41717" lookAndFeel="LookAndFeel_V3" name="0.1x" tooltip="Scales the Depth value by 0.1 to allow for more subtle degradation." button-off-text="FFFFFFFF" button-on-text="FFFFFFFF"/> </View> - <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> + <View margin="0" padding="0" max-height="15" flex-grow="0.05" background-color="00000000"/> <ModSlider caption="Amount" parameter="deg_amt" class="Slider" name="Amount" margin="0" tooltip="Sets the amount of the tape that is degraded. At large values all of the tape will be affected, at small values only some sections will be affected." - slider-type="linear-horizontal" max-height="70"/> - <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> + slider-type="linear-horizontal" default-height="60" slidertext-height="15"/> + <View margin="0" padding="0" max-height="15" flex-grow="0.05" background-color="00000000"/> <ModSlider parameter="deg_var" caption="Variance" class="Slider" name="Variance" margin="0" tooltip="Sets the variance of the tape degradation. Use lower values for uniform degradation, or higher values for variation across different sections of tape." - slider-type="linear-horizontal" max-height="70"/> - <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> + slider-type="linear-horizontal" default-height="60" slidertext-height="15"/> + <View margin="0" padding="0" max-height="15" flex-grow="0.05" background-color="00000000"/> <ModSlider parameter="deg_env" caption="Envelope" class="Slider" name="Envelope" margin="0" tooltip="Sets the amount of amplitude envelope applied to the tape degradation. At 0, the degradation will have no envelope." - slider-type="linear-horizontal" max-height="70"/> - <View margin="0" padding="0" flex-grow="0.15" background-color="00000000"/> - <PowerButton margin="0" padding="0" background-color="00000000" max-height="25" + slider-type="linear-horizontal" default-height="60" slidertext-height="15"/> + <View margin="0" padding="0" max-height="15" flex-grow="0.1" background-color="00000000"/> + <PowerButton margin="0" padding="0" background-color="00000000" max-height="30" flex-grow="0.1" min-height="20" button-color="ff595c6b" button-on-color="FFEAA92C" parameter="deg_onoff" name="Degrade On/Off" tooltip="Turns the degradation processing on or off."/> </View> <View tab-caption="CHEW" padding="0" flex-direction="column" background-color="FF31323A" margin="0" group="Chew Controls Tab"> <View margin="0" padding="0" flex-grow="0.05" background-color="00000000"/> - <ModSlider parameter="chew_depth" caption="Depth" padding="0" margin="0" + <ModSlider parameter="chew_depth" caption="Depth" padding="0" margin="0" default-height="120" class="Slider" name="Chew Depth" tooltip="Controls how intensely the tape has been chewed up."/> - <ModSlider caption="Frequency" parameter="chew_freq" padding="0" margin="0" + <ModSlider caption="Frequency" parameter="chew_freq" padding="0" margin="0" default-height="120" class="Slider" name="Chew Frequency" tooltip="Controls the amount of time in between chewed-up sections of tape."/> - <ModSlider caption="Variance" parameter="chew_var" padding="0" margin="0" + <ModSlider caption="Variance" parameter="chew_var" padding="0" margin="0" default-height="120" class="Slider" name="Chew Variance" tooltip="Controls the amount of variance in the chew frequency."/> - <PowerButton margin="0" padding="0" background-color="00000000" max-height="25" + <PowerButton margin="0" padding="0" background-color="00000000" max-height="30" flex-grow="0.1" min-height="20" button-color="ff595c6b" button-on-color="FFEAA92C" parameter="chew_onoff" name="Chew On/Off" tooltip="Turns the chew processing on or off."/> </View> </View> <View display="tabbed" padding="0" background-color="FF31323A" lookAndFeel="MyLNF" group="Wow/Flutter Controls"> <View tab-caption="Flutter" flex-direction="column" background-color="FF31323A" group="Flutter Controls Tab"> - <FlutterMenu margin="0" padding="0" background-color="00000000" max-height="30" + <FlutterMenu margin="0" padding="0" background-color="00000000" min-height="15" max-height="55" flex-grow="0.25" name="Flutter Sync" tooltip="Snaps the flutter rate to a synchronized value."/> - <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> - <ModSlider caption="Depth" parameter="depth" max-height="150" class="Slider" + <View margin="0" padding="0" max-height="15" flex-grow="0.1" background-color="00000000"/> + <ModSlider caption="Depth" parameter="depth" max-height="150" class="Slider" default-height="120" name="Flutter Depth" tooltip="Sets depth of the tape flutter." margin="0" padding="0"/> - <ModSlider caption="Rate" parameter="rate" class="Slider" max-height="150" + <ModSlider caption="Rate" parameter="rate" class="Slider" max-height="150" default-height="120" name="Flutter Rate" tooltip="Sets the rate of the tape flutter." margin="0" padding="0"/> <Plot source="flutter" plot-decay="0.8" background-color="FF1E1F22" flex-grow="0.8" plot-color="FFEAA92C" plot-fill-color="CC8B3232"/> - <PowerButton margin="0" padding="0" background-color="00000000" max-height="25" + <PowerButton margin="0" padding="0" background-color="00000000" max-height="30" flex-grow="0.1" min-height="20" button-color="ff595c6b" button-on-color="FFEAA92C" parameter="flutter_onoff" name="Wow/Flutter On/Off" tooltip="Turns the wow and flutter processing on or off."/> </View> <View tab-caption="Wow" flex-direction="column" background-color="FF31323A" padding="0" margin="3" group="Wow Controls Tab"> - <WowMenu margin="0" padding="0" background-color="00000000" max-height="30" + <WowMenu margin="0" padding="0" background-color="00000000" min-height="15" max-height="55" flex-grow="0.35" name="Wow Sync" tooltip="Snaps the wow rate to a synchronized value."/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> - <ModSlider caption="Depth" parameter="wow_depth" max-height="150" class="Slider" + <ModSlider caption="Depth" parameter="wow_depth" max-height="150" class="Slider" slidertext-height="15" name="Wow Depth" tooltip="Sets the depth of the tape wow." margin="0" - padding="0" slider-type="linear-horizontal"/> - <ModSlider caption="Rate" parameter="wow_rate" class="Slider" max-height="150" + padding="0" slider-type="linear-horizontal" default-height="60"/> + <ModSlider caption="Rate" parameter="wow_rate" class="Slider" max-height="150" slidertext-height="15" name="Wow Rate" tooltip="Sets the rate of the tape wow." margin="0" - padding="0" slider-type="linear-horizontal"/> - <ModSlider caption="Variance" parameter="wow_var" class="Slider" max-height="150" + padding="0" slider-type="linear-horizontal" default-height="60"/> + <ModSlider caption="Variance" parameter="wow_var" class="Slider" max-height="150" slidertext-height="15" name="Wow Variance" tooltip="Sets the amount of variance in the tape wow." - margin="0" padding="0" slider-type="linear-horizontal"/> - <ModSlider caption="Drift" parameter="wow_drift" class="Slider" max-height="150" + margin="0" padding="0" slider-type="linear-horizontal" default-height="60"/> + <ModSlider caption="Drift" parameter="wow_drift" class="Slider" max-height="150" slidertext-height="15" name="Wow Drift" tooltip="Sets the amount of drift in the tape wow." - margin="0" padding="0" slider-type="linear-horizontal"/> + margin="0" padding="0" slider-type="linear-horizontal" default-height="60"/> <Plot source="wow" plot-decay="0.8" flex-grow="1.45" background-color="FF1E1F22" plot-color="FFEAA92C" plot-fill-color="CC8B3232"/> - <PowerButton margin="0" padding="0" background-color="00000000" max-height="25" + <PowerButton margin="0" padding="0" background-color="00000000" max-height="30" flex-grow="0.1" min-height="20" button-color="ff595c6b" button-on-color="FFEAA92C" parameter="flutter_onoff" name="Wow/Flutter On/Off" tooltip="Turns the wow and flutter processing on or off."/> </View> @@ -267,8 +267,8 @@ </View> <TooltipComp flex-grow="0.13" background-color="00000000" tooltip-name="FFEAA92C" tooltip-text="FFFFFFFF"/> - <View max-height="35" margin="0" padding="0" background-color="FF31323A" - flex-grow="0.1" group="Extra Controls Bar"> + <View min-height="20" max-height="80" margin="0" padding="0" background-color="FF31323A" + flex-grow="0.04" group="Extra Controls Bar"> <View background-color="00000000" flex-grow="0.05"/> <OversamplingMenu caption="Oversampling" class="Slider" flex-grow="1.2" caption-size="0" padding="0" combo-text="FFEAA92C" menu-accent="FFEAA92C" combo-background="00000000" diff --git a/Plugin/Source/GUI/Assets/gui_ios.xml b/Plugin/Source/GUI/Assets/gui_ios.xml @@ -33,7 +33,7 @@ <View max-height="40" min-height="20" margin="0" padding="0" background-color="FF31323A" flex-grow="0.1"> <View background-color="00000000" flex-grow="0.1"/> - <OversamplingMenu caption="Oversampling" class="Slider" + <OversamplingMenu caption="Oversampling" class="Slider" margin="0" border="0" caption-size="0" padding="0" combo-text="FFEAA92C" combo-background="00000000" menu-accent="FFEAA92C" max-height="100" lookAndFeel="ComboBoxLNF" name="Oversampling" tooltip="Sets the amount of oversampling used for the hysteresis processing. More oversampling will reduce aliasing artifacts, but requires more CPU resources."/> @@ -59,8 +59,7 @@ <TitleComp background-color="00000000" title="Chow Tape Model" font="35" padding="1" flex-grow="1.0"/> <InfoComp background-color="00000000" text1="FFEAA92C" flex-grow="0.8" - padding="0" margin="5" border=""/> - <View background-color="00000000" flex-grow="0.15"/> + padding="0" margin="0" border=""/> </View> <View margin="0" padding="" background-color="00000000" flex-direction="row" flex-grow="0.41"> @@ -187,27 +186,27 @@ <ModSlider caption="Gap [microns]" parameter="gap" slider-type="linear-horizontal" class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Gap" tooltip="Sets the width of the playhead gap. Certain frequencies that resonate with the gap width will be emphasized." - slidertext-height="18" caption-placement="top-left" max-height="75"/> + caption-placement="top-left" max-height="75" slidertext-height="14"/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <ModSlider caption="Thickness [microns]" parameter="thick" class="Slider" slider-type="linear-horizontal" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Thickness" tooltip="Sets the thickness of the tape. Thicker tape has a more muted high-frequency response." - caption-placement="top-left" max-height="75"/> + caption-placement="top-left" max-height="75" slidertext-height="14"/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <ModSlider caption="Spacing [microns]" parameter="spacing" slider-type="linear-horizontal" class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Spacing" tooltip="Sets the spacing between the tape and the playhead. A larger spacing means more high frequency signal is lost during playback." - caption-placement="top-left" max-height="75"/> + caption-placement="top-left" max-height="75" slidertext-height="14"/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <ModSlider caption="Azimuth [degrees]" parameter="azimuth" slider-type="linear-horizontal" class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Azimuth" tooltip="Sets the azimuth angle between the playhead and the tape. This can create a stereo widening effect at higher tape speeds. (Stereo only)" - caption-placement="top-left" max-height="75" enabled="plugin:is_stereo"/> + caption-placement="top-left" max-height="75" slidertext-height="14" enabled="plugin:is_stereo"/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <ModSlider caption="Speed [ips]" parameter="speed" slider-type="linear-horizontal" class="Slider" padding="0" slider-background="ff595c6b" slider-track="ff9cbcbd" name="Speed" tooltip="Sets the speed of the tape as it affects the playhead loss effects. Note that this control does not affect the wow/flutter processing." - caption-placement="top-left" max-height="75"/> + caption-placement="top-left" max-height="75" slidertext-height="14"/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <View flex-grow="0.53" margin="0" padding="2" background-color="00000000" max-height="50" min-height="10"> <TextButton margin="0" padding="2" text="3.75" button-color="00000000" background-color="00000000" @@ -237,25 +236,24 @@ tooltip="Sets the depth of the tape degradation." slider-type="linear-horizontal" max-height="70" margin="0" min-height="0" slidertext-width="80" flex-grow="2.5" flex-shrink="2.5" padding=""/> - <TextButton flex-align-self="auto" parameter="deg_point1x" max-height="160" background-color="FF31323A" - button-on-color="FFB41717" button-color="FF33343D" text="0.1x" text_on="0.1x" - button-off-text="FFFFFFFF" button-on-text="FFFFFFFF" height="" - width="" min-height="0.0" padding="0" caption-placement="centred" - min-width="" margin="5" caption="" flex-grow="1.0" flex-shrink="0.1" - name="0.1x" lookAndFeel="LookAndFeel_V3" tooltip="Scales the Depth value by 0.1 to allow for more subtle degradation"/> + <TextButton parameter="deg_point1x" text="0.1x" text_on="0.1x" background-color="00000000" + margin="0" padding="5" button-color="FF33343D" flex-grow="0.35" + button-on-color="FFB41717" lookAndFeel="LookAndFeel_V3" name="0.1x" + tooltip="Scales the Depth value by 0.1 to allow for more subtle degradation." + button-off-text="FFFFFFFF" button-on-text="FFFFFFFF"/> </View> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <ModSlider caption="Amount" parameter="deg_amt" class="Slider" name="Amount" margin="0" tooltip="Sets the amount of the tape that is degraded. At large values all of the tape will be affected, at small values only some sections will be affected." - slider-type="linear-horizontal" max-height="70"/> + slider-type="linear-horizontal"/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <ModSlider parameter="deg_var" caption="Variance" class="Slider" name="Variance" margin="0" tooltip="Sets the variance of the tape degradation. Use lower values for uniform degradation, or higher values for variation across different sections of tape." - slider-type="linear-horizontal" max-height="70"/> + slider-type="linear-horizontal"/> <View margin="0" padding="0" flex-grow="0.1" background-color="00000000"/> <ModSlider parameter="deg_env" caption="Envelope" class="Slider" name="Envelope" margin="0" tooltip="Sets the amount of amplitude envelope applied to the tape degradation. At 0, the degradation will have no envelope." - slider-type="linear-horizontal" max-height="70"/> + slider-type="linear-horizontal"/> <View margin="0" padding="0" flex-grow="0.15" background-color="00000000"/> </View> <View tab-caption="CHEW" padding="0" flex-direction="column" background-color="FF31323A" diff --git a/Plugin/Source/GUI/ModulatableSlider.cpp b/Plugin/Source/GUI/ModulatableSlider.cpp @@ -86,6 +86,7 @@ void ModSliderItem::update() slider.setPluginEditorCallback ([this] { return magicBuilder.getMagicState().getProcessor()->getActiveEditor(); }); slider.setTitle (magicBuilder.getStyleProperty (foleys::IDs::name, configNode)); + defaultHeight = magicBuilder.getStyleProperty (foleys::IDs::defaultHeight, configNode); auto type = getProperty (pSliderType).toString(); slider.setAutoOrientation (type.isEmpty() || type == pSliderTypes[0]); @@ -102,18 +103,17 @@ void ModSliderItem::update() slider.setSliderStyle (juce::Slider::IncDecButtons); auto textbox = getProperty (pSliderTextBox).toString(); - int textBoxWidth = getProperty (pSliderTextBoxWidth); - int textBoxHeight = getProperty (pSliderTextBoxHeight); + sliderTextBoxHeight = getProperty (pSliderTextBoxHeight); if (textbox == pTextBoxPositions[0]) - slider.setTextBoxStyle (juce::Slider::NoTextBox, false, textBoxWidth, textBoxHeight); + textBoxPosition = juce::Slider::NoTextBox; else if (textbox == pTextBoxPositions[1]) - slider.setTextBoxStyle (juce::Slider::TextBoxAbove, false, textBoxWidth, textBoxHeight); + textBoxPosition = juce::Slider::TextBoxAbove; else if (textbox == pTextBoxPositions[3]) - slider.setTextBoxStyle (juce::Slider::TextBoxLeft, false, textBoxWidth, textBoxHeight); + textBoxPosition = juce::Slider::TextBoxLeft; else if (textbox == pTextBoxPositions[4]) - slider.setTextBoxStyle (juce::Slider::TextBoxRight, false, textBoxWidth, textBoxHeight); + textBoxPosition = juce::Slider::TextBoxRight; else - slider.setTextBoxStyle (juce::Slider::TextBoxBelow, false, textBoxWidth, textBoxHeight); + textBoxPosition = juce::Slider::TextBoxBelow; double minValue = getProperty (pMinValue); double maxValue = getProperty (pMaxValue); @@ -129,6 +129,22 @@ void ModSliderItem::update() slider.attachToParameter (getMagicState().getParameter (paramID)); else slider.attachToParameter (nullptr); + + resized(); +} + +void ModSliderItem::resized() +{ + const auto sliderTextHeightToUse = [this] { + if (defaultHeight == 0) + return sliderTextBoxHeight; + + return proportionOfHeight ((float) sliderTextBoxHeight / (float) defaultHeight); + }(); + + slider.setTextBoxStyle (textBoxPosition, false, proportionOfWidth (0.75f), sliderTextHeightToUse); + + foleys::GuiItem::resized(); } std::vector<foleys::SettableProperty> ModSliderItem::getSettableProperties() const @@ -141,6 +157,8 @@ std::vector<foleys::SettableProperty> ModSliderItem::getSettableProperties() con props.push_back ({ configNode, pValue, foleys::SettableProperty::Choice, 1.0f, magicBuilder.createPropertiesMenuLambda() }); props.push_back ({ configNode, pMinValue, foleys::SettableProperty::Number, 0.0f, {} }); props.push_back ({ configNode, pMaxValue, foleys::SettableProperty::Number, 2.0f, {} }); + props.push_back ({ configNode, pSliderTextBoxWidth, foleys::SettableProperty::Number, 85.0f, {} }); + props.push_back ({ configNode, pSliderTextBoxHeight, foleys::SettableProperty::Number, 17.0f, {} }); return props; } diff --git a/Plugin/Source/GUI/ModulatableSlider.h b/Plugin/Source/GUI/ModulatableSlider.h @@ -48,6 +48,7 @@ public: ModSliderItem (foleys::MagicGUIBuilder& builder, const juce::ValueTree& node); void update() override; + void resized() override; std::vector<foleys::SettableProperty> getSettableProperties() const override; juce::String getControlledParameterID (juce::Point<int>) override; @@ -58,5 +59,9 @@ public: private: ModulatableSlider slider; + int defaultHeight = 0; + int sliderTextBoxHeight = 0; + juce::Slider::TextEntryBoxPosition textBoxPosition; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ModSliderItem) }; diff --git a/Plugin/Source/GUI/MyLNF.cpp b/Plugin/Source/GUI/MyLNF.cpp @@ -222,7 +222,7 @@ Button* MyLNF::createTabBarExtrasButton() void MyLNF::drawLinearSlider (Graphics& g, int x, int y, int width, int height, float sliderPos, float /*minSliderPos*/, float /*maxSliderPos*/, const Slider::SliderStyle, Slider& slider) { - auto trackWidth = jmin (6.0f, slider.isHorizontal() ? (float) height * 0.25f : (float) width * 0.25f); + auto trackWidth = jmin (10.0f, slider.isHorizontal() ? (float) height * 0.25f : (float) width * 0.25f); Point<float> startPoint (slider.isHorizontal() ? (float) x : (float) x + (float) width * 0.5f, slider.isHorizontal() ? (float) y + (float) height * 0.5f : (float) (height + y)); @@ -259,15 +259,14 @@ void MyLNF::drawLinearSlider (Graphics& g, int x, int y, int width, int height, } } - auto thumbWidth = getSliderThumbRadius (slider); + auto thumbWidth = juce::jmax (trackWidth * 2.5f, (float) getSliderThumbRadius (slider)); valueTrack.startNewSubPath (minPoint); valueTrack.lineTo (modPoint); g.setColour (slider.findColour (Slider::trackColourId).withAlpha (alpha)); g.strokePath (valueTrack, { trackWidth, PathStrokeType::curved, PathStrokeType::rounded }); - auto thumbRect = Rectangle<float> (static_cast<float> (thumbWidth), - static_cast<float> (thumbWidth)) + auto thumbRect = Rectangle<float> (thumbWidth, thumbWidth) .withCentre (maxPoint); knob->drawWithin (g, thumbRect, RectanglePlacement::stretchToFit, alpha); } @@ -368,6 +367,11 @@ PopupMenu::Options MyLNF::getOptionsForComboBoxPopupMenu (ComboBox& comboBox, La } //============================================================== +Font ComboBoxLNF::getComboBoxFont (ComboBox& box) +{ + return { juce::jmin (28.0f, (float) box.proportionOfHeight (0.48f)) }; +} + void ComboBoxLNF::drawComboBox (Graphics& g, int width, int height, bool, int, int, int, int, ComboBox& box) { auto cornerSize = 5.0f; diff --git a/Plugin/Source/GUI/MyLNF.h b/Plugin/Source/GUI/MyLNF.h @@ -61,6 +61,8 @@ public: ignoreUnused (width, height); } + Font getComboBoxFont (ComboBox& box) override; + private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComboBoxLNF) }; @@ -79,6 +81,11 @@ public: g.fillRoundedRectangle (boxBounds.toFloat(), cornerSize); } + Font getComboBoxFont (ComboBox& box) override + { + return { juce::jmin (28.0f, (float) box.proportionOfHeight (0.55f)) }; + } + void positionComboBoxText (ComboBox& box, Label& label) override { label.setBounds (3, 1, box.getWidth(), box.getHeight() - 2);