I am writing a Visual Novel Game Engine, where the audio loops throughout the game (No DirectX, just Winforms). Every time an anination sequence or a complex paint event happens on the form, the audio pauses, and resumes after the event If I just hold mouse down on close and minimize buttons of the form also, the audio pauses, and resumes after I release. This should ideally have no dependency on the Playing thread, as it is an independent thread looping through audio ...
Private Sub PlayAudio()
wvOut.Volume = vol
Dim prevVol As Single = vol
LoopIt:
wvOut.Play()
While wvOut.PlaybackState = PlaybackState.Playing
Threading.Thread.Sleep(100)
If audMemStr Is Nothing Then Exit Sub
If blkA Is Nothing Then Exit Sub
If wvOut Is Nothing Then Exit Sub
If prevVol <> vol Then
wvOut.Volume = vol
prevVol = vol
End If
If stopAdudio Then
wvOut.Stop()
End If
End While
If wvOut.PlaybackState = PlaybackState.Stopped Then
If stopAdudio Then Exit Sub
If audMemStr Is Nothing Then Exit Sub
If blkA Is Nothing Then Exit Sub
If wvOut Is Nothing Then Exit Sub
blkA.Seek(0, SeekOrigin.Begin)
If stopAdudio = False Then
GoTo LoopIt
End If
End If
End Sub
I am writing a Visual Novel Game Engine, where the audio loops throughout the game (No DirectX, just Winforms). Every time an anination sequence or a complex paint event happens on the form, the audio pauses, and resumes after the event If I just hold mouse down on close and minimize buttons of the form also, the audio pauses, and resumes after I release. This should ideally have no dependency on the Playing thread, as it is an independent thread looping through audio ...