mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-28 00:04:33 +02:00
Actually fix the music sharing its volume with the soundeffects
This commit is contained in:
parent
bd290df9bb
commit
620f4d8325
@ -94,8 +94,8 @@ Public Class MusicManager
|
|||||||
Private Shared _isFadingIn As Boolean = False
|
Private Shared _isFadingIn As Boolean = False
|
||||||
' NAudio properties
|
' NAudio properties
|
||||||
Public Shared outputDevice As WaveOutEvent
|
Public Shared outputDevice As WaveOutEvent
|
||||||
Public Shared audioFile As VorbisWaveReader
|
Public Shared audioFile As WaveChannel32
|
||||||
Public Shared _loop As WaveStream
|
Public Shared _loop As WaveStream
|
||||||
|
|
||||||
Public Shared Property MasterVolume As Single = 1.0F
|
Public Shared Property MasterVolume As Single = 1.0F
|
||||||
Public Shared ReadOnly Property CurrentSong As SongContainer
|
Public Shared ReadOnly Property CurrentSong As SongContainer
|
||||||
@ -271,9 +271,9 @@ Public Class MusicManager
|
|||||||
|
|
||||||
Public Shared Sub UpdateVolume()
|
Public Shared Sub UpdateVolume()
|
||||||
_lastVolume = Volume * MasterVolume
|
_lastVolume = Volume * MasterVolume
|
||||||
If Not outputDevice Is Nothing Then
|
If Not audioFile Is Nothing Then
|
||||||
outputDevice.Volume = Volume * MasterVolume
|
audioFile.Volume = Volume * MasterVolume
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Shared Sub PauseForSound(ByVal sound As SoundEffect)
|
Public Shared Sub PauseForSound(ByVal sound As SoundEffect)
|
||||||
@ -310,32 +310,32 @@ Public Class MusicManager
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Shared Sub Play(song As SongContainer)
|
Private Shared Sub Play(song As SongContainer)
|
||||||
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
|
||||||
outputDevice.Dispose()
|
outputDevice.Dispose()
|
||||||
End If
|
End If
|
||||||
outputDevice = New WaveOutEvent()
|
outputDevice = New WaveOutEvent()
|
||||||
audioFile = New VorbisWaveReader(song.Song)
|
audioFile = New NAudio.Wave.WaveChannel32(New VorbisWaveReader(song.Song))
|
||||||
_loop = New LoopStream(audioFile, _isLooping)
|
_loop = New LoopStream(audioFile, _isLooping)
|
||||||
outputDevice.Init(_loop)
|
outputDevice.Init(_loop)
|
||||||
If Paused = False Then
|
If Paused = False Then
|
||||||
outputDevice.Play()
|
outputDevice.Play()
|
||||||
End If
|
End If
|
||||||
outputDevice.Volume = Volume * MasterVolume
|
audioFile.Volume = Volume * MasterVolume
|
||||||
_currentSongExists = True
|
_currentSongExists = True
|
||||||
_currentSongName = song.Name
|
_currentSongName = song.Name
|
||||||
_currentSong = song
|
_currentSong = song
|
||||||
Else
|
Else
|
||||||
_currentSongExists = False
|
_currentSongExists = False
|
||||||
_currentSongName = NO_MUSIC
|
_currentSongName = NO_MUSIC
|
||||||
_currentSong = Nothing
|
_currentSong = Nothing
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Shared Sub FadeInto(song As SongContainer, fadeSpeed As Single)
|
Private Shared Sub FadeInto(song As SongContainer, fadeSpeed As Single)
|
||||||
_isFadingOut = True
|
_isFadingOut = True
|
||||||
If Not song Is Nothing Then
|
If Not song Is Nothing Then
|
||||||
_nextSong = song.Name
|
_nextSong = song.Name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user