Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Hazard on October 08, 2003, 07:45 PM

Title: Sounds on Startup
Post by: Hazard on October 08, 2003, 07:45 PM
Does anybody have an idea for how to insert a sound on startup? I was thinking of using a .wav or .mp3 file for this but I need an idea of where to start with it. Any input would be appreciated.
Title: Re:Sounds on Startup
Post by: PaiD on October 08, 2003, 08:12 PM
I use sounds on my About

Private Sub mnuAbout_Click()
PlayMP3 ("About.mp3")
frmAbout.Show
End Sub
Title: Re:Sounds on Startup
Post by: Skywing on October 08, 2003, 08:30 PM
Quote from: Hazard on October 08, 2003, 07:45 PM
Does anybody have an idea for how to insert a sound on startup? I was thinking of using a .wav or .mp3 file for this but I need an idea of where to start with it. Any input would be appreciated.

You can use the PlaySound (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_playsound.asp) function.

P.S. From a user standpoint, I consider programs that play sounds without good reason obnoxious.
Title: Re:Sounds on Startup
Post by: hismajesty on October 08, 2003, 08:33 PM
Quote from: Skywing on October 08, 2003, 08:30 PM
P.S. From a user standpoint, I consider programs that play sounds without good reason obnoxious.

Same  :)
Title: Re:Sounds on Startup
Post by: Hazard on October 08, 2003, 08:37 PM
I welcome input on that as well Skywing. Function is my primary purpose right now.
Title: Re:Sounds on Startup
Post by: Banana fanna fo fanna on October 08, 2003, 08:55 PM
Quote from: PaiD on October 08, 2003, 08:12 PM
I use sounds on my About

Private Sub mnuAbout_Click()
PlayMP3 ("About.mp3")
frmAbout.Show
End Sub


Show the PlayMP3 function?
Title: Re:Sounds on Startup
Post by: iago on October 08, 2003, 10:05 PM
I would recommend DirectMusic :-D
Title: Re:Sounds on Startup
Post by: WiLD on October 09, 2003, 07:46 AM
I just added this 2 my bot, when errors occur it plays a sound.

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Const SND_ASYNC = &H1

Just place that in a simple module or whatever

sndPlaySound "error.wav", SND_ASYNC

place that under form load or what ever you want it triggered by and your set.

Much easier thenother methods
Title: Re:Sounds on Startup
Post by: PaiD on October 09, 2003, 01:56 PM
Quote from: St0rm.iD on October 08, 2003, 08:55 PM
Show the PlayMP3 function?
Ok

Public Sub PlayMP3(filename As String)
   mciSendString "Open " & filename & " Alias MM", 0, 0, 0
   mciSendString "Play MM", 0, 0, 0
End Sub
Public Sub PauseMP3(filename As String)
   mciSendString "Stop " & filename & " Alias MM", 0, 0, 0
End Sub
Public Sub StopMP3(filename As String)
   mciSendString "Stop MM", 0, 0, 0
   mciSendString "Close MM", 0, 0, 0
End Sub

Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Title: Re:Sounds on Startup
Post by: Banana fanna fo fanna on October 09, 2003, 05:43 PM
/me points wildly at http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=21950&lngWId=1 which is a post I made 2 years ago. Looks like it's spreading :)
Title: Re:Sounds on Startup
Post by: PaiD on October 09, 2003, 07:54 PM
:D +1 to Storm
Title: Re:Sounds on Startup
Post by: Grok on October 10, 2003, 10:53 AM
Quote from: PaiD on October 09, 2003, 07:54 PM
:D +1 to Storm

Haha.   Dude you're in danger of being listened to.