Fixed several bugs. Most serious one is a segfault for a stream without input.

This commit is contained in:
Anne de Jong 2021-05-19 16:33:27 +02:00
parent f4e3688222
commit 7153096552
4 changed files with 16 additions and 7 deletions

View File

@ -19,7 +19,7 @@ option(LASP_RTAUDIO "Compile with RtAudio Daq backend" ON)
option(LASP_ULDAQ "Compile with UlDaq backend" ON)
option(LASP_DEBUG "Compile in debug mode" ON)
option(LASP_FFTW_BACKEND "Compile with FFTW fft backend" ON)
option(LAS_FFTPACK_BACKEND "Compile with Fftpack fft backend" OFF)
option(LASP_FFTPACK_BACKEND "Compile with Fftpack fft backend" OFF)
if(LASP_PARALLEL)
add_definitions(-DLASP_MAX_NUM_THREADS=30)

View File

@ -93,6 +93,8 @@ cdef void audioCallbackPythonThreadFunction(void* voidsd) nogil:
# print(f'Number of input channels: {ninchannels}')
# print(f'Number of out channels: {noutchannels}')
# fprintf(stderr, 'Sleep time: %d us\n', sleeptime_us)
if sd.outQueue:
for i in range(nblocks_buffer):
outbuffer = <double*> malloc(sizeof(double)*nBytesPerChan*noutchannels)
memset(outbuffer, 0, sizeof(double)*nBytesPerChan*noutchannels)

View File

@ -107,6 +107,7 @@ class AudioStream:
processCallback: callback function that will be called from a different
thread, with arguments (AudioStream, in
"""
logging.debug('AudioStream()')
self.running = Atomic(False)
self.aframectr = Atomic(0)
@ -130,6 +131,10 @@ class AudioStream:
self.daq = Daq(device, daqconfig)
en_in_ch = daqconfig.getEnabledInChannels(include_monitor=True)
en_out_ch = daqconfig.getEnabledOutChannels()
if en_in_ch == 0 and en_out_ch == 0:
raise RuntimeError('No enabled input / output channels')
logging.debug('Ready to start device...')
samplerate = self.daq.start(self.streamCallback)
self.streammetadata = StreamMetaData(

View File

@ -11,5 +11,7 @@ target_link_libraries(test_fft lasp_lib)
target_link_libraries(test_workers lasp_lib)
target_link_libraries(test_math lasp_lib)
if(LASP_ULDAQ)
add_executable(test_uldaq test_uldaq.cpp)
target_link_libraries(test_uldaq cpp_daq)
endif(LASP_ULDAQ)