def __init__(self, parent, title, devices, configurations):
        wx.Frame.__init__(self, parent, title=title, size=(300, 500))

        self.monitor = mapper.monitor()

        self.timer = wx.Timer(self, -1)
        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
        self.timer.Start(100)  # every 100 ms

        panel = wx.Panel(self)
        box = wx.BoxSizer(wx.VERTICAL)

        self.devices = devices
        self.configs = configurations
        self.selected = None

        self.buttons = {}
        for c in self.configs:
            button = wx.Button(panel, id=-1, label=c["name"], pos=(8, 8), size=(280, 28))
            button.Bind(wx.EVT_BUTTON, self.on_click(c))
            box.Add(button, 0, wx.ALL, 10)
            self.buttons[c["name"]] = button

        panel.SetSizer(box)
        panel.Layout()
Example #2
0
    def __init__(self):
        self.mon = mapper.monitor(autosubscribe_flags=mapper.SUB_DEVICE)
        self.initMonitor()
        self.mo_calibrate = mapper.MO_CALIBRATE
        self.mo_expression = mapper.MO_EXPRESSION
        self.mo_reverse = mapper.MO_REVERSE
        self.mo_linear = mapper.MO_LINEAR
        self.mo_bypass = mapper.MO_BYPASS

        self.ba_none = mapper.BA_NONE
        self.ba_mute = mapper.BA_MUTE
        self.ba_clamp = mapper.BA_CLAMP
        self.ba_fold = mapper.BA_FOLD
        self.ba_wrap = mapper.BA_WRAP

        self.modes_dict = {'Bypass': mapper.MO_BYPASS, 'Calibrate': mapper.MO_CALIBRATE, 'Reverse': mapper.MO_REVERSE,
                           'Linear': mapper.MO_LINEAR, 'Expression': mapper.MO_EXPRESSION}

        self.boundaries_dict = {'None': mapper.BA_NONE, 'Mute': mapper.BA_MUTE, 'Clamp': mapper.BA_CLAMP,
                           'Fold': mapper.BA_FOLD, 'Wrap': mapper.BA_WRAP}

        # we often need to fetch reversed info from the dictionaries above:
        self.modes_dict_rev = dict((v,k) for k, v in self.modes_dict.iteritems())
        self.boundaries_dict_rev = dict((v,k) for k, v in self.boundaries_dict.iteritems())

        self.OSC_devices = []
Example #3
0
    def __init__(self):
        self.mon = mapper.monitor()
        self.mon.request_devices()
        self.mon.request_links_by_src_device_name("/*")

        self.mo_calibrate = mapper.MO_CALIBRATE
        self.mo_expression = mapper.MO_EXPRESSION
        self.mo_reverse = mapper.MO_REVERSE
        self.mo_linear = mapper.MO_LINEAR
        self.mo_bypass = mapper.MO_BYPASS

        self.modes_dict = {'Bypass': mapper.MO_BYPASS, 'Calibrate': mapper.MO_CALIBRATE, 'Reverse': mapper.MO_REVERSE,
                           'Linear': mapper.MO_LINEAR, 'Expression': mapper.MO_EXPRESSION}
        # we often need to fetch reversed info from the dictionay above:
        self.modes_dict_rev = dict((v,k) for k, v in self.modes_dict.iteritems())
Example #4
0
    def __init__(self, parent, minvalue, maxvalue, init=None, pos=(0,0), size=(200,16), log=False,
                 integer=False, powoftwo=False, backColour=None, signal_id=None):

        ControlSlider.__init__(self, parent=parent, minvalue=minvalue, maxvalue=maxvalue, init=init,
                               pos=pos, size=size, log=log, outFunction=self.setMapper, integer=integer,
                               powoftwo=powoftwo, backColour=backColour)

        self.signal_id = signal_id
        self.mon = mapper.monitor()
        self.dev = self.GetParent().dev
        self.output = self.dev.add_output("/"+str(self.signal_id), 1, 'f', None, -1000, 1000)

        while not self.dev.ready():
            self.dev.poll(10)
            self.mon.poll()
Example #5
0
def on_refresh(arg):
    global monitor
    del monitor
    monitor = mapper.monitor()
    init_monitor()
