Working RtAudio backend. Small change. Now ready for hard change to UlDaq backend

This commit is contained in:
Anne de Jong 2020-09-16 09:40:00 +02:00
parent c9b84e4c96
commit 1f9279ff86
3 changed files with 12 additions and 10 deletions

View File

@ -164,8 +164,10 @@ class DAQConfiguration:
return [ch.qty for ch in self.getEnabledInputChannels()]
def getEnabledInputChannelSensitivities(self):
return [float(channel.sensitivity) for channel in
self.getEnabledInputChannels()]
return [
float(channel.sensitivity)
for channel in self.getEnabledInputChannels()
]
def getEnabledOutputChannels(self):
en_channels = []
@ -178,8 +180,10 @@ class DAQConfiguration:
return [ch.qty for ch in self.getEnabledOutputChannels()]
def getEnabledOutputChannelSensitivities(self):
return [float(channel.sensitivity) for channel in
self.getEnabledOutputChannels()]
return [
float(channel.sensitivity)
for channel in self.getEnabledOutputChannels()
]
@staticmethod
def loadConfigsJSON():
@ -211,4 +215,3 @@ class DAQConfiguration:
cur_configs = DAQConfiguration.loadConfigs()
del cur_configs[name]
sh.store('daqconfigs', cur_configs)

View File

@ -714,6 +714,7 @@ cdef class RtAudio:
def stop(self):
if self.sd is NULL:
raise RuntimeError('Stream is not running')
try:
self._rtaudio.stopStream()
self._rtaudio.closeStream()
@ -721,11 +722,9 @@ cdef class RtAudio:
print(e)
pass
self.cleanupStream(self.sd)
self.sd = NULL
cdef cleanupStream(self, PyStreamData* stream):
# printf('Entrance function cleanupStream...\n')
cdef:
void* ptr
if stream == NULL:
return

View File

@ -109,7 +109,6 @@ class AvStream:
self._videothread = None
self._audiobackend = RtAudio(daqconfig.api)
self.blocksize, self.samplerate = self._audiobackend.openStream(self)
def nCallbacks(self):
"""Returns the current number of installed callbacks."""
@ -148,7 +147,8 @@ class AvStream:
self._videothread.start()
else:
self._video_started <<= True
self._audiobackend.start()
self.blocksize, self.samplerate = self._audiobackend.start(self)
def _videoThread(self):
cap = cv.VideoCapture(self._video)