Skip to content

Set Mode Loss

Description

This allows the loss coefficient of an individual mode to be altered dynamically.

(set-mode-loss ... )

Lisp Syntax and Default Values

The (set-mode-loss ... ) function can be called using the following Lisp syntax:

(set-mode-loss object_reference mode_number value)
or:

(set-mode-loss object_reference mode_number controller)

Parameters

The (set-mode-loss ... ) function requires three arguments:

  • object_reference: name of the object whose specified mode's loss coefficient will be modified.
  • mode_number: the mode number whose loss coefficient will be altered (starting from mode 0)
  • value, controller: a numerical value or a Modalys controller used to determine the loss coefficient of the given mode.

The mode-number must lie between zero and the number of modes in the object minus one.

Discussion

This function is used to set the loss coefficient of a mode to a new value. The following example shows how you can use (get-info 'mode-loss ... ) to obtain the loss coefficient of a given mode, and then scale it dynamically using (set-mode-loss ... ):

(setq orig-loss-mode0 (get-info 'mode-loss my-string 0))
(setq loss-env-mode0 (make-controller 'envelope 1
         (list    (list 0 orig-loss-mode0)
                  (list 1 (* 0.5 orig-loss-mode0))
                  (list 2 orig-loss-mode0))))
(set-mode-loss my-string 0 loss-env-mode0)
This function is not yet implemented for Hybrids; an error message will be displayed if object is of hybrid type.

Options

Retro-Compatibility

Modalys also has an older syntax for this function:

(set-mode-loss! object_reference mode_number value)

See Also

The older function basically did the same thing without the convenience of optionally using a controller), so any older Modalys scripts using it should be updated to use the new syntax (without the exclamation point).