Example #6
0
 def setNetworkInterface(self, iface):
     self.admin = mapper.admin(iface=iface)
     self.mon = mapper.monitor(self.admin, autorequest=0)
     self.initMonitor()
Example #7
0
    dev.properties['testInt'] = 7
    dev.set_properties({"removed1":None, "removed2":"test"})
    dev.remove_property("removed2")
    print 'signal properties:', sig.properties
    sig.properties['testInt'] = 3
    print 'signal properties:', sig.properties

dev = mapper.device("test")
setup(dev)

def db_cb(rectype, record, action):
    print rectype,'callback -'
    print '  record:',record
    print '  action:',["MODIFY","NEW","REMOVE"][action]

mon = mapper.monitor()

mon.db.add_device_callback(lambda x,y:db_cb('device',x,y))
mon.db.add_signal_callback(lambda x,y:db_cb('signal',x,y))
mon.db.add_connection_callback(lambda x,y:db_cb('connection',x,y))
l = lambda x,y:db_cb('link',x,y)
mon.db.add_link_callback(l)
mon.db.remove_link_callback(l)

while not dev.ready():
    dev.poll(10)
    mon.poll()

mon.request_devices()

for i in range(1000):
Example #8
0
def on_refresh(arg):
    global monitor
    del monitor
    admin = mapper.admin(networkInterfaces['active'])
    monitor = mapper.monitor(admin, autorequest=0)
    init_monitor()
Example #9
0
#!/usr/bin/env python

import mapper

devices = {}
links = {}
monitor = mapper.monitor(autorequest=mapper.AUTOREQ_LINKS
                         | mapper.AUTOREQ_CONNECTIONS)
relaunch_same_host = 1
timeout = 60
now = 0
changed = 0

id_counter = 0


def poll(wait=0):
    monitor.poll(wait)
    check_devices()


def increment_id_counter():
    global id_counter
    id_counter += 1
    if id_counter < 0:
        id_counter = 0


def get_device_class(name):
    return name[0:name.find('.', 0)]
Example #10
0
def on_refresh(arg):
    global monitor
    del monitor
    monitor = mapper.monitor()
    init_monitor()
Example #11
0
    d.add_input("/insig", 4, 'f', None, None, None, h)
    d.add_output("/outsig", 4, 'f')
    print 'setup done!'


dev = mapper.device("test")
setup(dev)


def db_cb(rectype, record, action):
    print rectype, 'callback -'
    print '  record:', record
    print '  action:', ["MODIFY", "NEW", "REMOVE"][action]


mon = mapper.monitor(autosubscribe_flags=mapper.SUB_DEVICE)

mon.db.add_device_callback(lambda x, y: db_cb('device', x, y))
mon.db.add_signal_callback(lambda x, y: db_cb('signal', x, y))
mon.db.add_connection_callback(lambda x, y: db_cb('connection', x, y))
l = lambda x, y: db_cb('link', x, y)
mon.db.add_link_callback(l)
mon.db.remove_link_callback(l)

while not dev.ready():
    dev.poll(10)
    mon.poll()

for i in range(1000):
    dev.poll(10)
    mon.poll()
Example #12
0
    d.add_input("/insig", 4, "f", None, None, None, h)
    d.add_output("/outsig", 4, "f")
    print "setup done!"


dev = mapper.device("test")
setup(dev)


def db_cb(rectype, record, action):
    print rectype, "callback -"
    print "  record:", record
    print "  action:", ["MODIFY", "NEW", "REMOVE"][action]


mon = mapper.monitor(autosubscribe_flags=mapper.SUB_DEVICE)

mon.db.add_device_callback(lambda x, y: db_cb("device", x, y))
mon.db.add_signal_callback(lambda x, y: db_cb("signal", x, y))
mon.db.add_connection_callback(lambda x, y: db_cb("connection", x, y))
l = lambda x, y: db_cb("link", x, y)
mon.db.add_link_callback(l)
mon.db.remove_link_callback(l)

while not dev.ready():
    dev.poll(10)
    mon.poll()

for i in range(1000):
    dev.poll(10)
    mon.poll()
Example #13
0
def on_refresh(arg):
    global monitor
    del monitor
    admin = mapper.admin(networkInterfaces['active'])
    monitor = mapper.monitor(admin, autosubscribe_flags=mapper.SUB_DEVICE | mapper.SUB_DEVICE_LINKS_OUT)
    init_monitor()
