Code:
Private Sub Command1_Click()
Chill 5, "CASHREGISTER" ' 5 seconds
End Sub
Sub Chill(seconds As Integer, SoundName As String)
Dim Counter As Integer
seconds = seconds * 1000
If Counter <= seconds Then
Timer1.Enabled = True
Counter = Counter + 1000
sndData = LoadResData(SoundName, "SOUND")
sndPlaySound sndData(0), SND_LOOP Or SND_ASYNC Or SND_MEMORY
If Counter >= seconds Then
Timer1.Enabled = False
sndPlaySound ByVal 0, 0 'stop sound
End If
End If
The sound is loaded from a resource file and it just keeps sounding and doesn't stop