mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-25 23:05:24 +02:00
store duration with reflection
This commit is contained in:
parent
1869eacf38
commit
fb64e8dd07
@ -117,7 +117,7 @@ Public Class MusicManager
|
|||||||
|
|
||||||
If _fadeIntoIntro Then
|
If _fadeIntoIntro Then
|
||||||
_fadeIntoIntro = False
|
_fadeIntoIntro = False
|
||||||
_introEndTime = Date.Now.AddSeconds(0) + song.Duration
|
_introEndTime = Date.Now.AddSeconds(0) + song.Song.Duration
|
||||||
_isIntroStarted = True
|
_isIntroStarted = True
|
||||||
MediaPlayer.IsRepeating = False
|
MediaPlayer.IsRepeating = False
|
||||||
Else
|
Else
|
||||||
@ -194,7 +194,7 @@ Public Class MusicManager
|
|||||||
' if an intro was playing while the media player was paused, calc its end time
|
' if an intro was playing while the media player was paused, calc its end time
|
||||||
If MediaPlayer.State = MediaState.Paused AndAlso _isIntroStarted Then
|
If MediaPlayer.State = MediaState.Paused AndAlso _isIntroStarted Then
|
||||||
|
|
||||||
_introEndTime = Date.Now + (_currentSong.Duration - MediaPlayer.PlayPosition)
|
_introEndTime = Date.Now + (_currentSong.Song.Duration - MediaPlayer.PlayPosition)
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ Public Class MusicManager
|
|||||||
FadeInto(introSong, fadeSpeed)
|
FadeInto(introSong, fadeSpeed)
|
||||||
Else
|
Else
|
||||||
_isIntroStarted = True
|
_isIntroStarted = True
|
||||||
_introEndTime = Date.Now.AddSeconds(0) + introSong.Duration
|
_introEndTime = Date.Now.AddSeconds(0) + introSong.Song.Duration
|
||||||
Play(introSong)
|
Play(introSong)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
@ -4,12 +4,13 @@ Public Class SongContainer
|
|||||||
|
|
||||||
Public Song As Song
|
Public Song As Song
|
||||||
Public Name As String
|
Public Name As String
|
||||||
Public Duration As TimeSpan
|
|
||||||
|
|
||||||
Public Sub New(song As Song, name As String, duration As TimeSpan)
|
Public Sub New(song As Song, name As String, duration As TimeSpan)
|
||||||
Me.Song = song
|
Me.Song = song
|
||||||
Me.Name = name
|
Me.Name = name
|
||||||
Me.Duration = duration
|
|
||||||
|
Dim durationField = song.GetType().GetField("_duration", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic)
|
||||||
|
durationField.SetValue(song, duration)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
@ -509,7 +509,7 @@
|
|||||||
MediaPlayer.IsRepeating = False
|
MediaPlayer.IsRepeating = False
|
||||||
|
|
||||||
If Not MusicManager.CurrentSong Is Nothing Then
|
If Not MusicManager.CurrentSong Is Nothing Then
|
||||||
Me.duration = MusicManager.CurrentSong.Duration
|
Me.duration = MusicManager.CurrentSong.Song.Duration
|
||||||
Else
|
Else
|
||||||
Me.duration = New TimeSpan(0)
|
Me.duration = New TimeSpan(0)
|
||||||
End If
|
End If
|
||||||
|
Loading…
x
Reference in New Issue
Block a user