Example #14
0
    def launch():
        try:
            import webbrowser, time
            time.sleep(0.2)
            for a in apps:
                a = os.path.expanduser(a)
                a = a.replace('\\','\\\\')
                if webbrowser.get(a).open(url):
                    return
            webbrowser.open(url)
        except:
            print 'Error opening web browser, continuing anyway.'
    launcher = threading.Thread(target=launch)
    launcher.start()

monitor = mapper.monitor(autosubscribe_flags=mapper.SUB_DEVICE | mapper.SUB_DEVICE_LINKS_OUT)

def on_device(dev, action):
    if action == mapper.MDB_NEW:
        server.send_command("new_device", dev)
    if action == mapper.MDB_MODIFY:
        server.send_command("mod_device", dev)
    if action == mapper.MDB_REMOVE:
        server.send_command("del_device", dev)

def on_signal(sig, action):
    if action == mapper.MDB_NEW:
        server.send_command("new_signal", sig)
    if action == mapper.MDB_MODIFY:
        server.send_command("mod_signal", sig)
    if action == mapper.MDB_REMOVE:
Example #15
0
#!/usr/bin/env python

import webmapper_http_server as server
import mapper
import sys

if 'tracing' in sys.argv[1:]:
    server.tracing = True

monitor = mapper.monitor()

def on_device(dev, action):
    if action == mapper.MDB_NEW:
        server.send_command("new_device", dev)
    if action == mapper.MDB_REMOVE:
        server.send_command("del_device", dev)

def on_signal(sig, action):
    if action == mapper.MDB_NEW:
        server.send_command("new_signal", sig)
    if action == mapper.MDB_REMOVE:
        server.send_command("del_signal", sig)

def on_link(link, action):
    if action == mapper.MDB_NEW:
        server.send_command("new_link", link)
    if action == mapper.MDB_REMOVE:
        server.send_command("del_link", link)

def on_connection(con, action):
    if action == mapper.MDB_NEW:
Example #16
0
def h(sig, id, f, timetag):
    print '     handler got', sig.name, '=', f, 'at time', timetag

src = mapper.device("src")
outsig1 = src.add_output("/outsig1", 1, 'f', None, 0, 1000)
outsig2 = src.add_output("/outsig2", 1, 'f', None, 0, 1000)

dest = mapper.device("dest")
insig1 = dest.add_input("/insig1", 1, 'i', None, 0, 1, h)
insig2 = dest.add_input("/insig2", 1, 'i', None, 0, 1, h)

while not src.ready() or not dest.ready():
    src.poll()
    dest.poll(10)

monitor = mapper.monitor()

monitor.link('%s' %src.name, '%s' %dest.name)
monitor.connect('%s%s' %(src.name, outsig1.name),
                '%s%s' %(dest.name, insig1.name),
                {'mode': mapper.MO_LINEAR})
monitor.connect('%s%s' %(src.name, outsig2.name),
                '%s%s' %(dest.name, insig2.name),
                {'mode': mapper.MO_LINEAR})
monitor.poll()

for i in range(10):
    now = src.now()
    print 'Updating output signals to', i, 'at time', now
    src.start_queue(now)
    outsig1.update(i)
Example #17
0
    def launch():
        try:
            import webbrowser, time
            time.sleep(0.2)
            for a in apps:
                a = os.path.expanduser(a)
                a = a.replace('\\','\\\\')
                if webbrowser.get(a).open(url):
                    return
            webbrowser.open(url)
        except:
            print 'Error opening web browser, continuing anyway.'
    launcher = threading.Thread(target=launch)
    launcher.start()

monitor = mapper.monitor(autorequest=0)

def on_device(dev, action):
    if action == mapper.MDB_NEW:
        server.send_command("new_device", dev)
    if action == mapper.MDB_MODIFY:
        server.send_command("mod_device", dev)
    if action == mapper.MDB_REMOVE:
        server.send_command("del_device", dev)

def on_signal(sig, action):
    if action == mapper.MDB_NEW:
        server.send_command("new_signal", sig)
    if action == mapper.MDB_MODIFY:
        server.send_command("mod_signal", sig)
    if action == mapper.MDB_REMOVE: