: : I trying to get this to work, but it stops before the end of the wav
: : file. This is part of a larger program.
: : I used the same code for several shorter sound effects, ahead of
: : ahead of this one, and those lines work just fine. This is the last
: : line of the program. The wave file is about 9 seconds cut from the
: : original wave file. I am using vb6.0 professional and windows xp.
: : The sound module is as follows:
: :
: : Public Declare Function sndPlaySound Lib "winmm.dll" Alias
: : "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As
: : Long) As Long
: :
: : 'monsters sing
: : Private Sub Timer08_Timer() '500ms
: : Out 888, 176 'turn on automation
: : sndPlaySound App.Path & "\Monster Mash.wav", SND_ASYNC
: : Out 888, 0 'turn off automation
: : Timer08.Enabled = False
: : Utimer01.Enabled = True
: : End Sub
: :
: :
:
: You're playing it asynchronous, so probably a piece of code
: somewhere else is causing it to get cut off mid-song. Or perhaps
: your program terminates before the song has managed to complete? Try
: running through it with the debugger, to see what code is executed
: and where the play stops.
: (BTW, what's Out ?)
: Best Regards,
: Richard
:
: The way I see it... Well, it's all pretty blurry
.
Out is an inpout command to turn on and off one of the Parallel port pins. The operate the automations.
Here,s the compltet program:
'Override 20 minute timer and start program
Private Sub cmdOverride_Click()
utimerCTL1.Enabled = False
Out 888, 1 'Start lightning pulse
Timer01.Enabled = True
End Sub
'Main program start
Private Sub cmdStart_Click()
Out 888, 1 'start lightning pulse
Timer01.Enabled = True
End Sub
'End program
Private Sub cmdStop_Click()
End
End Sub
'Lightning flashes and play thunder wav
Private Sub Timer01_Timer() '20ms
cmdOverride.Caption = "Do Not Press"
Out 888, 0 'Stop lightning pulse
sndPlaySound App.Path & "\Thunder.wav", SND_ASYNC
Timer01.Enabled = False
Out 888, 2 'Start witch head up/eyes on pulse
Timer02.Enabled = True
End Sub
'head up and eyes light and play cackle wav
Private Sub Timer02_Timer() '20ms
Out 888, 0 'Stop witch head up/eyes on pulse
sndPlaySound App.Path & "\Cackle.wav", SND_ASYNC
Timer02.Enabled = False
Out 888, 2 'Start head down and eyes off pulse
Timer03.Enabled = True
End Sub
'Head lowers/eyes off
Private Sub Timer03_Timer() '20ms
Out 888, 0 'Stop head down and eyes off pulse
Timer03.Enabled = False
Timer04.Enabled = True
End Sub
Private Sub Timer04_Timer() '1 Second
Out 888, 4 'Start Toumbstone up pulse
Timer04.Enabled = False
Timer05.Enabled = True
End Sub
'Toumbstone raises
Private Sub Timer05_Timer() '20ms
Out 888, 64 'Stop toumbstone up pules
sndPlaySound App.Path & "\Moan.wav", SND_ASYNC
Timer05.Enabled = False
Out 888, 4 'Start Toumbstone down
Timer06.Enabled = True
End Sub
'Toumbstone lowers
Private Sub Timer06_Timer() '20ms
Out 888, 64 'Stop Toumbstone down pulse
sndPlaySound App.Path & "\Moan2.wav", SND_ASYNC
Timer06.Enabled = False
Timer07.Enabled = True
End Sub
'Skulls Scream
Private Sub Timer07_Timer() '250ms
Out 888, 40 'Timer stops/Screamers start
sndPlaySound App.Path & "\Scream.wav", SND_ASYNC
Out 888, 0 'Screamers stop
Timer07.Enabled = False
Timer08.Enabled = True
End Sub
'monsters sing
Private Sub Timer08_Timer() '500ms
Out 888, 176
sndPlaySound App.Path & "\Monster Mash.wav", SND_ASYNC
Out 888, 0 'System reset
Timer08.Enabled = False
End Sub