mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-29 08:45:02 +02:00
Fix bug with music that shouldn't loop still does
This commit is contained in:
parent
53304990f8
commit
22edf29445
@ -41,14 +41,19 @@ Public Class LoopStream
|
|||||||
|
|
||||||
If bytesRead = 0 Then
|
If bytesRead = 0 Then
|
||||||
|
|
||||||
If _enableLooping Then
|
If _enableLooping And MusicManager.EnableLooping = True Then
|
||||||
_sourceStream.Position = 0
|
_sourceStream.Position = 0
|
||||||
Else
|
Else
|
||||||
If Not _sourceStream.Position = 0 Then
|
If Not _sourceStream.Position = 0 Then
|
||||||
If MusicManager.Playlist.Count > 1 Then
|
If MusicManager.Playlist.Count > 1 Then
|
||||||
MusicManager.Playlist.RemoveAt(0)
|
MusicManager.Playlist.RemoveAt(0)
|
||||||
|
ElseIf MusicManager.EnableLooping = False AndAlso MusicManager.Playlist.Count > 0 Then
|
||||||
|
MusicManager.Playlist.RemoveAt(0)
|
||||||
|
End If
|
||||||
|
Dim NextSong As SongContainer = Nothing
|
||||||
|
If MusicManager.Playlist.Count > 0 Then
|
||||||
|
NextSong = MusicManager.Playlist(0)
|
||||||
End If
|
End If
|
||||||
Dim NextSong As SongContainer = MusicManager.Playlist(0)
|
|
||||||
If NextSong IsNot Nothing Then
|
If NextSong IsNot Nothing Then
|
||||||
Logger.Debug($"Play song [{NextSong.Name}]")
|
Logger.Debug($"Play song [{NextSong.Name}]")
|
||||||
_sourceStream.Dispose()
|
_sourceStream.Dispose()
|
||||||
@ -141,6 +146,7 @@ Public Class MusicManager
|
|||||||
Public Shared audioFileMP3 As Mp3FileReader
|
Public Shared audioFileMP3 As Mp3FileReader
|
||||||
Public Shared audioFileWMA As MediaFoundationReader
|
Public Shared audioFileWMA As MediaFoundationReader
|
||||||
Public Shared _stream As WaveChannel32
|
Public Shared _stream As WaveChannel32
|
||||||
|
Public Shared EnableLooping As Boolean = True
|
||||||
|
|
||||||
Public Shared Property PauseVolume As Single = 1.0F
|
Public Shared Property PauseVolume As Single = 1.0F
|
||||||
Public Shared Property MasterVolume As Single = 1.0F
|
Public Shared Property MasterVolume As Single = 1.0F
|
||||||
@ -301,6 +307,7 @@ Public Class MusicManager
|
|||||||
'End If
|
'End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Core.GameInstance.IsActive AndAlso _lastVolume <> (Volume * PauseVolume * MasterVolume) Then
|
If Core.GameInstance.IsActive AndAlso _lastVolume <> (Volume * PauseVolume * MasterVolume) Then
|
||||||
UpdateVolume()
|
UpdateVolume()
|
||||||
End If
|
End If
|
||||||
@ -410,6 +417,7 @@ Public Class MusicManager
|
|||||||
Dim playedSong As SongContainer = Nothing
|
Dim playedSong As SongContainer = Nothing
|
||||||
|
|
||||||
' get the current song, only play if it's different
|
' get the current song, only play if it's different
|
||||||
|
|
||||||
Dim currentSong = GetCurrentSong().ToLowerInvariant()
|
Dim currentSong = GetCurrentSong().ToLowerInvariant()
|
||||||
Dim songName = GetSongName(song)
|
Dim songName = GetSongName(song)
|
||||||
Dim AfterBattleIntroSongName As String = GetSongName(AfterBattleIntroSong)
|
Dim AfterBattleIntroSongName As String = GetSongName(AfterBattleIntroSong)
|
||||||
@ -475,7 +483,7 @@ Public Class MusicManager
|
|||||||
_isIntroStarted = False
|
_isIntroStarted = False
|
||||||
_isFadingIn = False
|
_isFadingIn = False
|
||||||
End If
|
End If
|
||||||
|
EnableLooping = loopSong
|
||||||
' intro was not requested or does not exist
|
' intro was not requested or does not exist
|
||||||
If Not _isIntroStarted AndAlso Not _isFadingIn AndAlso AfterBattleIntroSongName = "" Then
|
If Not _isIntroStarted AndAlso Not _isFadingIn AndAlso AfterBattleIntroSongName = "" Then
|
||||||
Playlist.Clear()
|
Playlist.Clear()
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
If argument.Split(",").Length > 1 Then
|
If argument.Split(",").Length > 1 Then
|
||||||
LoopSong = CBool(argument.GetSplit(1, ","))
|
LoopSong = CBool(argument.GetSplit(1, ","))
|
||||||
End If
|
End If
|
||||||
MusicManager.Play(argument.GetSplit(0, ","), LoopSong, LoopSong)
|
MusicManager.Play(argument.GetSplit(0, ","), True, LoopSong)
|
||||||
|
|
||||||
If LoopSong = True Then
|
If LoopSong = True Then
|
||||||
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
@ -33,7 +33,7 @@
|
|||||||
LoopSong = CBool(argument.GetSplit(1, ","))
|
LoopSong = CBool(argument.GetSplit(1, ","))
|
||||||
End If
|
End If
|
||||||
MusicManager.ForceMusic = argument.GetSplit(0, ",")
|
MusicManager.ForceMusic = argument.GetSplit(0, ",")
|
||||||
MusicManager.Play(argument.GetSplit(0, ","), LoopSong, LoopSong)
|
MusicManager.Play(argument.GetSplit(0, ","), True, LoopSong)
|
||||||
|
|
||||||
If LoopSong = True Then
|
If LoopSong = True Then
|
||||||
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
If Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user