I looked into this a bit more.
Unfortunately, it's not possible to just omit the taskCommit, because it creates a major performance hit.
Not only does the first instance of taskStart take longer (~45ms), which might be expected,but
EVERY instance of taskStart within the loop now takes much longer (typically increased from 0.4ms to ~7 ms).
I also noticed that this is dependent on the sampling mode, and the frequency.
My current experiments suggest:
If ( (sample_frequency is low) && (we used taskCommit) && (we loop over start...stop) && (Acquisition mode is finite) ) {
/* This bug will strike. Program will eventually crash, either with an erroneous underflow (task stops prematurely) or
a blocking-read returns too few points */
} else {
/* Seems to be OK */
}
* Frequencies of 32,100,1500 Hz are "low", whereas 2kHz and above seem to be fine.
* The setting of Enhanced_LF_Alias_Rejection is irrelevant
* The number of samples per frame doesn't seem to matter.
* Whether we use blocking or non-blocking reads doesn't make much difference.
Please add this prominently to some kind of documentation erratum: it took me 4 days' work to find this, and I hope it will help others.