TweakKnob

Changes the value of a knob.

Synopsis

Err TweakKnob (Item KnobItem, int32 Value)

Description

This function sets the value of a knob that is attached to an instrument. The value is clipped to the allowable range. This has been optimized to allow rapid modulation of sound parameters.

This function differs from TweakRawKnob() in that the value passed to this function goes through knob-specific conversion. For example, typically frequency knobs are controlled with a frac16 Hz value with this function, and with a phase increment value with TweakRawKnob(). For many other knobs, the conversion is trivial: TweakRawKnob() and TweakKnob() yield the same results.

The current raw value of the Knob can be read by GetAudioItemInfo() using the AF_TAG_CURRENT_VALUE tag. There is no inverse conversion function, however, to convert back to the units supplied to TweakKnob().

If this knob is connected to the output of another instrument via ConnectInstruments(), the tweaked value is ignored until that connection is broken.

Arguments

KnobItem
Item number of the knob to be tweaked.
Value
The new value for that knob.

Return Value

The function returns a non-negative value if successful or an error code (a negative value) if an error occurs.

Implementation

SWI implemented in Audio folio V20.

Associated Files

audio.h

See Also

TweakRawKnob(), GrabKnob(), Knob