Fixed music crashes

* Fixed crash when trying to play an intro of a battle song that wasn't an ogg
* Fixed crash when trying to resume the music after using the command @music.stop
This commit is contained in:
JappaWakka 2022-02-03 22:20:43 +01:00
parent fbba01d0c4
commit 1d4087aa2a
1 changed files with 3 additions and 5 deletions

View File

@ -63,9 +63,9 @@ Public Class LoopStream
Else Else
If MusicManager._afterBattleIntroSong.AudioType = ".ogg" Then If MusicManager._afterBattleIntroSong.AudioType = ".ogg" Then
_sourceStream = New VorbisWaveReader(MusicManager._afterBattleIntroSong.Song) _sourceStream = New VorbisWaveReader(MusicManager._afterBattleIntroSong.Song)
ElseIf IntroSong.AudioType = ".mp3" Then ElseIf MusicManager._afterBattleIntroSong.AudioType = ".mp3" Then
_sourceStream = New Mp3FileReader(MusicManager._afterBattleIntroSong.Song) _sourceStream = New Mp3FileReader(MusicManager._afterBattleIntroSong.Song)
ElseIf IntroSong.AudioType = ".wma" Then ElseIf MusicManager._afterBattleIntroSong.AudioType = ".wma" Then
_sourceStream = New MediaFoundationReader(MusicManager._afterBattleIntroSong.Song) _sourceStream = New MediaFoundationReader(MusicManager._afterBattleIntroSong.Song)
End If End If
_enableLooping = True _enableLooping = True
@ -334,9 +334,7 @@ Public Class MusicManager
End Sub End Sub
Public Shared Sub [Stop]() Public Shared Sub [Stop]()
If Not outputDevice Is Nothing Then MusicManager.Play(NO_MUSIC, False, 0.0F)
outputDevice.Stop()
End If
_isIntroStarted = False _isIntroStarted = False
End Sub End Sub