Click to See Complete Forum and Search --> : Playing .wav sound files
yakko
Jan 4th, 2001, 09:09 PM
Hi there,
I'm already using api to play .wav sounds one at a time, and my question is, is it possible to play two sounds at once? Also, is there a simple way to replay a sound when it's finished? Thanks!
Chris
Jan 5th, 2001, 04:10 AM
i think this will do, yet it depands on the soundcard that you using. It should work for SoundBlaster SoundCard.
Option Explicit
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Declare Function PlaySound Lib "winmm.dll"
Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1 ' Play asynchronously Private Const SND_NODEFAULT = &H2 ' Do not use default sound.
Private Sub Form_Load()
PlaySound "C:\welcome1.wav", 0&, SND_ASYNC Or SND_NODEFAULT
PlaySound "C:\welcome2.wav", 0&, SND_ASYNC Or SND_NODEFAULT
End Sub
Hi,
I am using a Multimedia MCI control (MMControl) to play music. The problem is that I don't know how to automatically replay it. I mean with only 7 seconds of music repeat it constantly.
Thank you very much.
Chris
Jan 23rd, 2001, 08:47 AM
Saiz, you can use the MMControl1_PlayCompleted event in the MMControl to replay the audio file rite.
Hope this can help you too.
Chris I tried something better, I copied the code from your previous reply and added the following:
PlaySound "C:\Wmpaud9.wav", 0&, SND_ASYNC Or SND_LOOP
Now it replay constantly.
But still a problem: I don't know how to stop it!!!
Any suggestion?
Chris
Jan 24th, 2001, 08:49 AM
Saiz, Here the sample on how to stop a wavw audio file play by the PlaySound API.
Option Explicit
Private Const SND_PURGE = &H40 ' purge non-static events for task
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub Command1_Click()
PlaySound "C:\IR_BEGIN.WAV", 0&, SND_ASYNC Or SND_LOOP
End Sub
Private Sub Command2_Click()
PlaySound "C:\IR_BEGIN.WAV", 0&, SND_PURGE
End Sub
Abel
Jan 24th, 2001, 03:54 PM
Where can I get Multimedia MCI control (MMControl) ??
Thanks
Andreas
andreas@sweden.com
Chris
Jan 25th, 2001, 08:23 AM
All you need is juz add the Multimedia control into your project.
References|Component|Microsoft Myltimedia Control 6.0 (SP3)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.