diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dcfd84..8060759 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ if(ARSON_BUILD_PLUGIN) juce_add_binary_data(ArSonCompKnobAssets SOURCES assets/black_brushed_knob.jpg assets/gunmetal_slider_track.png - assets/gunmetal_slider_thumb_red.png + assets/dark_brushed_slider_thumb.png assets/toggle/arson_toggle_on.png assets/toggle/arson_toggle_off.png assets/arsoncomp_header_logo.png) diff --git a/assets/dark_brushed_slider_thumb.png b/assets/dark_brushed_slider_thumb.png new file mode 100644 index 0000000..c537b71 Binary files /dev/null and b/assets/dark_brushed_slider_thumb.png differ diff --git a/docs/M61-GUI-POLISH.md b/docs/M61-GUI-POLISH.md new file mode 100644 index 0000000..d5238a9 --- /dev/null +++ b/docs/M61-GUI-POLISH.md @@ -0,0 +1,25 @@ +# M6.1 — Dark Brushed Thumb and Uncropped Rotary Knobs + +## Scope +This is a GUI-only refinement of the M6 baseline (commit 8878167). +No compressor DSP, parameter, automation, ASIO, preset, or audio scheduling changes. + +## Changes +- New bundled, transparent 58×124 PNG thumb, an original dark graphite/black + brushed-metal cap matching the tone and soft metal bevel of the rotary knob. + A small coral center pin stays tactile without an oversized silver ridge. +- Remove the prior bright-silver thumb-back and overpainted ridge. Draw the + image once with its source aspect ratio using the existing FaderGeometry. +- Fix a measurable clipping condition: the complete rotary arc extended + beyond a 58px slider rectangle because the halo offset and stroke width + were not included when fitting its diameter. Expand the primary component + height to 66px within the existing compact panel, then enforce clearance + with a shared KnobGeometry contract used by renderer and test suite. +- Preserve 612×500 default and 580×480 minimum; retain full / MINI / + SIDECHAIN support. All assets decode once on the JUCE message thread. + +## Acceptance +Actual Windows Standalone/VST3 smoke screenshots in Full, minimum, MINI and +SIDECHAIN; check the dark cap at slider extremes and the full coral arcs above +all seven rotaries. Linux DSP engine tests unchanged. A passing CI is not proof +of stable hardware audio; PS22 crackle investigation remains separate. diff --git a/plugin/Editor.cpp b/plugin/Editor.cpp index 865d8ef..8795f9b 100644 --- a/plugin/Editor.cpp +++ b/plugin/Editor.cpp @@ -6,6 +6,7 @@ #include "GraphHistory.h" #include "HeaderLayout.h" #include "FaderGeometry.h" +#include "KnobGeometry.h" #include "BinaryData.h" #include #include @@ -57,9 +58,19 @@ CompLook::CompLook() { BinaryData::gunmetal_slider_track_png, static_cast(BinaryData::gunmetal_slider_track_pngSize)); sliderThumb=juce::ImageFileFormat::loadFrom( - BinaryData::gunmetal_slider_thumb_red_png, - static_cast(BinaryData::gunmetal_slider_thumb_red_pngSize)); + BinaryData::dark_brushed_slider_thumb_png, + static_cast(BinaryData::dark_brushed_slider_thumb_pngSize)); jassert(sliderTrack.isValid() && sliderThumb.isValid()); + // The actual fader is 34px high: filter the tiny cap ONCE on the + // message thread, not as a moving photographic resample on every drag. + if(sliderThumb.isValid()) { + constexpr int targetH=arson::ui::EditorMetrics::faderHeight-4; + constexpr float aspect=arson::ui::FaderGeometry::thumbSourceW / + arson::ui::FaderGeometry::thumbSourceH; + sliderThumbCompact=sliderThumb.rescaled( + juce::roundToInt(targetH*aspect),targetH, + juce::Graphics::highResamplingQuality); + } setColour(juce::Slider::textBoxTextColourId,text); setColour(juce::Slider::textBoxBackgroundColourId,juce::Colour{0xff111417}); setColour(juce::Slider::textBoxOutlineColourId,juce::Colour{0xff31383e}); @@ -166,17 +177,14 @@ const juce::Image& CompLook::knobFace(int diameter,bool primary) { void CompLook::drawRotarySlider(juce::Graphics& g,int x,int y,int w,int h, float pos,float start,float end,juce::Slider& slider) { const bool primary=slider.getName()=="Threshold"; - const float r=std::max(13.0f,std::min( - static_cast(w)*(primary?0.400f:0.385f), - static_cast(h)*(primary?0.400f:0.385f))); - const int pixels=juce::jmax(28,static_cast(std::ceil(r*2.0f+7.0f))); + const int pixels=arson::ui::KnobGeometry::facePixels(w,h,primary); const float cx=x+w*0.5f,cy=y+h*0.50f; const float angle=start+clamp01(pos)*(end-start); const float bodyRadius=pixels*0.5f; // Draw the level RING FIRST. Its radius is larger than the black metal // photograph, so the dial occludes the inner arc naturally, as a physical // knob would. Nothing gets painted on top of the metal except the dot. - const float trackRadius=bodyRadius+2.2f; + const float trackRadius=bodyRadius+arson::ui::KnobGeometry::arcOutsideFace; juce::Path inactive,active; inactive.addCentredArc(cx,cy,trackRadius,trackRadius,0.0f,start,end,true); active.addCentredArc(cx,cy,trackRadius,trackRadius,0.0f,start,angle,true); @@ -255,31 +263,31 @@ void CompLook::drawLinearSlider(juce::Graphics& g,int x,int y,int w,int h, g.setColour(juce::Colour{0xffffb0b6}.withAlpha(0.46f)); g.fillRect(left,cy-0.55f,position-left,1.1f); } - // A proportional photographic thumb is too dark against the new chassis - // at 580-612px. Give it a bright metal silhouette and a tactile centre - // marker UNDER/OVER the original asset (never stretch or replace it). - // This makes the current value visible even when the LED fill is zero. - const auto thumbBack=thumb.expanded(1.2f,0.4f); - g.setColour(juce::Colour{0xffabb6bb}); - g.fillRoundedRectangle(thumbBack,2.5f); - g.setColour(juce::Colour{0xff11181c}); - g.fillRoundedRectangle(thumbBack.reduced(1.1f),2.0f); - if(sliderThumb.isValid()) { + // Tactile graphite cap: dark metal undercut + actual brushed-metal PNG. + // This is not the old painted-on bright silver ridge. Keep the silhouette + // readable at the real 14x30px GUI size, even on a dark empty rail. + // Graphite gradient is the material undercoat, not a silver overpaint. + // It keeps the small hardware cap distinguishable from its dark housing + // even after image filtering, while the PNG supplies brush and grip. + juce::ColourGradient brushed(juce::Colour{0xff768187},thumb.getX(),cy, + juce::Colour{0xff626c72},thumb.getRight(),cy,false); + brushed.addColour(0.16,juce::Colour{0xff737e84}); + brushed.addColour(0.32,juce::Colour{0xff343b40}); + brushed.addColour(0.52,juce::Colour{0xff1c2226}); + brushed.addColour(0.76,juce::Colour{0xff3a4248}); + g.setGradientFill(brushed); + g.fillRoundedRectangle(thumb,3.0f); + if(sliderThumbCompact.isValid() && + std::abs(thumb.getWidth()-sliderThumbCompact.getWidth())<0.65f && + std::abs(thumb.getHeight()-sliderThumbCompact.getHeight())<0.65f) { + // Pre-filter once; draw at integer device pixels without extra + // downsampling that previously erased the small metal edge. + g.drawImageAt(sliderThumbCompact,juce::roundToInt(thumb.getX()), + juce::roundToInt(thumb.getY())); + } else if(sliderThumb.isValid()) { g.setImageResamplingQuality(juce::Graphics::highResamplingQuality); g.drawImage(sliderThumb,thumb); - } else { - g.setColour(juce::Colour{0xff929fa5}); - g.fillRoundedRectangle(thumb,2.5f); } - // Draw a narrow light-catching ridge over the image. The centre marker - // must move with thumb at both extremes and at all supported widths. - const float ridgeX=thumb.getCentreX(); - g.setColour(juce::Colour{0xffc8d0d2}.withAlpha(0.9f)); - g.drawVerticalLine(juce::roundToInt(ridgeX),thumb.getY()+3.0f, - thumb.getBottom()-3.0f); - g.setColour(juce::Colour{0xff5f6a70}.withAlpha(0.8f)); - g.drawVerticalLine(juce::roundToInt(ridgeX+2.0f), - thumb.getY()+4.0f,thumb.getBottom()-4.0f); } void CompLook::drawToggleButton(juce::Graphics& g,juce::ToggleButton& button, bool highlighted,bool down) { diff --git a/plugin/Editor.h b/plugin/Editor.h index 970764c..a733f53 100644 --- a/plugin/Editor.h +++ b/plugin/Editor.h @@ -22,7 +22,7 @@ class CompLook final : public juce::LookAndFeel_V4 { std::array faces; // normal + oversized Threshold only juce::Image sourceFace; // decoded once on GUI initialization juce::Image toggleOn, toggleOff; // matched, predecoded state sprites - juce::Image sliderTrack, sliderThumb; // layered photographic gunmetal assets, decoded once + juce::Image sliderTrack, sliderThumb, sliderThumbCompact; // native-resolution prefiltered fader cap const juce::Image& knobFace(int diameter,bool primary); }; class Editor final : public juce::AudioProcessorEditor, private juce::Timer { diff --git a/plugin/HeaderLayout.h b/plugin/HeaderLayout.h index 068990b..722d6f6 100644 --- a/plugin/HeaderLayout.h +++ b/plugin/HeaderLayout.h @@ -20,7 +20,7 @@ struct EditorMetrics { static constexpr float headerCaptionFont=9.5f; static constexpr float buttonFont=11.0f; static constexpr float controlCaptionFont=10.4f; - static constexpr int knobCaptionOffset=2, knobTopOffset=26, knobHeight=58; + static constexpr int knobCaptionOffset=2, knobTopOffset=26, knobHeight=66; static constexpr int faderCaptionOffset=25, faderTopOffset=44, faderHeight=34; static constexpr juce::uint32 captionRgb=0xffd9e0e3; static constexpr juce::uint32 controlCaptionRgb=0xffe4e9ec; diff --git a/plugin/KnobGeometry.h b/plugin/KnobGeometry.h new file mode 100644 index 0000000..34f5fca --- /dev/null +++ b/plugin/KnobGeometry.h @@ -0,0 +1,30 @@ +#pragma once +#include +#include +#include + +namespace arson::ui { +// Canonical visual bounds for the satin metal rotary face AND its red arc. +// Never permit an arc stroke to be cropped by a JUCE Slider component. +struct KnobGeometry final { + static constexpr float arcOutsideFace=2.2f; + static constexpr float widestArcStroke=5.2f; + static constexpr float safeInset=1.25f; + static int facePixels(int width,int height,bool threshold) noexcept { + const float fraction=threshold?0.400f:0.385f; + const float suggestedRadius=std::max(13.0f, + std::min(static_cast(width)*fraction, + static_cast(height)*fraction)); + const int desired=juce::jmax(28, + static_cast(std::ceil(suggestedRadius*2.0f+7.0f))); + const int available=static_cast(std::floor( + static_cast(std::min(width,height))- + 2.0f*(arcOutsideFace+widestArcStroke*0.5f+safeInset))); + return std::min(desired,std::max(24,available)); + } + static float outerPaintRadius(int faceDiameter) noexcept { + return static_cast(faceDiameter)*0.5f+ + arcOutsideFace+widestArcStroke*0.5f; + } +}; +} // namespace arson::ui diff --git a/tests/PluginSmoke.cpp b/tests/PluginSmoke.cpp index e5c3598..6f9bc2d 100644 --- a/tests/PluginSmoke.cpp +++ b/tests/PluginSmoke.cpp @@ -2,6 +2,7 @@ #include "../plugin/Editor.h" #include "../plugin/HeaderLayout.h" #include "../plugin/FaderGeometry.h" +#include "../plugin/KnobGeometry.h" #include "../plugin/PresetIO.h" #include "../plugin/FactoryPresetBank.h" #include "../plugin/GraphPaint.h" @@ -209,15 +210,15 @@ static int runSmoke(int argc,char** argv) { std::abs(audio.getSample(0,31)-0.123f)>1.0e-6f)return failHost(46); } // Hardware fader layer contract: independent transparent photo plate - // (stationary), photo thumb (red aperture) and moving red LED level. + // (stationary), dark brushed graphite thumb and moving red LED level. // Confirm real JUCE BinaryData resources, not external installation paths. { const auto plate=juce::ImageFileFormat::loadFrom( BinaryData::gunmetal_slider_track_png, static_cast(BinaryData::gunmetal_slider_track_pngSize)); const auto thumb=juce::ImageFileFormat::loadFrom( - BinaryData::gunmetal_slider_thumb_red_png, - static_cast(BinaryData::gunmetal_slider_thumb_red_pngSize)); + BinaryData::dark_brushed_slider_thumb_png, + static_cast(BinaryData::dark_brushed_slider_thumb_pngSize)); if(!plate.isValid() || plate.getWidth()!=340 || plate.getHeight()!=57 || !thumb.isValid() || thumb.getWidth()!=58 || thumb.getHeight()!=124 || plate.getPixelAt(0,0).getFloatAlpha()>0.04f || @@ -232,6 +233,59 @@ static int runSmoke(int argc,char** argv) { return 47; } + // Original dark graphite asset must not regress to a bright silver + // placeholder, and its real PNG corner alpha must remain transparent. + const auto graphite=thumb.getPixelAt(22,40); + if(graphite.getRed()>=85 || graphite.getGreen()>=90 || + graphite.getBlue()>=95 || graphite.getFloatAlpha()<0.80f) + return 82; + // The v1 dark thumb was technically valid but almost invisible at + // the 14px actual fader width. Require a polished edge inside the + // PNG itself, not a second silver overlay painted by the renderer. + const auto bevel=thumb.getPixelAt(15,40); + if(bevel.getBrightness()<0.30f || + bevel.getBrightness()-graphite.getBrightness()<0.14f || + bevel.getFloatAlpha()<0.90f) return 86; + // Exercise the actual JUCE LookAndFeel fader render, not only the + // asset's existence. A nearly invisible cap passed earlier tests. + // The real 34px-tall strip must expose a visible metal edge. + { + CompLook look; + juce::Image paintTest(juce::Image::ARGB,100,34,true); + // End the Graphics lifetime before inspecting pixels. JUCE image + // backends may defer drawing while the graphics context is live; + // reading at that point returned transparent black on Windows. + { + juce::Graphics faderGraphics(paintTest); + faderGraphics.fillAll(juce::Colour{0xff262c31}); + juce::Slider dummy; + look.drawLinearSlider(faderGraphics,0,0,100,34,55.0f,0.0f,100.0f, + juce::Slider::LinearHorizontal,dummy); + } + const auto geom=arson::ui::FaderGeometry::calculate(100.0f,34.0f,55.0f); + const int sampleX=juce::roundToInt(geom.position)-4; + const auto polishedEdge=paintTest.getPixelAt(sampleX,12); + const auto chassis=paintTest.getPixelAt(sampleX-17,12); + const float capBrightness=polishedEdge.getBrightness(); + const float chassisBrightness=chassis.getBrightness(); + if(capBrightness<0.24f || capBrightness-chassisBrightness<0.04f) { + std::cerr<<"FADER_CAP_CONTRAST_87 cap="<findChildWithID("param."+juce::String(id)); + if(!dial)return 84; + const int diameter=arson::ui::KnobGeometry::facePixels( + dial->getWidth(),dial->getHeight(), + juce::String(id)=="threshold"); + if(arson::ui::KnobGeometry::outerPaintRadius(diameter) + +arson::ui::KnobGeometry::safeInset > + 0.5f*std::min(dial->getWidth(),dial->getHeight())+0.01f) + return 85; + } // New compact primary knob row: height budget for larger black LCD // without collapsing control interaction areas at minimum size. if(threshold->getHeight()!=arson::ui::EditorMetrics::knobHeight ||