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

CVWidgetMS : 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 CVWidgetMS is widget that can be used to set e.g. arrayed 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. Typically it uses a ControlSpec that has more than one slot for its minval, maxval, default value or step-size.

Class Methods

CVWidgetMS.new(parent, widgetCV, name, connectMSlider, connectTextField, bounds, defaultAction, setup, controllersAndModels, cvcGui, persistent, numSliders: 5, server)

Create a new CVWidgetMS. 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.

widgetCV

an Array of CVs - optional. If none is given it will be created internally. The array may hold an arbitrary number of CVs.

name

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

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: an Array with a size given in argument numSliders, all slots filled with 0
midiMean
see CVWidget: -setMidiMean. default: an Array with a size given in argument numSliders, all slots filled with 64
midiResolution
see CVWidget: -setMidiResolution. default: an Array with a size given in argument numSliders, all slots filled with 1
softWithin
see CVWidget: -setSoftWithin. default: an Array with a size given in argument numSliders, all slots filled with 0.1
ctrlButtonBank
see CVWidget: -setCtrlButtonBank. default: an Array with a size given in argument numSliders, all slots filled with nil
calibrate
see CVWidget: -setCalibrate. default: an Array with a size given in argument numSliders, all slots filled with 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

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

numSliders

an Integer determining how many sliders the MultiSliderView shall have

server

only used for SwingOSC compatability (untested)

Returns:

this (a CVWidgetMS)

Inherited class methods

Instance Methods

.split

Split the internal multi-dimensional CV into an array of one-dimensional CVs. This is especially useful for the usage in Patterns. Once a CV has been split, it will return the split CVs in a variable cvArray. Calling the method repeatedly will not try to split the CV again. Hence, it should be safe to call split within Pattern code.

// a CVWidgetMS holding a 5-dimensional CV
w = CVWidgetMS(nil, CV([20!5, 20000!5, \exp].asSpec, 200!5), "freq", true, true).front;
// we cannot insert the internal CV in w directly into the Pattern
// as a Pseq requires an array. Hence, we split the CV into an array of CVs
s.waitForBoot { p = Pbind(\freq, Pseq(w.split, inf)).play };
p.stop;
w.close;

.msSize

From superclass: CVWidget

Though this is an instance var defined in CVWidget it applies to CVWidgetMS only: It returns the number of slots of the multi-slider of a CVWidgetMS.

Returns:

.cvArray

From superclass: CVWidget

CVWidgetMS only.

Returns:

an Array of CVs after applying the method split on a given CVWidgetMS.

.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 CVWidgetMS

GUI-elements

.mSlider

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

Returns:

.numVal

A TextView, displaying or setting the current value of the widget's CV as an Array of numbers (truncated to 2 decimal places).

Returns:

.midiBut

A Button that opens the MIDI-tab of the widget's CVWidgetMSEditor (also executed by shortcut 'm')

Returns:

.oscBut

A Button that opens the OSC-tab of the widget's CVWidgetMSEditor (also executed by shortcut 'o')

Returns:

.specBut

A Button that opens the Spec-tab of the widget's CVWidgetMSEditor (also executed by shortcut 's')

Returns:

.actionsBut

A Button that opens the Actions-tab of the widget's CVWidgetMSEditor (also executed by shortcut 'a')

Returns:

.calibViews

A List of Views, each displaying the current (OSC) calibration-status of one slider within the multi-slider of the widget: green means calibration is active, red means it's currently off. The views are displayed as a bar beneath the multi-slider of the widget.

Returns:

a List of Views

.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

Examples

See examples in CVWidget: examples