From 4784e57370ae272a445666d89b5915644cd8de7a Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Wed, 4 Oct 2017 13:12:14 +0200 Subject: [PATCH 01/37] Refactored mutex use while closing streams in CPortAudioHandle (should fix #320) --- Vocaluxe/Lib/Sound/CPortAudioHandle.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs index 217afafa..6443a8cb 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs @@ -74,12 +74,14 @@ namespace Vocaluxe.Lib.Sound } lock (_Mutex) { + if (_Disposed) + return; Debug.Assert(_RefCount > 0); _RefCount--; if (_RefCount == 0) PortAudio.Pa_Terminate(); + _Disposed = true; } - _Disposed = true; } public void Dispose() @@ -100,11 +102,11 @@ namespace Vocaluxe.Lib.Sound double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags, PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData) { - if (_Disposed) - throw new ObjectDisposedException("PortAudioHandle already disposed"); - lock (_Mutex) { + if (_Disposed) + throw new ObjectDisposedException("PortAudioHandle already disposed"); + PortAudio.PaError res = PortAudio.Pa_OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback, userData); if (res == PortAudio.PaError.paNoError) @@ -157,11 +159,11 @@ namespace Vocaluxe.Lib.Sound public void CloseStream(IntPtr stream) { - if (_Disposed) - throw new ObjectDisposedException("PortAudioHandle already disposed"); - lock (_Mutex) { + if (_Disposed) + throw new ObjectDisposedException("PortAudioHandle already disposed"); + PortAudio.Pa_CloseStream(stream); _Streams.Remove(stream); } From ad5ffd7578736cfe45b0a9dc5bfa94ecc44dc46f Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Wed, 4 Oct 2017 14:20:31 +0200 Subject: [PATCH 02/37] Catch potential errors from PortAudio Close() and Dispose() --- Vocaluxe/Lib/Sound/CPortAudioHandle.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs index 6443a8cb..81c4d9b0 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs @@ -79,7 +79,16 @@ namespace Vocaluxe.Lib.Sound Debug.Assert(_RefCount > 0); _RefCount--; if (_RefCount == 0) - PortAudio.Pa_Terminate(); + { + try + { + PortAudio.Pa_Terminate(); + } + catch (Exception ex) + { + CLog.LogError(errorText: $"Error disposing PortAudio: {ex.Message}", e: ex); + } + } _Disposed = true; } } @@ -164,7 +173,14 @@ namespace Vocaluxe.Lib.Sound if (_Disposed) throw new ObjectDisposedException("PortAudioHandle already disposed"); - PortAudio.Pa_CloseStream(stream); + try + { + PortAudio.Pa_CloseStream(stream); + } + catch (Exception ex) + { + CLog.LogError(errorText:$"Error closing stream: {ex.Message}", e:ex); + } _Streams.Remove(stream); } } From df34766f353cef0ece17bedf5677cb81dd5d967f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 8 Oct 2017 12:40:59 +0200 Subject: [PATCH 03/37] Fixed aspect of avatars --- PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs | 1 + PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs | 3 +++ Vocaluxe/Screens/CScreenScore.cs | 3 +++ VocaluxeLib/Menu/CSelectSlide.cs | 1 + 4 files changed, 8 insertions(+) diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 5e10bcff..77a5eb88 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -125,6 +125,7 @@ namespace VocaluxeLib.PartyModes.Challenge _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer])); _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); + _NextPlayerStatics[_NextPlayerStatics.Count - 1].Aspect = EAspect.Crop; } _Statics[_StaticNextPlayer].Visible = false; } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 35f45351..0588abeb 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -98,6 +98,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe _CreateFields(); _Buttons[_ButtonField].Visible = false; + + _Statics[_StaticAvatarT1].Aspect = EAspect.Crop; + _Statics[_StaticAvatarT2].Aspect = EAspect.Crop; } public override bool HandleInput(SKeyEvent keyEvent) diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 2f4f564a..249198ef 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -139,6 +139,9 @@ namespace Vocaluxe.Screens _SetVisibility(); _UpdateRatings(); _SlideShowBG.Visible = _UpdateBackground(); + + for (int p = 0; p < CGame.NumPlayers; p++) + _Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop; } public override bool UpdateGame() diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index fa6310b2..f9fef6a2 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -586,6 +586,7 @@ namespace VocaluxeLib.Menu Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID), Img = new CStatic(_PartyModeID) }; + el.Img.Aspect = EAspect.Crop; _VisibleElements.Add(el); } } From 85ad6050f80f9c125d08ebdef1dc0f0c3ef16dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 8 Oct 2017 12:56:16 +0200 Subject: [PATCH 04/37] Fixed lyrics visibility (closes #322) --- Vocaluxe/Screens/CScreenSing.cs | 49 +++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 7bf7e042..c082e1bd 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -611,35 +611,38 @@ namespace Vocaluxe.Screens private void _SetDuetLyricsVisibility(bool isDuet) { - _Statics[_StaticLyricsDuet].Visible = isDuet; - _Lyrics[_LyricMainDuet].Visible = isDuet; - _Lyrics[_LyricSubDuet].Visible = isDuet; - - if (isDuet) - { - _Lyrics[_LyricMainTop].Visible = false; - _Lyrics[_LyricSubTop].Visible = false; - _Statics[_StaticLyricsTop].Visible = false; - } - else - { - bool lyricsOnTop = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP - || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH - || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); - _Lyrics[_LyricMainTop].Visible = lyricsOnTop; - _Lyrics[_LyricSubTop].Visible = lyricsOnTop; - _Statics[_StaticLyricsTop].Visible = lyricsOnTop; - } } private void _SetNormalLyricsVisibility() { - bool visible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM + bool bottomLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); - _Lyrics[_LyricMain].Visible = visible; - _Lyrics[_LyricSub].Visible = visible; - _Statics[_StaticLyrics].Visible = visible; + + bool topLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP + || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH + || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); + + bool duetLyricsVisible = false; + + if (CGame.GetSong() != null && CGame.GetSong().IsDuet) + { + bottomLyricsVisible = true; + topLyricsVisible = false; + duetLyricsVisible = true; + } + + _Lyrics[_LyricMain].Visible = bottomLyricsVisible; + _Lyrics[_LyricSub].Visible = bottomLyricsVisible; + _Statics[_StaticLyrics].Visible = bottomLyricsVisible; + + _Lyrics[_LyricMainTop].Visible = topLyricsVisible; + _Lyrics[_LyricSubTop].Visible = topLyricsVisible; + _Statics[_StaticLyricsTop].Visible = topLyricsVisible; + + _Lyrics[_LyricMainDuet].Visible = duetLyricsVisible; + _Lyrics[_LyricSubDuet].Visible = duetLyricsVisible; + _Statics[_StaticLyricsDuet].Visible = duetLyricsVisible; } private void _StartSong() From 8244fd638b2b049a04729e0f3b44bddc33a6eebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 8 Oct 2017 12:56:37 +0200 Subject: [PATCH 05/37] Log missing avatar as error instead of throwing exceptions --- VocaluxeLib/Profile/CProfile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VocaluxeLib/Profile/CProfile.cs b/VocaluxeLib/Profile/CProfile.cs index 2e168b97..828c2f1c 100644 --- a/VocaluxeLib/Profile/CProfile.cs +++ b/VocaluxeLib/Profile/CProfile.cs @@ -67,7 +67,7 @@ namespace VocaluxeLib.Profile { Avatar = CBase.Profiles.GetAvatarByFilename(value); if (Avatar == null) - throw new Exception("Avatar '" + value + "' not found"); + CBase.Log.LogError("Avatar '" + value + "' not found"); } } From 4d754c0876ef354b8516e77ccd3776206d2e6bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 8 Oct 2017 12:59:46 +0200 Subject: [PATCH 06/37] Forget to remove a function... --- Vocaluxe/Screens/CScreenSing.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index c082e1bd..2a0fa1b9 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -201,8 +201,6 @@ namespace Vocaluxe.Screens CConfig.Config.Theme.PlayerInfo = (EPlayerInfo)mode; CConfig.SaveConfig(); _SetVisibility(); - if (CGame.GetSong() != null) - _SetDuetLyricsVisibility(CGame.GetSong().IsDuet); //make sure duet lyrics remain visible break; case Keys.S: @@ -596,7 +594,6 @@ namespace Vocaluxe.Screens _DynamicLyricsTop = true; } - _SetDuetLyricsVisibility(song.IsDuet); _SetNormalLyricsVisibility(); _TimerSongText.Reset(); @@ -609,10 +606,6 @@ namespace Vocaluxe.Screens _StartSong(); } - private void _SetDuetLyricsVisibility(bool isDuet) - { - } - private void _SetNormalLyricsVisibility() { bool bottomLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM From 3e0eec829422c0f7ff747b00530438e77febc98a Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sat, 4 Nov 2017 14:58:48 +0100 Subject: [PATCH 07/37] Synchronize access to _PreviewStartHelperTask object (may fixes #330) --- Vocaluxe/Base/CBackgroundMusic.cs | 64 ++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 65165cf4..f9146f12 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -51,6 +51,7 @@ namespace Vocaluxe.Base private static Task _PreviewStartHelperTask; private static int _PreviewStartWaitCounter; private const int _PreviewStartWaitMaxTries = 10; + private static readonly object _PreviewStartHelperTaskLock = new Object(); public static bool VideoEnabled { @@ -256,10 +257,17 @@ namespace Vocaluxe.Base { if (_PreviewStartHelperTask != null && ( _PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries)) { - _PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext()); - _PreviewStartHelperTask.Dispose(); - _PreviewStartHelperTask = null; - _PreviewStartWaitCounter = 0; + lock (_PreviewStartHelperTaskLock) + { + // Recheck the condition as it cloud have change before we got the lock + if (_PreviewStartHelperTask != null && (_PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries)) + { + _PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext()); + _PreviewStartHelperTask.Dispose(); + _PreviewStartHelperTask = null; + _PreviewStartWaitCounter = 0; + } + } } if (!IsPlaying) @@ -317,28 +325,46 @@ namespace Vocaluxe.Base //Change song position only if song is changed or near to end if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length) { - _PreviewStartHelperTask = new Task(() => + lock (_PreviewStartHelperTaskLock) { - float length = _PreviewPlayer.Length; - if (length < 1) - length = 30; // If length is unknow or invalid assume a length of 30s + // Check if the old _PreviewStartHelperTask needs to disposed + if (_PreviewStartHelperTask != null) + { + _PreviewStartHelperTask.Dispose(); + } + _PreviewStartHelperTask = new Task(() => + { + float length = _PreviewPlayer.Length; + if (length < 1) + length = 30; // If length is unknow or invalid assume a length of 30s - if (start < 0) - start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime; - if (start > length - 5f) - start = Math.Max(0f, Math.Min(length / 4f, length - 5f)); - if (start >= 0.5f) - start -= 0.5f; + if (start < 0) + start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime; + if (start > length - 5f) + start = Math.Max(0f, Math.Min(length / 4f, length - 5f)); + if (start >= 0.5f) + start -= 0.5f; - _PreviewPlayer.Position = start; - Play(); - }); + _PreviewPlayer.Position = start; + Play(); + }); + } _CurPlayer = _PreviewPlayer; } else { - _PreviewStartHelperTask.Dispose(); - _PreviewStartHelperTask = null; + if (_PreviewStartHelperTask != null) + { + lock (_PreviewStartHelperTaskLock) + { + // Recheck the condition as it cloud have change before we got the lock + if (_PreviewStartHelperTask != null) + { + _PreviewStartHelperTask.Dispose(); + _PreviewStartHelperTask = null; + } + } + } _PreviewPlayer.Position = _CurPlayer.Position; _CurPlayer = _PreviewPlayer; Play(); From a92353c9a2dab0cce7d97cb62be6dc05d937905f Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sat, 4 Nov 2017 19:34:55 +0100 Subject: [PATCH 08/37] Try to fix exceptions while closing Vocaluxe (during closing bg video) (may fixes #320) --- Vocaluxe/Base/CMain.cs | 27 ++++++- Vocaluxe/Base/CVideo.cs | 73 +++++++++++++++++++ .../Record/PortAudio/CPortAudioRecord.cs | 16 +++- 3 files changed, 110 insertions(+), 6 deletions(-) diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 3a131649..b8ec6bfe 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -822,7 +822,14 @@ namespace Vocaluxe.Base public void Close(ref CVideoStream stream) { - CVideo.Close(ref stream); + try + { + CVideo.Close(ref stream); + } + catch (NotSupportedException e) + { + CLog.LogError($"Clould not close the background video: {e.Message}"); + } } public void SetLoop(CVideoStream stream, bool loop = true) @@ -832,12 +839,26 @@ namespace Vocaluxe.Base public void Pause(CVideoStream stream) { - CVideo.Pause(stream); + try + { + CVideo.Pause(stream); + } + catch (NotSupportedException e) + { + CLog.LogError($"Clould not pause the background video: {e.Message}"); + } } public void Resume(CVideoStream stream) { - CVideo.Resume(stream); + try + { + CVideo.Resume(stream); + } + catch (NotSupportedException e) + { + CLog.LogError($"Clould not resume the background video: {e.Message}"); + } } } diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index d9400cc8..d9af124b 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -15,6 +15,7 @@ // along with Vocaluxe. If not, see . #endregion +using System; using Vocaluxe.Lib.Video; using VocaluxeLib; @@ -61,6 +62,10 @@ namespace Vocaluxe.Base public static CVideoStream Load(string videoFileName) { + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } return _VideoDecoder.Load(videoFileName); } @@ -73,41 +78,109 @@ namespace Vocaluxe.Base public static float GetLength(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.GetLength(stream); } public static bool GetFrame(CVideoStream stream, float time) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.GetFrame(stream, time); } public static bool Skip(CVideoStream stream, float start, float gap) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.Skip(stream, start, gap); } public static void SetLoop(CVideoStream stream, bool loop) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.SetLoop(stream, loop); } public static void Pause(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.Pause(stream); } public static void Resume(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.Resume(stream); } public static bool Finished(CVideoStream stream) { + if (stream == null) + { + throw new ArgumentException("stream is null"); + } + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + return _VideoDecoder.Finished(stream); } public static void Update() { + if (_VideoDecoder == null) + { + throw new NotSupportedException("_VideoDecoder is null (already closed?)"); + } + _VideoDecoder.Update(); } #endregion Interface diff --git a/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs index 4702e400..cfc8818c 100644 --- a/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/Record/PortAudio/CPortAudioRecord.cs @@ -16,6 +16,8 @@ #endregion using System; +using System.Collections.Generic; +using System.Linq; using System.Runtime.InteropServices; using System.Threading; using Vocaluxe.Base; @@ -142,9 +144,13 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio foreach (IntPtr handle in _RecHandle) { - PortAudioSharp.PortAudio.Pa_StopStream(handle); - PortAudioSharp.PortAudio.Pa_CloseStream(handle); + if (handle != IntPtr.Zero) + { + PortAudioSharp.PortAudio.Pa_StopStream(handle); + PortAudioSharp.PortAudio.Pa_CloseStream(handle); + } } + _RecHandle = new IntPtr[_Devices.Count]; return true; } @@ -153,13 +159,17 @@ namespace Vocaluxe.Lib.Sound.Record.PortAudio /// public override void Close() { - if (_RecHandle != null) + if (_RecHandle != null && _RecHandle.Length > 0) { foreach (IntPtr handle in _RecHandle) { if (handle != IntPtr.Zero) + { _PaHandle.CloseStream(handle); + } } + + _RecHandle = new IntPtr[_Devices.Count]; } if (_PaHandle != null) { From 79bbcbdccb0eb54f2b8e1e6f0090ffd6a404c48d Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sat, 4 Nov 2017 19:47:47 +0100 Subject: [PATCH 09/37] Try to close the other modules correctly if a single one fails to close ( on program shutdown) --- Vocaluxe/Program.cs | 99 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index d18660db..136508fd 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -285,23 +285,120 @@ namespace Vocaluxe try { CController.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CController)", false, false, e); + } + + try + { CVocaluxeServer.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CVocaluxeServer)", false, false, e); + } + + try + { CGraphics.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CGraphics)", false, false, e); + } + + try + { CThemes.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CThemes)", false, false, e); + } + + try + { CCover.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CCover)", false, false, e); + } + + try + { CFonts.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CFonts)", false, false, e); + } + + try + { CBackgroundMusic.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CBackgroundMusic)", false, false, e); + } + + try + { CWebcam.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CWebcam)", false, false, e); + } + + try + { CDataBase.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CDataBase)", false, false, e); + } + + try + { CVideo.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CVideo)", false, false, e); + } + + try + { CRecord.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CRecord)", false, false, e); + } + + try + { CSound.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown! (CSound)", false, false, e); + } + + try + { CDraw.Close(); } catch (Exception e) { - CLog.LogError("Error during shutdown!", false, false, e); + CLog.LogError("Error during shutdown! (CDraw)", false, false, e); } + GC.Collect(); // Do a GC run here before we close logs to have finalizers run try { From 52f1b8f5463fb45bceb70b31e76a5f047288d362 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sat, 4 Nov 2017 20:13:19 +0100 Subject: [PATCH 10/37] Fix: Vocaluxe crashes when _CopyDecodedFrameToBuffer() fails --- Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs b/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs index 38275210..3d7229d0 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs @@ -429,7 +429,18 @@ namespace Vocaluxe.Lib.Video.Acinerella private bool _CopyDecodedFrameToBuffer() { bool result; - var decoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder)); + SACDecoder decoder; + + try + { + decoder = (SACDecoder)Marshal.PtrToStructure(_Videodecoder, typeof(SACDecoder)); + } + catch (Exception e) + { + CLog.LogError("Couldn't copy the frame to the managed environment.", false, false, e); + return false; + } + if (decoder.Buffer != IntPtr.Zero) { _LastDecodedTime = (float)decoder.Timecode; From ce4529325bc1e8eec642a2c0ebbf1f40770c105e Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 6 Nov 2017 10:08:06 +0100 Subject: [PATCH 11/37] Fix: exception when intro video is missing --- Vocaluxe/Base/CVideoPlayer.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Base/CVideoPlayer.cs b/Vocaluxe/Base/CVideoPlayer.cs index 3e0762f6..1f451396 100644 --- a/Vocaluxe/Base/CVideoPlayer.cs +++ b/Vocaluxe/Base/CVideoPlayer.cs @@ -53,6 +53,10 @@ namespace Vocaluxe.Base { _VideoTimer.Reset(); _Finished = false; + if (_VideoStream == null) + { + return; + } //CVideo.VdSkip(_VideoStream, 0f, 0f); _VideoTimer.Start(); CVideo.Resume(_VideoStream); @@ -60,12 +64,19 @@ namespace Vocaluxe.Base public void Pause() { - CVideo.Pause(_VideoStream); + if (_VideoStream != null) + { + CVideo.Pause(_VideoStream); + } _VideoTimer.Stop(); } public void Resume() { + if (_VideoStream == null) + { + return; + } CVideo.Resume(_VideoStream); _VideoTimer.Start(); } @@ -92,7 +103,7 @@ namespace Vocaluxe.Base public void PreLoad() { - if (!_Loaded) + if (!_Loaded || _VideoStream == null) { return; } @@ -111,7 +122,10 @@ namespace Vocaluxe.Base public void Close() { - CVideo.Close(ref _VideoStream); + if (_VideoStream != null) + { + CVideo.Close(ref _VideoStream); + } _Loaded = false; _Finished = false; _VideoTimer.Reset(); From 06d6be528a0c35181edf41b130000bcd0b7e4519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 16 Nov 2017 12:26:38 +0100 Subject: [PATCH 12/37] Fixed wrong song folder path that leads to not working folder-sorting --- Vocaluxe/Base/CConfig.cs | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 7db2f250..1b7fde8e 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -191,13 +191,14 @@ namespace Vocaluxe.Base public static event OnSongMenuChanged SongMenuChanged; //Folders + //We need full path for folders for matching folder path with textfile path when loading public static readonly List SongFolders = new List { #if INSTALLER Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs), - CSettings.FolderNameSongs + Path.Combine(CSettings.ProgramFolder, FolderNameSongs) #elif WIN - CSettings.FolderNameSongs + Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameSongs) #elif LINUX Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs) #endif @@ -335,15 +336,8 @@ namespace Vocaluxe.Base else Config = xml.DeserializeString(""); - if (Config.Game.SongFolder.Length > 0 && Config.Game.SongFolder[0] != "") - { - SongFolders.Clear(); - SongFolders.AddRange(Config.Game.SongFolder); - } - else - { - Config.Game.SongFolder = SongFolders.ToArray(); - } + NormalizeSongPaths(); + if ((Config.Game.ScoreAnimationTime > 0 && Config.Game.ScoreAnimationTime < 1) || Config.Game.ScoreAnimationTime < 0) Config.Game.ScoreAnimationTime = 1; @@ -625,6 +619,29 @@ namespace Vocaluxe.Base return false; } + /// + /// Set song path if none is find in config and check if every path exists + /// + public static void NormalizeSongPaths() + { + //Check if there are configured songfolders + if (Config.Game.SongFolder.Length > 0 && Config.Game.SongFolder[0] != "") + { + SongFolders.Clear(); + + foreach (string folder in Config.Game.SongFolder) + { + //Check if folder exists + if (Directory.Exists(folder)) + SongFolders.Add(folder); + } + } + + //Test if songfolders are still empty or now empty + if(Config.Game.SongFolder.Length == 0) + Config.Game.SongFolder = SongFolders.ToArray(); + } + /// /// Load command-line-parameters and their values to lists. /// From 7dbd2363dbf59d81f2cb5d675d86f1b03961d5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Tue, 21 Nov 2017 09:49:45 +0100 Subject: [PATCH 13/37] Fix: Points were assigned to not sung songs --- Vocaluxe/Screens/CScreenSing.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 2a0fa1b9..4fdc3e76 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -651,7 +651,10 @@ namespace Vocaluxe.Screens { //Need this to set other songs to points-var while (!CGame.IsFinished()) + { CGame.NextRound(); + CGame.ResetPlayer(); + } _FinishedSinging(); } From b8fb0d754946ef63187ba03c03aca1286005eab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Wed, 22 Nov 2017 20:12:22 +0100 Subject: [PATCH 14/37] Make reading HighscoreDB more robust if song entries are incomplete --- Vocaluxe/Lib/Database/CHighscoreDB.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Vocaluxe/Lib/Database/CHighscoreDB.cs b/Vocaluxe/Lib/Database/CHighscoreDB.cs index 35e9fe87..1e0026b5 100644 --- a/Vocaluxe/Lib/Database/CHighscoreDB.cs +++ b/Vocaluxe/Lib/Database/CHighscoreDB.cs @@ -463,10 +463,19 @@ namespace Vocaluxe.Lib.Database if (reader != null && reader.HasRows) { reader.Read(); - artist = reader.GetString(0); - title = reader.GetString(1); - numPlayed = reader.GetInt32(2); - dateAdded = new DateTime(reader.GetInt64(3)); + + if (!reader.IsDBNull(0)) + artist = reader.GetString(0); + + if (!reader.IsDBNull(1)) + title = reader.GetString(1); + + if (!reader.IsDBNull(2)) + numPlayed = reader.GetInt32(2); + + if (!reader.IsDBNull(3)) + dateAdded = new DateTime(reader.GetInt64(3)); + reader.Dispose(); return true; } From d7e924b72bd1d7dc171bdde2aca00e445935d187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 23 Nov 2017 16:50:07 +0100 Subject: [PATCH 15/37] Fixed installer file names --- Installer/setup.aip | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Installer/setup.aip b/Installer/setup.aip index 1309ecc0..cf17cbd8 100644 --- a/Installer/setup.aip +++ b/Installer/setup.aip @@ -3765,8 +3765,8 @@ - - + + From 1baed149afc4987d395f1fb3f0b46f5fcfbfab6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 23 Nov 2017 16:54:30 +0100 Subject: [PATCH 16/37] Updated AdvancedInstaller version --- Installer/setup.aip | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Installer/setup.aip b/Installer/setup.aip index cf17cbd8..afe22b95 100644 --- a/Installer/setup.aip +++ b/Installer/setup.aip @@ -1,5 +1,5 @@ - + @@ -18,7 +18,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -4032,8 +4032,8 @@ - - - + + + From feb5c1eaed39d5c0c8414fbad1028e170f0a3380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Fri, 1 Dec 2017 16:41:21 +0100 Subject: [PATCH 17/37] Fix: PartyNameSelection visibility of team increase/decrease button --- VocaluxeLib/Menu/CMenuPartyNameSelection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index cc01f135..b4953cde 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -699,8 +699,8 @@ namespace VocaluxeLib.Menu private void _UpdateButtonVisibility() { - _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; - _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; + _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangeTeamNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; + _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangeTeamNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams; _Buttons[_ButtonIncreasePlayer].Visible = _AllowChangePlayerNum; _Buttons[_ButtonDecreasePlayer].Visible = _AllowChangePlayerNum; } From 7fdbd8780bb0d9670add94a4ece1079cd54b5ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Fri, 1 Dec 2017 17:14:28 +0100 Subject: [PATCH 18/37] Fixed updating team-slide in PartyNameSelection --- VocaluxeLib/Menu/CMenuPartyNameSelection.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index b4953cde..2fb514ef 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -593,6 +593,7 @@ namespace VocaluxeLib.Menu } } _UpdateButtonState(); + _UpdateTeamSlide(); } public void DecreaseTeamNum() @@ -603,6 +604,7 @@ namespace VocaluxeLib.Menu if (_NumTeams - 1 >= _PartyMode.MinTeams) _NumTeams--; _UpdateButtonState(); + _UpdateTeamSlide(); } public void IncreasePlayerNum(int team) From 5296627f8dab6da96cfb4d3908605e904e476e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sat, 2 Dec 2017 16:45:41 +0100 Subject: [PATCH 19/37] Fixed converting Ultrastar.db --- Vocaluxe/Lib/Database/CHighscoreDB.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Lib/Database/CHighscoreDB.cs b/Vocaluxe/Lib/Database/CHighscoreDB.cs index 1e0026b5..981bce4b 100644 --- a/Vocaluxe/Lib/Database/CHighscoreDB.cs +++ b/Vocaluxe/Lib/Database/CHighscoreDB.cs @@ -613,7 +613,7 @@ namespace Vocaluxe.Lib.Database { //Check for USDX 1.1 DB _CreateHighscoreDBV1(filePath); - result &= !_ConvertFrom110(filePath); + result &= _ConvertFrom110(filePath); result &= _UpdateDatabase(1, connection); result &= _UpdateDatabase(2, connection); } @@ -927,7 +927,7 @@ namespace Vocaluxe.Lib.Database if (currentVersion < 2) updated &= _ConvertV1toV2(connection); - if (currentVersion < 3) + else if (currentVersion < 3) updated &= _ConvertV2toV3(connection); return updated; From e9abec565d8f171ad4b32776d864946c4ca87dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sat, 2 Dec 2017 21:57:22 +0100 Subject: [PATCH 20/37] Removed unused tables after converting Ultrastar.db --- Vocaluxe/Lib/Database/CHighscoreDB.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Lib/Database/CHighscoreDB.cs b/Vocaluxe/Lib/Database/CHighscoreDB.cs index 981bce4b..c6683788 100644 --- a/Vocaluxe/Lib/Database/CHighscoreDB.cs +++ b/Vocaluxe/Lib/Database/CHighscoreDB.cs @@ -742,13 +742,22 @@ namespace Vocaluxe.Lib.Database transaction.Commit(); //Delete old tables after conversion - command.CommandText = "DROP TABLE US_Scores;"; + command.CommandText = "DROP TABLE IF EXISTS us_scores;"; command.ExecuteNonQuery(); - command.CommandText = "DROP TABLE US_Songs;"; + command.CommandText = "DROP TABLE IF EXISTS us_songs;"; command.ExecuteNonQuery(); - command.CommandText = "DROP TABLE us_statistics_info;"; + command.CommandText = "DROP TABLE IF EXISTS us_statistics_info;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_users_info;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_webs;"; + command.ExecuteNonQuery(); + + command.CommandText = "DROP TABLE IF EXISTS us_webs_stats;"; command.ExecuteNonQuery(); //This versioning is not used in Vocaluxe so reset it to 0 From 7f3d9c5f411e84821824f9fdf9601b38aa60830f Mon Sep 17 00:00:00 2001 From: Jiiniasu Date: Sat, 2 Dec 2017 15:46:24 +0100 Subject: [PATCH 21/37] Fix: Button SelColor Correctly set Selcolor when creating one based on an existing button. --- VocaluxeLib/Menu/CButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index b0ca4a48..ee77d7aa 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -135,7 +135,7 @@ namespace VocaluxeLib.Menu MaxRect = button.MaxRect; Color = button.Color; - SelColor = button.Color; + SelColor = button.SelColor; Texture = button.Texture; SelTexture = button.SelTexture; From 064b5412a6fc0c750bfff970772c7353b8f392ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 3 Dec 2017 12:38:50 +0100 Subject: [PATCH 22/37] Fix: Increase team number in PartyNameSelction --- VocaluxeLib/Menu/CMenuPartyNameSelection.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index 2fb514ef..063d3b12 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -15,6 +15,7 @@ // along with Vocaluxe. If not, see . #endregion +using System; using System.Collections.Generic; using System.Windows.Forms; using VocaluxeLib.Draw; @@ -587,7 +588,9 @@ namespace VocaluxeLib.Menu } else { - _NumPlayerTeams[i] = _NumPlayer; + //Get average num players per teams as default player number + _NumPlayerTeams[i] = _NumPlayer/(_NumTeams - 1); + _NumPlayer += _NumPlayerTeams[i]; _TeamList[i] = new List(); } } @@ -693,10 +696,14 @@ namespace VocaluxeLib.Menu private void _UpdateTeamSlide() { + int sel = _SelectSlides[_SelectSlideTeams].Selection; + _SelectSlides[_SelectSlideTeams].Visible = _Teams; _SelectSlides[_SelectSlideTeams].Clear(); for (int i = 1; i <= _NumTeams; i++) _SelectSlides[_SelectSlideTeams].AddValue("Team " + i, null, i); + + _SelectSlides[_SelectSlideTeams].Selection = Math.Min(sel, _SelectSlides[_SelectSlideTeams].NumValues - 1); } private void _UpdateButtonVisibility() From 60a6f8d3476c34e1fe31ce3a7e37afe1d27fb01e Mon Sep 17 00:00:00 2001 From: Pr3di Date: Fri, 17 Nov 2017 19:26:36 +0100 Subject: [PATCH 23/37] NullPointerException abgefangen (cherry picked from commit 6782f5104a25c0f346f7f913762de36c071c8a9f) --- Vocaluxe/Base/CBackgroundMusic.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index f9146f12..b8768aa7 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -323,7 +323,7 @@ namespace Vocaluxe.Base //Change song position only if song is changed or near to end - if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length) + if (songChanged || _CurPlayer.Position + 30 < _CurPlayer.Length || _PreviewStartHelperTask == null) { lock (_PreviewStartHelperTaskLock) { From 9599c1a616a942e3dbab883637d7f833c19e7aa0 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Thu, 21 Dec 2017 15:08:12 +0100 Subject: [PATCH 24/37] Fix: meaningless "Could not query position" messages in the log --- .../CGstreamerSharpAudioStream.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs index 0808b506..452056d0 100644 --- a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs +++ b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs @@ -70,14 +70,20 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp { get { - if (_Element != null) + + if (_Element == null || (_Element.CurrentState == State.Paused && _Element.PendingState != State.VoidPending)) { - long position; - if (!_Element.QueryPosition(Format.Time, out position)) - CLog.LogError("Could not query position"); - else - _Position = ((float)position / Constants.SECOND); + return _Position; } + + + long position; + if (!_Element.QueryPosition(Format.Time, out position)) + CLog.LogError("Could not query position"); + else + _Position = ((float)position / Constants.SECOND); + + return _Position; } set From e99f1adfae220ec00e49de2ea83036397c007d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Tue, 26 Dec 2017 11:37:00 +0100 Subject: [PATCH 25/37] Fixed exception on task dispose (fix #357) --- Vocaluxe/Base/CBackgroundMusic.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index b8768aa7..19c47c19 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -263,7 +263,6 @@ namespace Vocaluxe.Base if (_PreviewStartHelperTask != null && (_PreviewPlayer.Length > 0 || _PreviewStartWaitCounter++ >= _PreviewStartWaitMaxTries)) { _PreviewStartHelperTask.RunSynchronously(TaskScheduler.FromCurrentSynchronizationContext()); - _PreviewStartHelperTask.Dispose(); _PreviewStartHelperTask = null; _PreviewStartWaitCounter = 0; } @@ -327,11 +326,6 @@ namespace Vocaluxe.Base { lock (_PreviewStartHelperTaskLock) { - // Check if the old _PreviewStartHelperTask needs to disposed - if (_PreviewStartHelperTask != null) - { - _PreviewStartHelperTask.Dispose(); - } _PreviewStartHelperTask = new Task(() => { float length = _PreviewPlayer.Length; @@ -360,7 +354,6 @@ namespace Vocaluxe.Base // Recheck the condition as it cloud have change before we got the lock if (_PreviewStartHelperTask != null) { - _PreviewStartHelperTask.Dispose(); _PreviewStartHelperTask = null; } } From f9e71693eaacdccc114f84d360dc0e60aed84c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Tue, 26 Dec 2017 12:51:16 +0100 Subject: [PATCH 26/37] Fix: Winner in challenge mode wasn't calculated properly --- .../PartyModeChallenge/CPartyModeChallenge.cs | 54 ++++++++++---- .../CPartyModeChallengeMedley.cs | 71 ++++++++++--------- 2 files changed, 77 insertions(+), 48 deletions(-) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index e336d4de..f34ed0a5 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; +using VocaluxeLib.Game; using VocaluxeLib.Menu; [assembly: ComVisible(false)] @@ -430,39 +431,62 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateScores() { + //Prepare results table if (GameData.ResultTable.Count == 0) { for (int i = 0; i < GameData.NumPlayer; i++) { - var row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; + var row = new CResultTableRow { PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0 }; GameData.ResultTable.Add(row); } - GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; + GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce]; for (int i = 0; i < GameData.NumRounds; i++) { for (int j = 0; j < GameData.NumPlayerAtOnce; j++) GameData.Results[i, j] = 0; } } - SPlayer[] results = CBase.Game.GetPlayers(); - if (results == null) - return; - if (results.Length < GameData.NumPlayerAtOnce) - return; + //Get points from game + CPoints points = CBase.Game.GetPoints(); + SPlayer[] players = CBase.Game.GetPlayers(); - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) - GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + //Go over all rounds and sum up points + for (int round = 0; round < points.NumRounds; round++) + { + SPlayer[] res = points.GetPlayer(round, GameData.NumPlayerAtOnce); - List points = _GetPointsForPlayer(results); + if (res == null || res.Length < GameData.NumPlayerAtOnce) + return; + + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) + { + players[p].Points += res[p].Points; + players[p].PointsGoldenNotes += res[p].PointsGoldenNotes; + players[p].PointsLineBonus += res[p].PointsLineBonus; + } + } + //Calculate average points + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) + { + players[p].Points /= points.NumRounds; + players[p].PointsGoldenNotes /= points.NumRounds; + players[p].PointsLineBonus /= points.NumRounds; + + //Save points in GameData + GameData.Results[GameData.CurrentRoundNr - 2, p] = (int)Math.Round(players[p].Points); + } + + List stats = _GetPointsForPlayer(players); for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { + //Find matching row in results table int index = -1; for (int j = 0; j < GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) + if (stats[i].ProfileID == GameData.ResultTable[j].PlayerID) { index = j; break; @@ -473,14 +497,14 @@ namespace VocaluxeLib.PartyModes.Challenge continue; CResultTableRow row = GameData.ResultTable[index]; + //Update results entry row.NumPlayed++; - row.NumWon += points[i].Won; - row.NumSingPoints += points[i].SingPoints; - row.NumGamePoints += points[i].GamePoints; + row.NumWon += stats[i].Won; + row.NumSingPoints += stats[i].SingPoints; + row.NumGamePoints += stats[i].GamePoints; GameData.ResultTable[index] = row; } - GameData.ResultTable.Sort(); diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 78da5f05..e8ec6b18 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -411,74 +411,79 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateScores() { + //Prepare results table if (GameData.ResultTable.Count == 0) { for (int i = 0; i < GameData.NumPlayer; i++) { - CResultTableRow row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; + var row = new CResultTableRow { PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0 }; GameData.ResultTable.Add(row); } - GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; + GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce]; for (int i = 0; i < GameData.NumRounds; i++) { for (int j = 0; j < GameData.NumPlayerAtOnce; j++) GameData.Results[i, j] = 0; } } - - CPoints gamePoints = CBase.Game.GetPoints(); - if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce) - return; - SPlayer[] results = gamePoints.GetPlayer(0, GameData.NumPlayerAtOnce); - if (results == null) - return; + //Get points from game + CPoints points = CBase.Game.GetPoints(); + SPlayer[] players = CBase.Game.GetPlayers(); - if (results.Length < GameData.NumPlayerAtOnce) - return; - - if (gamePoints.NumRounds == 0) - return; - - for (int i = 1; i < gamePoints.NumRounds; i++) + //Go over all rounds and sum up points + for (int round = 0; round < points.NumRounds; round++) { - SPlayer[] temp = gamePoints.GetPlayer(i, GameData.NumPlayerAtOnce); + SPlayer[] res = points.GetPlayer(round, GameData.NumPlayerAtOnce); + + if (res == null || res.Length < GameData.NumPlayerAtOnce) + return; + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) - results[p].Points += temp[p].Points; + { + players[p].Points += res[p].Points; + players[p].PointsGoldenNotes += res[p].PointsGoldenNotes; + players[p].PointsLineBonus += res[p].PointsLineBonus; + } } - - for (int j = 0; j < GameData.NumPlayerAtOnce; j++) + //Calculate average points + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) { - results[j].Points = results[j].Points / gamePoints.NumRounds; - GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + players[p].Points /= points.NumRounds; + players[p].PointsGoldenNotes /= points.NumRounds; + players[p].PointsLineBonus /= points.NumRounds; + + //Save points in GameData + GameData.Results[GameData.CurrentRoundNr - 2, p] = (int)Math.Round(players[p].Points); } - List points = _GetPointsForPlayer(results); + List stats = _GetPointsForPlayer(players); for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { + //Find matching row in results table int index = -1; for (int j = 0; j < GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) + if (stats[i].ProfileID == GameData.ResultTable[j].PlayerID) { index = j; break; } } - if (index != -1) - { - CResultTableRow row = GameData.ResultTable[index]; + if (index == -1) + continue; + CResultTableRow row = GameData.ResultTable[index]; - row.NumPlayed++; - row.NumWon += points[i].Won; - row.NumSingPoints += points[i].SingPoints; - row.NumGamePoints += points[i].GamePoints; + //Update results entry + row.NumPlayed++; + row.NumWon += stats[i].Won; + row.NumSingPoints += stats[i].SingPoints; + row.NumGamePoints += stats[i].GamePoints; - GameData.ResultTable[index] = row; - } + GameData.ResultTable[index] = row; } GameData.ResultTable.Sort(); From 675edce193cc2b45fba87f2895c46092c2e4bd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Tue, 26 Dec 2017 15:46:21 +0100 Subject: [PATCH 27/37] Fix: winner calc in tic-tac-toe mode (closes #349) --- .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 636e3cfe..e867335b 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Runtime.InteropServices; +using VocaluxeLib.Game; using VocaluxeLib.Menu; using VocaluxeLib.Songs; @@ -530,13 +531,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (!GameData.Rounds[GameData.FieldNr].Finished) GameData.CurrentRoundNr++; + CPoints points = CBase.Game.GetPoints(); SPlayer[] results = CBase.Game.GetPlayers(); - if (results == null) + + if (results == null || results.Length < 2) return; - if (results.Length < 2) - return; + //Sum up all points + for (int r = 0; r < points.NumRounds; r++) + { + SPlayer[] player = points.GetPlayer(r, 2); + for (int i = 0; i < 2; i++) + { + results[i].Points += player[i].Points; + results[i].PointsGoldenNotes += player[i].PointsGoldenNotes; + results[i].PointsLineBonus += player[i].PointsLineBonus; + } + } + //Calc average of points + for (int i = 0; i < 2; i++) + { + results[i].Points /= points.NumRounds; + results[i].PointsGoldenNotes /= points.NumRounds; + results[i].PointsLineBonus /= points.NumRounds; + } + + //Decide who has won GameData.Rounds[GameData.FieldNr].PointsTeam1 = (int)Math.Round(results[0].Points); GameData.Rounds[GameData.FieldNr].PointsTeam2 = (int)Math.Round(results[1].Points); GameData.Rounds[GameData.FieldNr].Finished = true; From 342123dc4eed33145916dfe7e7a3bc7a89eb65aa Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Wed, 31 Jan 2018 20:34:11 +0100 Subject: [PATCH 28/37] Removed useless metapackage vocaluxe.dependencies (cherry picked from commit 20d13d9f0660b44db4614ae6e9dd6c17a3456980) # Conflicts: # Vocaluxe/packages.config --- Vocaluxe/Vocaluxe.csproj | 2 -- Vocaluxe/packages.config | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 248e7a46..a2f05409 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -547,7 +547,6 @@ - @@ -561,5 +560,4 @@ - \ No newline at end of file diff --git a/Vocaluxe/packages.config b/Vocaluxe/packages.config index 437d7321..b3c6953a 100644 --- a/Vocaluxe/packages.config +++ b/Vocaluxe/packages.config @@ -1,6 +1,6 @@  - + From 61dcfc3aeb86b959320232db633373f10e395fe8 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Wed, 31 Jan 2018 20:42:25 +0100 Subject: [PATCH 29/37] Upgrade PortAudio to version pa_stable_v190600_20161030 (cherry picked from commit 16f9ef2c8861ce22b7e09aeae342f701739ce149) --- Vocaluxe/Vocaluxe.csproj | 7 ++++--- Vocaluxe/packages.config | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index a2f05409..7a145115 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -31,7 +31,8 @@ 1.0.0.%2a false true - 3d91144f + + x86 @@ -542,11 +543,11 @@ - + @@ -555,9 +556,9 @@ - + \ No newline at end of file diff --git a/Vocaluxe/packages.config b/Vocaluxe/packages.config index b3c6953a..493ebca1 100644 --- a/Vocaluxe/packages.config +++ b/Vocaluxe/packages.config @@ -9,7 +9,7 @@ - + From cd5ab37afd395bd55a0ffefd666b6821842ec1cf Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Tue, 27 Feb 2018 19:34:15 +0100 Subject: [PATCH 30/37] Use TLS 1.2 for downloading GStreamer (cherry picked from commit 617cf70bf8d7dc35abab1bf0c786d607809d2843) --- Vocaluxe/Vocaluxe.csproj | 4 ++-- Vocaluxe/packages.config | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 7a145115..d7931ec1 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -546,7 +546,7 @@ - + @@ -559,6 +559,6 @@ - + \ No newline at end of file diff --git a/Vocaluxe/packages.config b/Vocaluxe/packages.config index 493ebca1..0dbfb55c 100644 --- a/Vocaluxe/packages.config +++ b/Vocaluxe/packages.config @@ -5,7 +5,7 @@ - + From 4c76c88074e1078004ff206804247a4b81a5cf0a Mon Sep 17 00:00:00 2001 From: Stefan Date: Wed, 15 Jan 2020 23:44:49 +0100 Subject: [PATCH 31/37] Fix release-0.4.1: Config.Video.VideoPreview is ignored (fixes #391) --- VocaluxeLib/Menu/SongMenu/CSongMenuList.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs index 8bbd810a..59741a1d 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs @@ -541,7 +541,9 @@ namespace VocaluxeLib.Menu.SongMenu } _TextBG.Draw(); - CTextureRef vidtex = CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null; + CTextureRef vidtex = null; + if (CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + vidtex = (CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null); if (vidtex != null) { @@ -683,4 +685,4 @@ namespace VocaluxeLib.Menu.SongMenu base.LoadSkin(); } } -} \ No newline at end of file +} From e2dcbc2ecf86b54a61610344a292a2aa2795c474 Mon Sep 17 00:00:00 2001 From: Stefan Date: Wed, 15 Jan 2020 23:46:01 +0100 Subject: [PATCH 32/37] Fix release-0.4.1: Config.Video.VideoPreview is ignored (fixes #391) --- VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index f74e81f9..7457ac52 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -515,7 +515,9 @@ namespace VocaluxeLib.Menu.SongMenu _TextBG.Draw(); - CTextureRef vidtex = CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null; + CTextureRef vidtex = null; + if (CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + vidtex = (CBase.BackgroundMusic.IsPlayingPreview() ? CBase.BackgroundMusic.GetVideoTexture() : null); if (vidtex != null) { @@ -638,4 +640,4 @@ namespace VocaluxeLib.Menu.SongMenu Init(); } } -} \ No newline at end of file +} From 9e8952157ad8c922274a05ae27537130a83d9042 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 16 Jan 2020 07:15:23 +0100 Subject: [PATCH 33/37] Fix release-0.4.1: JumpTo not working correctly on folder sort (fix #449) --- Vocaluxe/Screens/CScreenSong.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index ad8c73d0..0b1fe528 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -1067,7 +1067,7 @@ namespace Vocaluxe.Screens case ESongSorting.TR_CONFIG_FOLDER: if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Folder.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)) start = curSelected + 1; - visibleID = _FindIndex(songs, start, element => element.Folder.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); + visibleID = _FindIndex(songs, start, element => element.FolderName.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); break; } if (visibleID > -1) @@ -1380,4 +1380,4 @@ namespace Vocaluxe.Screens } #endregion Playlist Actions } -} \ No newline at end of file +} From cfc6bfa7384cff1d27af79ea458e5d59093d92ed Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 4 Feb 2020 08:46:48 +0100 Subject: [PATCH 34/37] Relative song paths will now be converted to absolute song paths Same fix from GaryCXJk for release-0.4.1 --- Vocaluxe/Base/CConfig.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 1b7fde8e..48d9805a 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -633,7 +633,7 @@ namespace Vocaluxe.Base { //Check if folder exists if (Directory.Exists(folder)) - SongFolders.Add(folder); + SongFolders.Add(Path.GetFullPath(folder)); } } @@ -803,4 +803,4 @@ namespace Vocaluxe.Base } } } -} \ No newline at end of file +} From 546ccf4748d7ec610d149d777bb78f851402a1c7 Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 7 Feb 2020 21:17:36 +0100 Subject: [PATCH 35/37] Scroll offset was ignored while singing a single playlist song (fix #487 for release-0.4.1) --- VocaluxeLib/Menu/CPlaylist.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 96a411cb..89b32d7d 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -554,7 +554,7 @@ namespace VocaluxeLib.Menu break; case Keys.Enter: - _StartPlaylistSong(_CurrentPlaylistElement); + _StartPlaylistSong(_CurrentPlaylistElement + _Offset); break; case Keys.Add: //move the selected song up @@ -880,7 +880,7 @@ namespace VocaluxeLib.Menu //Start selected song with double click if (mouseEvent.LD && _CurrentPlaylistElement != -1) - _StartPlaylistSong(_CurrentPlaylistElement); + _StartPlaylistSong(_CurrentPlaylistElement + _Offset); //Change order with holding LB if (mouseEvent.LBH && _CurrentPlaylistElement != -1 && _PlaylistElementContents.Count > 0 && DragAndDropSongID == -1) @@ -1259,4 +1259,4 @@ namespace VocaluxeLib.Menu } #endregion ThemeEdit } -} \ No newline at end of file +} From 919ab803d141672f24492d73db6706873411efac Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 9 Feb 2020 20:02:59 +0100 Subject: [PATCH 36/37] Fix alpha calculation for last sub line (release-0.4.1) Sub line was displayed wrong, if the last lyric line has a bigger distance to the second last line. Alpha calculation for sub lines stopped one line to early and might be visible even if it shouldn't be. --- Vocaluxe/Screens/CScreenSing.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 4fdc3e76..0002ce6d 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -1114,7 +1114,7 @@ namespace Vocaluxe.Screens } // sub - if (currentLineSub < lines.Length - 2) + if ((currentLineSub + 1) < lines.Length) { float diff = CGame.GetTimeFromBeats(lines[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime; @@ -1371,4 +1371,4 @@ namespace Vocaluxe.Screens } } } -} \ No newline at end of file +} From 5e481878f5499543ecd7ba41567cc80026cc1f00 Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 11 Feb 2020 06:32:26 +0100 Subject: [PATCH 37/37] Update Readme.txt --- Output/Readme.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Output/Readme.txt b/Output/Readme.txt index 2cdffb4b..0c30e51d 100644 --- a/Output/Readme.txt +++ b/Output/Readme.txt @@ -1,4 +1,4 @@ -Vocaluxe 0.4 README +Vocaluxe 0.4.1 README ---------------------------- ================================= @@ -168,7 +168,6 @@ Vocaluxe Homepage: https://vocaluxe.org Bug Tracker: https://github.com/Vocaluxe/Vocaluxe/issues Translations: https://www.transifex.com/projects/p/vocaluxe/ GitHub Wiki: https://github.com/Vocaluxe/Vocaluxe/wiki -Support Forum (German): http://www.ultra-star.de Song-DataBase (USDB): http://usdb.animux.de/