diff --git a/lasp/__init__.py b/lasp/__init__.py index c0fadc5..fdabeb9 100644 --- a/lasp/__init__.py +++ b/lasp/__init__.py @@ -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 * diff --git a/lasp/device/lasp_daq.pyx b/lasp/device/lasp_daq.pyx index 42cb7ca..15adc23 100644 --- a/lasp/device/lasp_daq.pyx +++ b/lasp/device/lasp_daq.pyx @@ -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 = 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( outbuffer) @@ -113,7 +114,7 @@ cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil: # Waiting indefinitely on the queue... inbuffer = 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( sd.pyCallback) diff --git a/scripts/lasp_siggen b/scripts/play_sine similarity index 100% rename from scripts/lasp_siggen rename to scripts/play_sine