Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from ctypes import *
- import sys
- librsound = cdll.LoadLibrary('librsound.so')
- rsd_init = librsound.rsd_init
- rsd_init.restype = c_int
- rsd_init.argtypes = [c_void_p]
- rsd_set_param = librsound.rsd_set_param
- rsd_set_param.restype = c_int
- rsd_set_param.argtypes = [c_void_p, c_int, c_void_p]
- rsd_start = librsound.rsd_start
- rsd_set_param.restype = c_int
- rsd_set_param.argtypes = [c_void_p]
- rsd_stop = librsound.rsd_stop
- rsd_stop.restype = c_int
- rsd_stop.argtypes = [c_void_p]
- rsd_write = librsound.rsd_write
- rsd_write.restype = c_ulong
- rsd_write.argtypes = [c_void_p, c_void_p, c_ulong]
- rsd_free = librsound.rsd_free
- rsd_free.restype = c_ulong
- rsd_free.argtypes = [c_void_p]
- rd = c_void_p()
- rsd_init(byref(rd))
- num = c_int(44100)
- rsd_set_param(rd, 0, byref(num))
- num = c_int(2)
- rsd_set_param(rd, 1, byref(num))
- if rsd_start(rd) == 0:
- buf = sys.stdin.read(64)
- while rsd_write(rd, buf, len(buf)):
- buf = sys.stdin.read(64)
- pass
- rsd_stop(rd)
- rsd_free(rd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement