CVWidgetKnob:
Filter:
Classes (extension) | GUI | Conductor | External Control > MIDI | External Control > OSC

CVWidgetKnob : CVWidget : Object
ExtensionExtension

a control-widget that can either be embedded in other views or opened as a standalone-widget, offering easy connections with external MIDI-/OSC-hard- and software.

Description

A CVWidgetKnob is widget that can be used to set e.g. controls in running Synths, Ndefs, ProxySpace slots, NodeProxys, Patches and other other values that can be set at runtime. Also it may be used in connection with Patterns. Contrary to CVWidget2D it holds only one CV.

Class Methods

CVWidgetKnob.new(parent, widgetCV, name, connectKnob, connectNumVal, bounds, defaultAction, setup, controllersAndModels, cvcGui, persistent, server)

Create a new CVWidgetKnob. To display the widget on screen you must call front on the resulting object.

Arguments:

parent

an instance of Window or View - optional. If none is given the it will be created internally.

cv

an instance of CV - optional. If none is given it will be created internally.

name

a String or a Symbol - optional. If none is given the widget will be named "knob".

bounds

a Rect - optional. If none is given the widget will be created with a default size.

defaultAction

optional - a Function or a String that compiles to one when interpret is called on it. If an argument is added to the function it will provide the widget's CV. E.g.: { arg cv; cv.value.postln }

setup

optional - an Event containing the following optional keys:

midiMode
see CVWidget: -setMidiMode. default: 0
midiMean
see CVWidget: -setMidiMean. default: 64
midiResolution
see CVWidget: -setMidiResolution. default: 1
softWithin
see CVWidget: -setSoftWithin. default: 0.1
ctrlButtonBank
see CVWidget: -setCtrlButtonBank. default: nil
calibrate
see CVWidget: -setCalibrate. default: true
controllersAndModels

if a widget wraps a CV that has been created within some CVWidget the models and controllers of that other widget can be added here. However, it is not recommended to do so as there are specific methods that allow you to recreate widgets that have already been closed. See also CVWidget: -wdgtControllersAndModels

cvcGui

a multi-purpose argument: usually you will not set anything here. It is used with the -open method resp. CVCenter. Within these it is used to pass in OSC-/MIDI-responders resp. the widgets MIDI-/OSC-environment. See also CVWidget: -midiOscEnv

persistent

if set to true the widget's OSC-/MIDI-responders will not be removed when the widget gets closed - default: nil

server

only used for SwingOSC compatability (untested)

Returns:

only used for SwingOSC compatability (untested) this (a CVWidgetKnob)

Inherited class methods

Instance Methods

.open(window, wdgtBounds)

If a widget has been created with the argument persistent set to true the user may reopen the widget with this method. This is basically a workaround due to the fact that GUIs in SuperCollider usually can't be opened again once they have been closed (even though executing the variable storing the the regarding object still returns the object). However, rather than reopening the old widget this method will create a new one, holding all properties, the CV and MIDI-/OSC-responders. In order to make this work as desired one should apply the following syntax where x holds the instance of the initially created widget:

x = x.open // the old widget was stored in x which will afterwards hold the new widget

See example in CVWidget: reusable_widgets

Arguments:

window

a Window or nil - if none is provided the window will be created internally

wdgtBounds

a Rect or nil - if none is provided the bounds of the old widget will be used.

Returns:

a CVCWidgetKnob

GUI-elements

.knob

A Knob, displaying or setting the current value of the widget's CV.

Returns:

a Knob

.numVal

A NumberBox displaying or setting the current value of the widget's CV.

Returns:

.specBut

A Button linking to spec-tab within the widget's editor (see also: CVWidgetEditor)

Returns:

.midiHead

A Button linking to MIDI-tab within the widget's editor (see also: CVWidgetEditor)

Returns:

.midiLearn

A Button that, if clicked, either triggers the MIDI-learn functionality (button-label: "L") or creates a CCResponder for the values entered in -midiSrc, -midiChan or/and -midiCtrl (button-label: "C"). If a CCResponder is present the button-label gets changed to "X" - upon clicking the responder gets removed again.

Returns:

.midiSrc

A TextField displaying the ID of a connected MIDI-device. If no CCResponder is present one may enter the ID of a device (if known) and when clicking the -midiLearn button the widget will create a CCResponder listening to that device.

Returns:

.midiChan

A TextField displaying the channel for an existing CCResponder or, if none is present, one may use this field to set the channel for which the CCResponder shall be created.

Returns:

.midiCtrl

A TextField displaying the controller-number of an existing CCResponder or, if none is present, one may use this field to set the controller-number for which the CCResponder shall be created.

NOTE: SuperCollider numbers hardware-controllers internally beginning with 0 - if 0 gets entered here the controller will be displayed as 1 as most devices will probably number their knobs and sliders beginning with 1. Also, the way controller-numbers are displayed is related to the ctrlButtonBank setting which can be set with CVWidget: -setCtrlButtonBank

Returns:

.oscEditBut

A Button that links to the widget's OSC-tab within the CVWidgetEditor. If an OSCresponder is present, the button-label will display the command-name, the message-slot and the current OSC-mapping (if the button is big enough to display all this information - mapping can be \linlin, \linexp, \explin or \expexp).

Returns:

.calibBut

A Button that links to the OSC-tab within the CVWidgetEditor, displaying the current calibration-status.

Returns:

.actionsBut

A Button linking to the actions-tab within the widget's CVWidgetEditor. The button displays the number of active actions resp. existing actions in total.

Returns:

.background

.background = color

From superclass: CVWidget

Get or set the background-color of the widget. Tne setter for this method is implemented within CVWidgetMS while the getter is implemented as a global getter for all CVWidgets in CVWidget.

Arguments:

color

a Color

Returns:

a Color (getter) or this (a CVWidgetMS) (setter)

.stringColor

.stringColor = color

From superclass: CVWidget

Get or set the string-color of the widget. Tne setter for this method is implemented within CVWidgetMS while the getter is implemented as a global getter for all CVWidgets in CVWidget.

Arguments:

color

a Color

Returns:

a Color (getter) or this (a CVWidgetMS) (setter)

Inherited instance methods

Undocumented instance methods

.size

Examples

See examples in CVWidget: examples