KeyPlayer:
Filter:
KeyPlayer (extension) | Undocumented classes

KeyPlayer
ExtensionExtension

a simple keyboard playing interface

Description

KeyPlayer allows using the computer keyboard keys for executing functions when given keys are pressed or released (keyDown and keyUp).

How to link to this file, in quarks/KeyPlayer? KeyPlayerExample.scd

Class Methods

.all

Global dict for all KeyPlayers

.at

Look up KeyPlayers by name in KeyPlayer.all

.verbose

get or set verbose flag to posts debug messages. default = false.

.new

create a new KeyPlayer

Arguments:

key

key under wich to store it

inDict

an optional dict of keyDown and keyUp functions - not well tested yet.

ignoreCase

a flag whether to ignore upper/lowercase letter distinction.

.gui

make a global gui for up to ten KeyPlayers.

.initClass

Instance Methods

Instance Variables

.key

The KeyPlayer's name/key

.actions

.upActions

.bothActions

dicts where the down and up actions kept.

.pressed

a dict with the currently pressed keys

.put

.putDown

.putUp

.putBoth

.putAll

set actions for keyDown and keyUp on given characters

Arguments:

char

the char for which to put the action

func

the action. Is called with arguments func.value(char, modifiers, unicode, keycode)

both

flag whether to distinguish upper/lower or to respond to both.

noRep

on keyDown, flag whether to swallow auto-repeated keystrokes.

.gui

make its own gui for KeyPlayer

.keyDown

.keyUp

evaluate keyActions by hand

.removeAt

remove actions from down or up dicts.

.isUp

.isDown

check wether a char is currently down (pressed) or not.

.makeRec

make an instance of KeyLoop for the KeyPlayer

.rec

get the KeyLoop for the KeyPlayer

.saveDoc

post current actions as code into a Document. Works if all functions are closed.

Private methods

.keyAction

.makeKeyAction

.makeKeyUpAction

Examples