Not sure where the correct place is to put this comment, but I've been playing with the new stream feature in LV2016 in place of a queue. I have noticed a glaring omission. There is no flush stream capability. I find this function invaluable when building any type of queue if I wanted to dump all data in the queue at once. Case in point, I'm sampling data from a ADC into a queue. Then in another process I'm reading that data. I want to change the sample parameters and then start reading again. I need to flush all the data in the queue with the old sample rate (or whatever) when I reprogram the new settings.
Apparently this can't be done with a stream. I can't even do a read multiple (get an error code 1059) when I try and create that function while having a read or write (single) stream. I guess it is back to the queue for me until this gets fixed.
Solved! Go to Solution.
Instead of Flush Queue, I tend to use a FOR loop or While loop to dequeue the elements until it is either empty or I have read X data points. What this does is avoid the memory reallocation from flushing the queue (which actually deallocates the memory) and then building up the elements in the queue. I imagine you could do the same for the Stream Channel.
I thought about doing that. But nothing is free. The 2 issues I see with this method are 1) it requires another parallel loop running in my code dequeuing and processing data that I don't need. (Not really that big of a deal other than having to rewrite the code I already have.) But more importantly 2) there is sometimes a delay in the data due to the queue filling up because of fast sample rates and the amount of processing I am doing to the data. My computer doesn't quite keep of with the processing. So whenever I want to change parameters that I'm testing. The data in the queue in of the wrong sample rate and my program errors out. Waiting for all the data to clear out of the queue could be as long as 5-6 seconds in some cases. IMO it is much better to flush the data in a single cycle and start with new data whenever I need to change parameters.
Not sure where the correct place is to put this comment...
The best place would be here - https://decibel.ni.com/content/groups/channelwires?view=discussions
As far as I understand, you could also modify all the code or create your own channel (I'm not sure if you can inherit to get the stream functionality for free), but that would require you to manage your own code.
Thanks for the link. I tried to post there, but NI prevented me from doing so:
And if joining doesn't work, this is the place to ask - http://forums.ni.com/t5/Feedback-on-NI-Discussion-Forums/bd-p/130
Technically this isn't the forums, but they'll know what to do.