예제 #1
0
def event_callback(element, events):

    info = alsahcontrol.Info(element)
    value = alsahcontrol.Value(element)
    print('CALLBACK (DEF)! [%s] %s:%i' %
          (parse_event_mask(events), element.name, element.index))
    print('  ', value.get_tuple(info.type, info.count))
예제 #2
0
def value(element):
    info = alsahcontrol.Info(element)
    value = alsahcontrol.Value(element)
    for a in dir(value):
        if a.startswith('__'):
            continue
        print('  %s: %s' % (a, getattr(value, a)))
    values = value.get_tuple(info.type, info.count)
    print('  Values:', values)
    value.set_tuple(info.type, values)
    value.read()
    if info.is_writable:
        value.write()
예제 #3
0
def info(element):
    info = alsahcontrol.Info(element)
    enumerated = alsahcontrol.element_type['ENUMERATED']
    integer = alsahcontrol.element_type['INTEGER']
    integer64 = alsahcontrol.element_type['INTEGER64']
    for a in dir(info):
        if a.startswith('__'):
            continue
        if a in ['items', 'item_names'] and info.type != enumerated:
            continue
        if a in ['min', 'max', 'step'] and info.type != integer:
            continue
        if a in ['min64', 'max64', 'step64'] and info.type != integer64:
            continue
        extra = ''
        if a == 'type':
            extra = ' (%s)' % alsahcontrol.element_type_name[info.type]
        print('  %s: %s%s' % (a, getattr(info, a), extra))