Example #1
0
from atem import ATEMController
from config import *
from localconfig import *

from gfxconfig import *
import oui

#######################
#                     #
#   Initialisation:   #
#                     #
#######################

screen = oui.init(SCREEN_SIZE)

atem = ATEMController(HOST, PORT)

aux1bus = oui.Bus(screen, (10, 100, BUS_WIDTH, BUTTON_HEIGHT), "Aux1", SOURCE_LIST)
aux2bus = oui.Bus(screen, (10, 160, BUS_WIDTH, BUTTON_HEIGHT), "Aux2", SOURCE_LIST)
aux3bus = oui.Bus(screen, (10, 220, BUS_WIDTH, BUTTON_HEIGHT), "Aux3", SOURCE_LIST)

dskbus = oui.Bus(screen, (10, 280, BUS_WIDTH, BUTTON_HEIGHT), "DSK", SOURCE_LIST)

pgmbus = oui.Bus(screen, (10, 340, BUS_WIDTH, BUTTON_HEIGHT), "PGM", SOURCE_LIST)
pvwbus = oui.Bus(screen, (10, 400, BUS_WIDTH, BUTTON_HEIGHT), "PVW", SOURCE_LIST)

cutbutton = oui.Button(screen, (BUS_WIDTH + 50, 340, BUTTON_WIDTH, BUTTON_HEIGHT), "CUT")
autotakebutton = oui.Button(screen, (BUS_WIDTH + 50, 400, BUTTON_WIDTH, BUTTON_HEIGHT), "FADE")

# by wrapping the actions in lambdas, (or functions) they don't get called until
# the action is called...
Example #2
0
# Midi stuff.

midiin = None
if has_midi:
    logging.info("Pre midi init")
    interf, name, inp, outp, opened = pypm.GetDeviceInfo(0)
    midiin = pypm.Input(0)
    logging.info("Post midi init")

# make stdin a non-blocking file
fd = sys.stdin.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)

atem = ATEMController(HOST, PORT)

#################
#
# Main loop:
#
#################

while True:
    if midiin:
        midi_msg = midiin.Read(1)
        if midi_msg:
            data, counter = midi_msg[0]
            bank, instrument, value, val2 = data
            logging.info('|', join([bank, instrument, value]))
            # 88 18 801c 01e1 0000 0000 01f7 - 000c 0000 4354 5073 0054 01f1