Advertisement
Guest User

Untitled

a guest
May 29th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. from ctypes import *
  4. import sys
  5.  
  6. librsound = cdll.LoadLibrary('librsound.so')
  7.  
  8. rsd_init = librsound.rsd_init
  9. rsd_init.restype = c_int
  10. rsd_init.argtypes = [c_void_p]
  11.  
  12. rsd_set_param = librsound.rsd_set_param
  13. rsd_set_param.restype = c_int
  14. rsd_set_param.argtypes = [c_void_p, c_int, c_void_p]
  15.  
  16.  
  17. rsd_start = librsound.rsd_start
  18. rsd_set_param.restype = c_int
  19. rsd_set_param.argtypes = [c_void_p]
  20.  
  21.  
  22. rsd_stop = librsound.rsd_stop
  23. rsd_stop.restype = c_int
  24. rsd_stop.argtypes = [c_void_p]
  25.  
  26.  
  27. rsd_write = librsound.rsd_write
  28. rsd_write.restype = c_ulong
  29. rsd_write.argtypes = [c_void_p, c_void_p, c_ulong]
  30.  
  31.  
  32. rsd_free = librsound.rsd_free
  33. rsd_free.restype = c_ulong
  34. rsd_free.argtypes = [c_void_p]
  35.  
  36.  
  37. rd = c_void_p()
  38.  
  39. rsd_init(byref(rd))
  40. num = c_int(44100)
  41. rsd_set_param(rd, 0, byref(num))
  42. num = c_int(2)
  43. rsd_set_param(rd, 1, byref(num))
  44.  
  45. if rsd_start(rd) == 0:
  46.    buf = sys.stdin.read(64)
  47.    while rsd_write(rd, buf, len(buf)):
  48.       buf = sys.stdin.read(64)
  49.       pass
  50.  
  51.    rsd_stop(rd)
  52.    
  53. rsd_free(rd)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement