LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

play sine wave with soundcard on CVI

hi,

 

   in the struct WAVEHDR there are dwFlags which can be tested to (dwFlags&WHDR_DONE)!=0

   this is automaticaly set by sound driver when this block is susscefully played.

   you can also send several WAVEHDR at once(each by waveOutWrite).

   After one or more WAVEHDR has flag WHDR_DONE, you can reuse this struct by sending it again to driver(new call waveOutWrite).

   With this buffering, there is no delay or "breaks", you can simply add this "Check and Write" routine to Timer callback.

   I recommend to have more that (NumberOfHeader*TimeLengthOFOneHeader)>400ms,to have susscifient reserve.

   (because Windows is not real time OS, do not use less time than 100ms unles you know what do you do)

 

there are some good documentation on msdn, for example http://msdn.microsoft.com/en-us/library/aa909814.aspx

 

 I hope this help

 

0 Kudos
Message 11 of 12
(1,031 Views)

I'm writing a small extension to an program in LabWindows CVI, that essentially produces a rising tone the close it gets to a designated point. I've already used StartPCSound and this works really well without too much thought. The big problem is however that it only outputs sound the the PC speaker, and not through the sound card. I've tried the code listed here and this works well enough, and I've been able to produce different tones at different volumes, but not been able the vary the length? Can you give me a few pointers please. For example if I wanted to play a particular note for 100ms what would I need to alter?

0 Kudos
Message 12 of 12
(931 Views)