Fixed several bugs. Most serious one is a segfault for a stream without input.
This commit is contained in:
parent
f4e3688222
commit
7153096552
@ -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)
|
||||
|
@ -93,10 +93,12 @@ 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)
|
||||
for i in range(nblocks_buffer):
|
||||
outbuffer = <double*> malloc(sizeof(double)*nBytesPerChan*noutchannels)
|
||||
memset(outbuffer, 0, sizeof(double)*nBytesPerChan*noutchannels)
|
||||
sd.outQueue.enqueue(<double*> outbuffer)
|
||||
|
||||
if sd.outQueue:
|
||||
for i in range(nblocks_buffer):
|
||||
outbuffer = <double*> malloc(sizeof(double)*nBytesPerChan*noutchannels)
|
||||
memset(outbuffer, 0, sizeof(double)*nBytesPerChan*noutchannels)
|
||||
sd.outQueue.enqueue(<double*> outbuffer)
|
||||
sd.ready.store(True)
|
||||
|
||||
while not sd.stopThread.load():
|
||||
|
@ -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(
|
||||
|
@ -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)
|
||||
|
||||
add_executable(test_uldaq test_uldaq.cpp)
|
||||
target_link_libraries(test_uldaq cpp_daq)
|
||||
if(LASP_ULDAQ)
|
||||
add_executable(test_uldaq test_uldaq.cpp)
|
||||
target_link_libraries(test_uldaq cpp_daq)
|
||||
endif(LASP_ULDAQ)
|
||||
|
Loading…
Reference in New Issue
Block a user