mirror of
https://github.com/fergalmoran/disco-hue.git
synced 2026-02-16 13:12:23 +00:00
22 lines
475 B
Python
22 lines
475 B
Python
from ctypes import *
|
|
from contextlib import contextmanager
|
|
import pyaudio
|
|
|
|
ERROR_HANDLER_FUNC = CFUNCTYPE(
|
|
None, c_char_p, c_int, c_char_p, c_int, c_char_p)
|
|
|
|
|
|
def py_error_handler(filename, line, function, err, fmt):
|
|
pass
|
|
|
|
|
|
c_error_handler = ERROR_HANDLER_FUNC(py_error_handler)
|
|
|
|
|
|
@contextmanager
|
|
def noalsaerr():
|
|
asound = cdll.LoadLibrary('libasound.so')
|
|
asound.snd_lib_error_set_handler(c_error_handler)
|
|
yield
|
|
asound.snd_lib_error_set_handler(None)
|