hatch music fix

This commit is contained in:
darkfire006 2020-08-03 00:02:18 -05:00
parent 1a1c935714
commit b58d3411b3

View File

@ -188,7 +188,7 @@ Public Class MusicManager
If Date.Now >= _pausedUntil Then If Date.Now >= _pausedUntil Then
If MusicManager.Paused = True Then If MusicManager.Paused = True Then
_isPausedForSound = False _isPausedForSound = False
ResumePlayback() Paused = False
End If End If
End If End If
Else Else
@ -304,7 +304,6 @@ Public Class MusicManager
_introEndTime = _introEndTime + pauseTime _introEndTime = _introEndTime + pauseTime
End If End If
Paused = False
outputDevice.Play() outputDevice.Play()
End If End If
End If End If
@ -312,7 +311,6 @@ Public Class MusicManager
End Sub End Sub
Private Shared Sub Play(song As SongContainer) Private Shared Sub Play(song As SongContainer)
If _isLooping = True Then
If Not song Is Nothing Then If Not song Is Nothing Then
Logger.Debug($"Play song [{song.Name}]") Logger.Debug($"Play song [{song.Name}]")
If Not outputDevice Is Nothing Then If Not outputDevice Is Nothing Then
@ -320,7 +318,7 @@ Public Class MusicManager
End If End If
outputDevice = New WaveOutEvent() outputDevice = New WaveOutEvent()
audioFile = New VorbisWaveReader(song.Song) audioFile = New VorbisWaveReader(song.Song)
_loop = New LoopStream(audioFile) _loop = New LoopStream(audioFile, _isLooping)
outputDevice.Init(_loop) outputDevice.Init(_loop)
If Paused = False Then If Paused = False Then
outputDevice.Play() outputDevice.Play()
@ -334,30 +332,6 @@ Public Class MusicManager
_currentSongName = NO_MUSIC _currentSongName = NO_MUSIC
_currentSong = Nothing _currentSong = Nothing
End If End If
Else
If Not song Is Nothing Then
Logger.Debug($"Play song [{song.Name}]")
If Not outputDevice Is Nothing Then
outputDevice.Dispose()
End If
outputDevice = New WaveOutEvent()
audioFile = New VorbisWaveReader(song.Song)
_loop = New LoopStream(audioFile, False)
outputDevice.Init(_loop)
If Paused = False Then
outputDevice.Play()
End If
outputDevice.Volume = Volume * MasterVolume
_currentSongExists = True
_currentSongName = song.Name
_currentSong = song
Else
_currentSongExists = False
_currentSongName = NO_MUSIC
_currentSong = Nothing
End If
End If
End Sub End Sub