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

View File

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

View File

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