diff --git a/lasp/device/lasp_common_decls.pxd b/lasp/device/lasp_common_decls.pxd index 88bcfd3..144b418 100644 --- a/lasp/device/lasp_common_decls.pxd +++ b/lasp/device/lasp_common_decls.pxd @@ -134,7 +134,7 @@ cdef extern from "lasp_cppdaq.h" nogil: SafeQueue[void*] *outQueue) except + void stop() except + double samplerate() - us neninchannels(bool include_monitorchannel=False) + us neninchannels(bool include_monitorchannel) us nenoutchannels() DataType dataType() us framesPerBlock() diff --git a/lasp/device/lasp_cppdaq.cpp b/lasp/device/lasp_cppdaq.cpp index b0a21b6..bcfe165 100644 --- a/lasp/device/lasp_cppdaq.cpp +++ b/lasp/device/lasp_cppdaq.cpp @@ -184,8 +184,9 @@ double Daq::inputRangeForChannel(us ch) const { us Daq::neninchannels(bool include_monitorchannel) const { mutexlock lock(mutex); us inch = std::count(eninchannels.begin(), eninchannels.end(), true); - if (monitorOutput && include_monitorchannel) + if (monitorOutput && include_monitorchannel) { inch++; + } return inch; } diff --git a/lasp/device/lasp_cppuldaq.cpp b/lasp/device/lasp_cppuldaq.cpp index d15f6f4..70e230f 100644 --- a/lasp/device/lasp_cppuldaq.cpp +++ b/lasp/device/lasp_cppuldaq.cpp @@ -148,11 +148,11 @@ public: bool hasinput = neninchannels() > 0; bool hasoutput = nenoutchannels() > 0; - if (neninchannels() > 0 && !inqueue) { + if (hasinput && !inqueue) { throw runtime_error("Inqueue not given, while input is enabled"); } - if (nenoutchannels() > 0 && !outqueue) { + if (hasoutput && !outqueue) { throw runtime_error("outqueue not given, while output is enabled"); } @@ -169,12 +169,6 @@ public: this->inqueue = inqueue; this->outqueue = outqueue; - /* std::cerr << "************************ WARNING: Forcing coupling mode - * to AC - * **************************" << endl; */ - /* boolvec couplingmode = {true, true, true, true}; */ - /* setACCouplingMode(couplingmode); */ - stopThread = false; thread = new std::thread(threadfcn, this); } diff --git a/lasp/device/lasp_daq.pyx b/lasp/device/lasp_daq.pyx index 2ae2dfc..c486ba6 100644 --- a/lasp/device/lasp_daq.pyx +++ b/lasp/device/lasp_daq.pyx @@ -240,13 +240,13 @@ cdef class Daq: self.sd.thread = NULL self.sd.samplerate = samplerate - self.sd.ninchannels = daq.neninchannels() + self.sd.ninchannels = daq.neninchannels(True) self.sd.noutchannels = daq.nenoutchannels() self.sd.nBytesPerChan = nFramesPerBlock*dtype.sw self.sd.nFramesPerBlock = nFramesPerBlock self.sd.npy_format = getCNumpyDataType(dtype) - if daq.neninchannels() > 0: + if daq.neninchannels(True) > 0: self.sd.inQueue = new SafeQueue[void*]() if daq.nenoutchannels() > 0: self.sd.outQueue = new SafeQueue[void*]() diff --git a/lasp/device/lasp_daqconfig.pyx b/lasp/device/lasp_daqconfig.pyx index 4aa8fde..b315e96 100644 --- a/lasp/device/lasp_daqconfig.pyx +++ b/lasp/device/lasp_daqconfig.pyx @@ -200,7 +200,7 @@ cdef class DaqConfiguration: inch.append(self.getInChannel(i)) if include_monitor: outch = self.getEnabledOutChannels() - if len(outch) > 0: + if len(outch) > 0 and self.monitorOutput: inch.insert(0, outch[0]) return inch diff --git a/lasp/lasp_avstream.py b/lasp/lasp_avstream.py index 14a7b16..5fd21a1 100644 --- a/lasp/lasp_avstream.py +++ b/lasp/lasp_avstream.py @@ -44,20 +44,18 @@ class AvStream: video: """ - self.daqconfig = daqconfig - self.device = device self.avtype = avtype - en_out_ch = daqconfig.getEnabledOutChannels() en_in_ch = daqconfig.getEnabledInChannels(include_monitor=True) + en_out_ch = daqconfig.getEnabledOutChannels() - self.output_channel_names = [ch.channel_name for ch in en_out_ch] self.input_channel_names = [ch.channel_name for ch in en_in_ch] + self.output_channel_names = [ch.channel_name for ch in en_out_ch] self.input_sensitivity = [ch.sensitivity for ch in en_in_ch] + self.input_sensitivity = np.asarray(self.input_sensitivity) self.input_qtys = [ch.qty for ch in en_in_ch] - self.input_sensitivity = np.asarray(self.input_sensitivity) # Counters for the number of frames that have been coming in self._aframectr = Atomic(0) diff --git a/lasp/lasp_record.py b/lasp/lasp_record.py index bcf9461..b208f36 100644 --- a/lasp/lasp_record.py +++ b/lasp/lasp_record.py @@ -34,8 +34,6 @@ class Recording: fn += ext self._stream = stream - if stream.avtype != AvType.audio_input: - raise RuntimeError('Stream does not have any input channels') self.blocksize = stream.blocksize self.samplerate = stream.samplerate self._running = Atomic(False)