LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

help for PlaySound function ?

Hello,
could somebody send me an example using the PlaySound function of labwindows SDK, because I have some troubles with the prototype ? (PlaySound("try.wav", 0, SND_FILENAME);)

thanks,
Anthony.
0 Kudos
Message 1 of 6
(4,592 Views)
Look at samples\sdk\audio directory for sample programs.

Sheetal
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 2 of 6
(4,587 Views)
Your statement works well on my machine with system sounds (e.g. "chord.wav"). Please note the remarks on the PlaySound function:

The sound specified by pszSound must fit into available physical memory and be playable by an installed waveform-audio device driver. PlaySound searches the following directories for sound files: the current directory; the Windows directory; the Windows system directory; directories listed in the PATH environment variable; and the list of directories mapped in a network. For more information about the directory search order, see the documentation for the OpenFile function.

If it cannot find the specified sound, PlaySound uses the default system event sound entry instead. If the function can find neither the system default entry nor the default sound, it makes no sound and returns FALSE.


Be careful in particular to the location of the file: the current directory for example is not necessarily the application directory. You could try firstly playing a system sound, next placing your specific sound in a directory listed in the path and last placing it in another directory and passing the full pathname of the file PlaySound function.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 6
(4,586 Views)
hi,
thank you for answering.
Did you use only the statement PlaySound("name.wav",0,SND_FILENAME) ?, or did you add another statement (prototype, lib...) ?

Anthony.
0 Kudos
Message 4 of 6
(4,571 Views)
I used your statement:

#include
PlaySound ("chord.wav", 0, SND_FILENAME);

Need to add winmm.lib to the project.

The sample project listed by sheetal is a good starting point to study playing functions.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 6
(4,568 Views)
Yes it' working now, but I have another question which is important for me.
Why PlaySound only plays 126 times the good sound ( "try.wav" for example) and after it plays "ding.wav" ?
thanks.
0 Kudos
Message 6 of 6
(4,561 Views)