Tip: Tiny code to play a wav file

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Tip: Tiny code to play a wav file

Post by BackupUser »

Code updated For 5.20+

Restored from previous forum. Originally posted by PB.

If you want to play a wav file without the whole LoadSound route, try this:

Code: Select all

PlaySound_("c:\sound.wav",0,#SND_ASYNC) ; App continues after sound starts.
PlaySound_("c:\sound.wav",0,#SND_SYNC) ; App pauses until sound stops.
Note that there is NO error-checking done if you use this tiny approach, so if
the sound doesn't play for some reason, too bad.


PB - Registered PureBasic Coder


Edited by - PB on 18 January 2002 00:52:04