More bugfixes. Starts to go in the right direction :)

This commit is contained in:
Anne de Jong 2020-11-08 00:17:59 +01:00
parent 312d7fa694
commit 0e1bbec1d1
7 changed files with 11 additions and 20 deletions

View File

@ -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()

View File

@ -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;
}

View File

@ -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);
}

View File

@ -240,13 +240,13 @@ cdef class Daq:
self.sd.thread = NULL
self.sd.samplerate = <double> 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*]()

View File

@ -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

View File

@ -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)

View File

@ -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)