File: hooks.py

package info (click to toggle)
mididings 0~20120419~ds0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 928 kB
  • sloc: python: 5,085; cpp: 3,454; ansic: 319; makefile: 8
file content (35 lines) | stat: -rw-r--r-- 953 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#
# hooks.py - demonstrates the use of hooks extending mididings' functionality.
#

from mididings import *
from mididings.extra.osc import OSCInterface
from mididings.extra.inotify import AutoRestart
from mididings.extra import MemorizeScene

config(
    out_ports = 2,
)

hook(
    # OSC interface: sending the message /mididings/switch_scene with a scene
    # number as a parameter to port 5678 switches scenes
    OSCInterface(5678),
    # auto-restart: edit and save this file in a text editor while it's
    # running, and mididings will automatically restart itself (!)
    AutoRestart(),
    # memorize scene: every time this script is restarted, it automatically
    # comes back with the previously active scene
    MemorizeScene('scene.txt')
)

run(
    scenes = {
        # scene 1: route everything to the first output port
        1:  Port(1),

        # scene 2: route everything to the second output port
        2:  Port(2),
    },
)