Hi Rajesh,
Thanks for posting the code. I don't have access to VeriStand (and I think there are a few missing VIs too), but can see how it should all work.
For glitch-free, continuous audio output you'll probably need to separate the WaveIO code into a subVI running in parallel, and have it run using a higher thread priority and a different execution system. Apart from a larger audio buffer, these execution settings seem to make the biggest difference in maintaining glitch-free audio output. When running within the User Interface thread (the default), it's competing with other tasks also running in the UI thread (VI Server, the "root loop") plus actual UI events (window drawing, user inputs, etc) which are all potential sources of glitch causing jitter.
Other things to help reduce glitches include disabling debugging in VIs, and ensuring no calls to VI Server occur within non-UI execution thread VIs.
As an example of all of the above, I recently wrote an open source DJing application in LabVIEW which achieves glitch-free, low-latency, continuous audio output using LabVIEW's sound API or the WaveIO API. Here's a short example video of it in action, showing simultaneous playback, file loading, and interactive audio processing, while maintaining glitch-free output.
Some questions and things to try:
- Is ASIO output a requirement, or can the application handle slightly higher audio latency?
- Are you using ASIO4ALL as the driver, or a soundcard with a dedicated ASIO driver? ASIO4ALL is generally good, but can have problems.
- Consider moving the WaveIO code and waveform generation into a separate subVI and set it to a different execution system + thread priority
- Extending the previous point, one subVI dedicated to audio production and manipulation (generating the audio data), and a second subVI dedicated to audio output. These would both run at different priorities and execution systems to each other and the main VI.
- Is the DVR being accessed elsewhere while this code is running (potentially causing it to block)?
- IPEs do have some overhead, so unless they're absolutely necessary I'd probably remove them. The LabVIEW compiler is pretty good at avoiding memory copies.
- Does a simplified example work without glitches?
- I couldn't see it in the code, but what buffer settings are used when initializing WaveIO? I've used 3 buffers, 1024 samples/buffer, and Samples as the unit successfully.