Gin
Loading...
Searching...
No Matches
Knob Class Reference

Complete parameter control combining rotary slider, value readout, and modulation. More...

#include <gin_knob.h>

Inheritance diagram for Knob:

Public Member Functions

 Knob (Parameter *parameter, bool fromCentre=false)
 ~Knob () override
void setDisplayName (const juce::String &)
void setLiveValuesCallback (std::function< juce::Array< float >()> cb)
PluginSlider & getSlider ()
Readout & getReadout ()
void paint (juce::Graphics &g) override
void resized () override
void parentHierarchyChanged () override
void mouseEnter (const juce::MouseEvent &e) override
void mouseDown (const juce::MouseEvent &e) override
void mouseDrag (const juce::MouseEvent &e) override
bool isInterestedInDragSource (const SourceDetails &dragSourceDetails) override
void itemDragEnter (const SourceDetails &dragSourceDetails) override
void itemDragExit (const SourceDetails &dragSourceDetails) override
void itemDropped (const SourceDetails &dragSourceDetails) override
bool allowClicksOn (const juce::Component &c) override
Public Member Functions inherited from ParamComponent
 ParamComponent (Parameter *parameter)
 ~ParamComponent () override
juce::String getUid ()
void setTooltip (const juce::String &newTooltip) override

Protected Member Functions

void timerCallback () override
void learnSourceChanged (ModSrcId) override
void modMatrixChanged () override
void showModMenu ()

Protected Attributes

juce::Label name
Readout value
PluginSlider knob
bool learning = false
float modDepth = 0.0f
bool dragOver = false
gin::CoalescedTimer modTimer
gin::CoalescedTimer shiftTimer
juce::Array< float > modValues
std::function< juce::Array< float >()> liveValuesCallback
gin::ModulationDepthSlider modDepthSlider
Protected Attributes inherited from ParamComponent
Parameter * parameter = nullptr

Additional Inherited Members

Public Types inherited from ParamComponent
using Ptr = ParamComponent*

Detailed Description

Complete parameter control combining rotary slider, value readout, and modulation.

Knob provides a full-featured parameter UI component that combines a rotary slider (PluginSlider), a text value display (Readout), and visual modulation feedback. It supports drag-and-drop modulation assignment, modulation depth adjustment, and real-time display of modulation values.

Key Features:

  • Rotary slider control with mouse interaction
  • Editable text value readout
  • Visual modulation depth indicator
  • Drag-and-drop modulation source assignment
  • Live modulation value display
  • Modulation learning mode
  • Optional bipolar (from-centre) display
  • Customizable display name
  • Integration with ModMatrix

Interaction:

  • Drag slider to adjust parameter value
  • Click readout to type exact value
  • Drag-and-drop mod source to assign modulation
  • Right-click for modulation menu
  • Shift-drag to adjust modulation depth

The knob automatically connects to the ModMatrix to display active modulations and allows users to assign, adjust, and remove modulation sources visually.

Usage:

auto* cutoffParam = processor.getParameter("cutoff");
auto* knob = new Knob(cutoffParam);
knob->setDisplayName("Cutoff");
// Enable live modulation display
knob->setLiveValuesCallback([this]() {
return getCurrentModulationValues();
});
Knob(Parameter *parameter, bool fromCentre=false)
PluginSlider knob
Definition gin_knob.h:98
void addAndMakeVisible(juce::Component &parent, juce::Array< juce::Component * > children)
Adds an Array of components to a parent Component.
Definition gin_componentutils.h:16
See also
Parameter, ModMatrix, PluginSlider, Readout

Constructor & Destructor Documentation

◆ Knob()

Knob::Knob ( Parameter * parameter,
bool fromCentre = false )

◆ ~Knob()

Knob::~Knob ( )
override

Member Function Documentation

◆ setDisplayName()

void Knob::setDisplayName ( const juce::String & )

◆ setLiveValuesCallback()

void Knob::setLiveValuesCallback ( std::function< juce::Array< float >()> cb)

◆ getSlider()

PluginSlider & Knob::getSlider ( )

References knob.

◆ getReadout()

Readout & Knob::getReadout ( )

References value.

◆ paint()

void Knob::paint ( juce::Graphics & g)
override

◆ resized()

void Knob::resized ( )
override

◆ parentHierarchyChanged()

void Knob::parentHierarchyChanged ( )
override

◆ mouseEnter()

void Knob::mouseEnter ( const juce::MouseEvent & e)
override

◆ mouseDown()

void Knob::mouseDown ( const juce::MouseEvent & e)
override

◆ mouseDrag()

void Knob::mouseDrag ( const juce::MouseEvent & e)
override

◆ isInterestedInDragSource()

bool Knob::isInterestedInDragSource ( const SourceDetails & dragSourceDetails)
override

◆ itemDragEnter()

void Knob::itemDragEnter ( const SourceDetails & dragSourceDetails)
override

◆ itemDragExit()

void Knob::itemDragExit ( const SourceDetails & dragSourceDetails)
override

◆ itemDropped()

void Knob::itemDropped ( const SourceDetails & dragSourceDetails)
override

◆ allowClicksOn()

bool Knob::allowClicksOn ( const juce::Component & c)
overridevirtual

Reimplemented from ParamComponent.

References modDepthSlider.

◆ timerCallback()

void Knob::timerCallback ( )
overrideprotected

◆ learnSourceChanged()

void Knob::learnSourceChanged ( ModSrcId )
overrideprotectedvirtual

Reimplemented from IModMatrix::Listener.

◆ modMatrixChanged()

void Knob::modMatrixChanged ( )
overrideprotectedvirtual

Reimplemented from IModMatrix::Listener.

Referenced by setLiveValuesCallback().

◆ showModMenu()

void Knob::showModMenu ( )
protected

Member Data Documentation

◆ name

juce::Label Knob::name
protected

◆ value

Readout Knob::value
protected

Referenced by getReadout().

◆ knob

PluginSlider Knob::knob
protected

Referenced by getSlider().

◆ learning

bool Knob::learning = false
protected

◆ modDepth

float Knob::modDepth = 0.0f
protected

◆ dragOver

bool Knob::dragOver = false
protected

◆ modTimer

gin::CoalescedTimer Knob::modTimer
protected

◆ shiftTimer

gin::CoalescedTimer Knob::shiftTimer
protected

◆ modValues

juce::Array<float> Knob::modValues
protected

◆ liveValuesCallback

std::function<juce::Array<float>()> Knob::liveValuesCallback
protected

Referenced by setLiveValuesCallback().

◆ modDepthSlider

gin::ModulationDepthSlider Knob::modDepthSlider
protected

Referenced by allowClicksOn().


The documentation for this class was generated from the following file: