PDA

Click to See Complete Forum and Search --> : When I play a sound using that mcisendstring thing how do I let the user use the prog


Apollo
Nov 9th, 1999, 08:35 AM
ram normally, while still playing the sound. Like BGSOUND on a website? I got code off of this site, but it uses that wait crap, which doesn't return control to windows until the sound has played, and well...it sucks.

------------------
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

SteveS
Nov 9th, 1999, 09:01 AM
If you're playing a .Wav File then use the SndPlaySound API with the Async setting.

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Const SND_ASYNC = &H1

sndPlaySound "MySound.Wav", SND_ASYNC

******************************************

If playing a Midi File then use mciSendString

void = mciSendString("close all", 0&, 0, 0)
void = mciSendString("open MyMid.mid type sequencer alias MyMidi", 0&, 0, 0)
void = mciSendString("play MyMidi", 0&, 0, 0)


Hope this helps,

Steve.

PS. Try not to be so negative when asking a question!!!! That wait CRAP is quite useful in other applications of this function.

Apollo
Nov 10th, 1999, 10:05 AM
I'm sure the wait 'crap' helps alot. But not so much in mine. But, the thing is I tried the code you gave me right... but it plays approximately a tenth of a second of the sound.

Any suggestions? Maybe why I can't get this to play the full length?

------------------
"I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"