Last active
October 7, 2018 14:05
-
-
Save takaswie/669fd4254c7b9fd631762fc61ac931f5 to your computer and use it in GitHub Desktop.
A sample Python 3 script for a new SndTscm object for new features of firewire-tascam driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from sys import exit | |
from time import sleep | |
import gi | |
gi.require_version('Hinawa', '2.0') | |
from gi.repository import Hinawa | |
unit = Hinawa.SndTscm() | |
unit.open('/dev/snd/hwC2D0') | |
unit.listen() | |
req = Hinawa.FwReq() | |
def handle_control(self, index, flags): | |
print('{0:02d}: {1:08x}'.format(index, flags)) | |
# data = bytearray(4) | |
# You can check the flags and bright LED with proper values | |
# in the data array. | |
# print(req.write(self, 0xffff00000404, data)) | |
unit.connect('control', handle_control) | |
while (True): | |
msgs = unit.get_status() | |
for i in range(len(msgs) // 2): | |
left = i | |
right = i + len(msgs) // 2 | |
print('{0:02d}: {1:08x}, {2:02d}: {3:08x}'.format(left, msgs[left], right, msgs[right])) | |
sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment