EventShortcuts:
Filter:
Classes (extension) | Libraries > miSCellaneous > Event and pattern shortcuts

EventShortcuts : Object
ExtensionExtension

holds default and user-defined dictionaries of shortcuts for events and event patterns

Description

Container for dictionaries of shortcuts for the event framework, which can be defined by the user. Shortcuts might be for event keywords or any other (e.g. synth args). At every time one shortcut dictionary is current, but it's only active if EventShortcuts is turned on. Dictionaries are encapsulated and can only be accessed via copies and posting to prevent unintended changes. For event keywords see James Harkins' Practical Guide to Patterns (especially Pattern Guide 07: Value Conversions and Pattern Guide 08: Event Types and Parameters).

NOTE: Implementation of shortcuts works like this: if you don't turn EventShortcuts on at all, nothing is changed in the event framework – if you turn it on a mapping function is prepended to every event type function, if this has not been done before in this session and the event type function hasn't been newly defined since last prepending – if you turn it off the prepended function is still there, but does no mapping.

Therfore shortcuts won't work automatically after new definitions of event types. You'd have to turn EventShortcuts on again or apply the method EventShortcuts: *prefixEventTypes. Quite obviously, switching between different shortcut dictionaries might cause a mess while playing (or pausing and resuming) patterns with these shortcuts. But these are exceptional cases, a typical usage would be defining your personal shortcut dictionary (e.g. in the startup file), turning EventShortcuts on and playing therewith, then maybe turning it off and on again on occasion.

Some pattern classes (e.g. Ppar) don't work correctly with EventShortcuts, but this can be circumvented by applying shortcuts to source event patterns before, see method Pattern: -eventShortcuts. See also PLx and live coding with Strings

Class Methods

EventShortcuts.add(name, dict, overwrite: false)

Adds a new named IdentityDictionary of shortcuts.

Arguments:

name

Symbol or String.

dict

IdentityDictionary of abbreviations (keys given as Symbols) and original names (values given as Symbols).

overwrite

Boolean. Determines if a shortcut dictionary of that name – if existing at all – is overwritten. Defaults to false.

EventShortcuts.addOnBase(baseName: 'default', newName, dict, overwrite: false)

Adds a new named IdentityDictionary of shortcuts based on the copy of an existing one.

Arguments:

baseName

Symbol or String. Name of the shortcut dictionary to build upon.

newName

Symbol or String. Name of the new shortcut set.

dict

IdentityDictionary of new or/and additional abbreviations (keys given as Symbols) and original names (values given as Symbols).

overwrite

Boolean. Determines if a shortcut dictionary of that name – if existing at all – is overwritten. Defaults to false.

NOTE: overwrite only determines overwriting of an old dictionary of the same name. It doesn't influence the overwriting in the copy of the base dictionary itself, as exactly this is a main aim of the method. (you might want to replace the association 's'-> 'strum' by 's' -> 'server')

EventShortcuts.remove(name)

Removes a named IdentityDictionary of that name.

Arguments:

name

Symbol or String.

EventShortcuts.removeAll

Removes all IdentityDictionaries except \default.

EventShortcuts.copyDict(name)

Returns a copy of a shortcut dictionary of that name (if stored).

Arguments:

name

Symbol or String.

EventShortcuts.copyCurrentDict(name)

Returns a copy of the current shortcut dictionary of that name.

Arguments:

name

Symbol or String.

EventShortcuts.copyAllDicts

Returns an IdentityDictionary of copies of all stored shortcut dictionaries.

EventShortcuts.post(name)

Posts the shortcut dictionary of that name (if stored).

Arguments:

name

Symbol or String.

EventShortcuts.postCurrent

Posts the current shortcut dictionary.

EventShortcuts.postAll

Posts all shortcut dictionaries.

EventShortcuts.makeCurrent(name)

Makes the shortcut dictionary of that name current (if stored).

Arguments:

name

Symbol or String.

EventShortcuts.on

Turns on the shortcut mechanism, making it ready for events / patterns to be played. Also invokes EventShortcuts: *prefixEventTypes.

EventShortcuts.off

Turns the shortcut mechanism off.

EventShortcuts.prefixEventTypes

Puts the remapping function before all event type functions. Therefore a newly defined event type won't work with shortcuts before this has been called ( directly or via EventShortcuts: *on ).

EventShortcuts.current

Returns the Symbol of the current shortcut dictionary.

EventShortcuts.dictNames

Returns the Symbols of all shortcut dictionaries.

EventShortcuts.state

Returns the current state (\on or \off).

Inherited class methods

Instance Methods

Inherited instance methods

Examples