Cleanup some debug print statements --> logging interface
This commit is contained in:
parent
e72e9154aa
commit
b031dfb280
@ -6,5 +6,6 @@ from .lasp_imptube import *
|
||||
from .lasp_measurement import *
|
||||
from .lasp_octavefilter import *
|
||||
from .lasp_slm import *
|
||||
from .lasp_record import *
|
||||
from .lasp_siggen import *
|
||||
from .lasp_weighcal import *
|
||||
|
@ -5,6 +5,7 @@ from .lasp_daqconfig cimport DaqConfiguration
|
||||
|
||||
from cpython.ref cimport PyObject,Py_INCREF, Py_DECREF
|
||||
import numpy as np
|
||||
import logging
|
||||
|
||||
__all__ = ['Daq']
|
||||
|
||||
@ -82,7 +83,7 @@ cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil:
|
||||
callback = <object> sd.pyCallback
|
||||
# print(f'Number of input channels: {ninchannels}')
|
||||
# print(f'Number of out channels: {noutchannels}')
|
||||
fprintf(stderr, 'Sleep time: %d us\n', sleeptime_us)
|
||||
# fprintf(stderr, 'Sleep time: %d us\n', sleeptime_us)
|
||||
|
||||
while not sd.stopThread.load():
|
||||
with gil:
|
||||
@ -103,7 +104,7 @@ cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil:
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
print('exception in Cython callback for audio output: ', str(e))
|
||||
logging.error('exception in Cython callback for audio output: ', str(e))
|
||||
return
|
||||
|
||||
sd.outQueue.enqueue(<double*> outbuffer)
|
||||
@ -113,7 +114,7 @@ cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil:
|
||||
# Waiting indefinitely on the queue...
|
||||
inbuffer = <double*> sd.inQueue.dequeue()
|
||||
if inbuffer == NULL:
|
||||
printf('Stopping thread...\n')
|
||||
logging.debug('Stopping thread...\n')
|
||||
return
|
||||
|
||||
try:
|
||||
@ -130,7 +131,7 @@ cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil:
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
print('exception in cython callback for audio input: ', str(e))
|
||||
logging.error('exception in cython callback for audio input: ', str(e))
|
||||
return
|
||||
|
||||
CPPsleep_us(sleeptime_us);
|
||||
@ -142,8 +143,6 @@ cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil:
|
||||
# Inputbuffer memory is owned by Numpy, so should not be free'ed
|
||||
inbuffer = NULL
|
||||
|
||||
fprintf(stderr, 'Exiting python thread...\n')
|
||||
|
||||
cdef class Daq:
|
||||
|
||||
def __cinit__(self, DeviceInfo pydevinfo, DaqConfiguration pydaqconfig):
|
||||
@ -177,7 +176,7 @@ cdef class Daq:
|
||||
def __dealloc__(self):
|
||||
# fprintf(stderr, "UlDaq.__dealloc__\n")
|
||||
if self.sd is not NULL:
|
||||
fprintf(stderr, "UlDaq.__dealloc__: stopping stream.\n")
|
||||
logging.debug("UlDaq.__dealloc__: stopping stream.")
|
||||
self.stop()
|
||||
|
||||
if self.daq_device is not NULL:
|
||||
@ -303,7 +302,7 @@ cdef class Daq:
|
||||
free(sd.outQueue.dequeue())
|
||||
del sd.outQueue
|
||||
sd.outQueue = NULL
|
||||
fprintf(stderr, "End cleanup stream queues...\n")
|
||||
logging.debug("End cleanup stream queues...\n")
|
||||
|
||||
if sd.pyCallback:
|
||||
Py_DECREF(<object> sd.pyCallback)
|
||||
|
Loading…
Reference in New Issue
Block a user