From 6704344205310587ae8e7e047be1ea5a0643768d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 22 Dec 2013 10:03:08 +0100 Subject: [PATCH 1/8] Disable resetting after pause, isn't ready yet. --- Vocaluxe/Screens/CScreenSing.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index e5c610d3..fcac57ba 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -877,7 +877,7 @@ namespace Vocaluxe.Screens } else { - CGame.ResetToLastLine(_CurrentStream, _CurrentVideo); + //CGame.ResetToLastLine(_CurrentStream, _CurrentVideo); _Buttons[_ButtonCancel].Visible = false; _Buttons[_ButtonContinue].Visible = false; _Buttons[_ButtonSkip].Visible = false; From 9fb9d70dc99d50b412ec8939317638799c33a835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sun, 22 Dec 2013 10:09:32 +0100 Subject: [PATCH 2/8] Fix name-selection and guest-profiles. --- Output/Profiles/guest1.xml | 2 +- Output/Profiles/guest2.xml | 2 +- Output/Profiles/guest3.xml | 2 +- VocaluxeLib/Menu/CNameSelection.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Output/Profiles/guest1.xml b/Output/Profiles/guest1.xml index ba6d26f6..4a528851 100644 --- a/Output/Profiles/guest1.xml +++ b/Output/Profiles/guest1.xml @@ -4,7 +4,7 @@ Guest 1 TR_CONFIG_EASY Avatar_f.png - TR_CONFIG_ON + TR_USERROLE_GUEST TR_CONFIG_ON \ No newline at end of file diff --git a/Output/Profiles/guest2.xml b/Output/Profiles/guest2.xml index 3823fdf5..15437dc4 100644 --- a/Output/Profiles/guest2.xml +++ b/Output/Profiles/guest2.xml @@ -4,7 +4,7 @@ Guest 2 TR_CONFIG_EASY Avatar_f.png - TR_CONFIG_ON + TR_USERROLE_GUEST TR_CONFIG_ON \ No newline at end of file diff --git a/Output/Profiles/guest3.xml b/Output/Profiles/guest3.xml index df4b05cf..ad1d56f6 100644 --- a/Output/Profiles/guest3.xml +++ b/Output/Profiles/guest3.xml @@ -4,7 +4,7 @@ Guest 3 TR_CONFIG_EASY Avatar_m.png - TR_CONFIG_ON + TR_USERROLE_NORMAL TR_CONFIG_ON \ No newline at end of file diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 274a8307..6314a194 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -509,7 +509,7 @@ namespace VocaluxeLib.Menu { //Don't show profile if is selected, but if selected and guest if (CBase.Game.GetPlayers()[p].ProfileID == profile.ID - && !profile.UserRole.HasFlag(EUserRole.TR_USERROLE_NORMAL)) + && profile.UserRole >= EUserRole.TR_USERROLE_NORMAL) visible = false; } } From a2f626fbca5696a8652c9196c22c40f3f46dab55 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 22 Dec 2013 16:19:42 +0100 Subject: [PATCH 3/8] gstreamer-sharp: Fixed fading --- Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs index 3be86bb9..49e3a6ef 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs @@ -404,7 +404,7 @@ namespace Vocaluxe.Lib.Sound if (_Fading) { if (_FadeTimer.ElapsedMilliseconds < (_FadeTime * 1000f)) - Volume = ((_FadeTimer.ElapsedMilliseconds) / (_FadeTime * 1000f)) * 100f; + Volume = ((_FadeTimer.ElapsedMilliseconds) / (_FadeTime * 1000f)) * _FadeVolume; else { Volume = _FadeVolume; From 028eda099a0772c3cb89ee11b6e022f4a8d2e0a2 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 22 Dec 2013 16:29:44 +0100 Subject: [PATCH 4/8] Playback: Added FadeAndStop --- Vocaluxe/Base/CBackgroundMusic.cs | 2 +- Vocaluxe/Base/CMain.cs | 2 +- Vocaluxe/Base/CSound.cs | 9 ++++++-- Vocaluxe/Lib/Sound/CGstreamerAudio.cs | 6 +++++ Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs | 17 ++++++++++++++ Vocaluxe/Lib/Sound/COpenALPlay.cs | 6 +++++ Vocaluxe/Lib/Sound/CPortAudioPlay.cs | 27 +++++++++++++++++++++- Vocaluxe/Lib/Sound/IPlayback.cs | 1 + Vocaluxe/Screens/CScreenSing.cs | 2 +- 9 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 4f315e97..d92118d3 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -166,7 +166,7 @@ namespace Vocaluxe.Base CDraw.RemoveTexture(ref _CurrentVideoTexture); _Video = -1; } - CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); + CSound.FadeAndClose(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); _CurrentMusicStream = -1; _CurrentPlaylistElement = new CPlaylistElement(); diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index ff9f0f5d..df9cf03d 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -785,7 +785,7 @@ namespace Vocaluxe.Base public void FadeAndStop(int soundStream, float targetVolume, float duration) { - CSound.FadeAndStop(soundStream, targetVolume, duration); + CSound.FadeAndClose(soundStream, targetVolume, duration); } public void SetStreamVolume(int soundStream, float volume) diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index c3f354da..7df51ad7 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -122,11 +122,16 @@ namespace Vocaluxe.Base _Playback.FadeAndPause(stream, targetVolume, seconds); } - public static void FadeAndStop(int stream, float targetVolume, float seconds) + public static void FadeAndClose(int stream, float targetVolume, float seconds) { _Playback.FadeAndClose(stream, targetVolume, seconds); } + public static void FadeAndStop(int stream, float targetVolume, float seconds) + { + _Playback.FadeAndStop(stream, targetVolume, seconds); + } + public static void SetStreamVolume(int stream, float volume) { _Playback.SetStreamVolume(stream, volume); @@ -192,7 +197,7 @@ namespace Vocaluxe.Base int stream = Load(file); float length = GetLength(stream); Play(stream); - FadeAndStop(stream, 100f, length); + FadeAndClose(stream, 100f, length); return stream; } #endregion Sounds diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs index 334800ba..d9aeea6e 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs @@ -159,5 +159,11 @@ namespace Vocaluxe.Lib.Sound { CGstreamerAudioWrapper.Update(); } + + + public void FadeAndStop(int stream, float targetVolume, float seconds) + { + throw new NotImplementedException(); + } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs index 49e3a6ef..8424eef5 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs @@ -124,6 +124,13 @@ namespace Vocaluxe.Lib.Sound Streams[stream].FadeAndClose(targetVolume, seconds); } + public void FadeAndStop(int stream, float targetVolume, float seconds) + { + if (!Streams.ContainsKey(stream)) + return; + Streams[stream].FadeAndStop(targetVolume, seconds); + } + public void SetStreamVolume(int stream, float volume) { if (!Streams.ContainsKey(stream)) @@ -205,6 +212,7 @@ namespace Vocaluxe.Lib.Sound private bool _Fading; private bool _CloseStreamAfterFade; private bool _PauseStreamAfterFade; + private bool _StopStreamAfterFade; private Stopwatch _FadeTimer = new Stopwatch(); private float _FadeTime; private float _FadeVolume; @@ -312,6 +320,12 @@ namespace Vocaluxe.Lib.Sound _CloseStreamAfterFade = true; } + public void FadeAndStop(float targetVolume, float seconds) + { + Fade(targetVolume, seconds); + _StopStreamAfterFade = true; + } + public float Volume { get @@ -412,9 +426,12 @@ namespace Vocaluxe.Lib.Sound Close(); if (_PauseStreamAfterFade) Paused = true; + if (_StopStreamAfterFade) + Stop(); _CloseStreamAfterFade = false; _PauseStreamAfterFade = false; + _StopStreamAfterFade = false; _Fading = false; _FadeTimer.Reset(); } diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 45a17fd1..131a7ff7 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -345,6 +345,12 @@ namespace Vocaluxe.Lib.Sound _Context.Dispose(); _Context = null; } + + + public void FadeAndStop(int stream, float targetVolume, float seconds) + { + throw new NotImplementedException(); + } } class COpenAlStream : IDisposable diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index 651d2a9e..6cbf218b 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -179,6 +179,18 @@ namespace Vocaluxe.Lib.Sound } public void FadeAndClose(int stream, float targetVolume, float seconds) + { + if (_Initialized) + { + lock (_MutexDecoder) + { + if (_AlreadyAdded(stream)) + _Decoder[_GetStreamIndex(stream)].FadeAndClose(targetVolume, seconds, _Closeproc, stream); + } + } + } + + public void FadeAndStop(int stream, float targetVolume, float seconds) { if (_Initialized) { @@ -346,6 +358,7 @@ namespace Vocaluxe.Lib.Sound private float _StartVolume = 1f; private bool _CloseStreamAfterFade; private bool _PauseStreamAfterFade; + private bool _StopStreamAfterFade; private bool _Fading; private static CPortAudio.SPaHostApiInfo _ApiInfo; @@ -510,7 +523,7 @@ namespace Vocaluxe.Lib.Sound Fade(targetVolume, fadeTime); } - public void FadeAndStop(float targetVolume, float fadeTime, Closeproc closeProc, int streamID) + public void FadeAndClose(float targetVolume, float fadeTime, Closeproc closeProc, int streamID) { _Closeproc = closeProc; _StreamID = streamID; @@ -519,10 +532,20 @@ namespace Vocaluxe.Lib.Sound Fade(targetVolume, fadeTime); } + public void FadeAndStop(float targetVolume, float fadeTime, Closeproc closeProc, int streamID) + { + _Closeproc = closeProc; + _StreamID = streamID; + _StopStreamAfterFade = true; + + Fade(targetVolume, fadeTime); + } + public void Play() { Paused = false; _PauseStreamAfterFade = false; + _StopStreamAfterFade = false; lock (_Mutex) { _ErrorCheck("StartStream", CPortAudio.Pa_StartStream(_Ptr)); @@ -921,6 +944,8 @@ namespace Vocaluxe.Lib.Sound if (_PauseStreamAfterFade) Paused = true; + if (_StopStreamAfterFade) + Stop(); } } } diff --git a/Vocaluxe/Lib/Sound/IPlayback.cs b/Vocaluxe/Lib/Sound/IPlayback.cs index b7aed2f3..935956f5 100644 --- a/Vocaluxe/Lib/Sound/IPlayback.cs +++ b/Vocaluxe/Lib/Sound/IPlayback.cs @@ -48,6 +48,7 @@ namespace Vocaluxe.Lib.Sound void Fade(int stream, float targetVolume, float seconds); void FadeAndPause(int stream, float targetVolume, float seconds); void FadeAndClose(int stream, float targetVolume, float seconds); + void FadeAndStop(int stream, float targetVolume, float seconds); void SetStreamVolume(int stream, float volume); void SetStreamVolumeMax(int stream, float volume); diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index e5c610d3..0f5847e5 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -551,7 +551,7 @@ namespace Vocaluxe.Screens private void _CloseSong() { if (_CurrentStream > -1) - CSound.FadeAndStop(_CurrentStream, 0f, 0.5f); + CSound.FadeAndClose(_CurrentStream, 0f, 0.5f); CSound.RecordStop(); if (_CurrentVideo != -1) { From 708d7f194be6b6e3ec7d60b6a13fc8c68122802a Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 22 Dec 2013 16:51:49 +0100 Subject: [PATCH 5/8] Lyrics: Fixed zoom animation --- VocaluxeLib/Menu/CLyric.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index 7c1376a5..8e8471ec 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -358,7 +358,7 @@ namespace VocaluxeLib.Menu SRectF normalRect = _Text.Rect; _Text.Height += _Text.Height * p * 0.4f; _Text.X -= (_Text.Rect.W - normalRect.W) / 2f; - _Text.Y -= (_Text.Rect.W - normalRect.H) / 2f; + _Text.Y -= (_Text.Rect.H - normalRect.H) / 2f; _Text.Z -= 0.1f; _Text.Draw(); From 4c188f1cc529e94201c20b24d483cd2fa5297045 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 22 Dec 2013 17:06:47 +0100 Subject: [PATCH 6/8] Lyrics: Fixed color when note is active --- VocaluxeLib/Menu/CLyric.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index 8e8471ec..4c6366a8 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -360,6 +360,8 @@ namespace VocaluxeLib.Menu _Text.X -= (_Text.Rect.W - normalRect.W) / 2f; _Text.Y -= (_Text.Rect.H - normalRect.H) / 2f; _Text.Z -= 0.1f; + _Text.Color = _ColorProcessed; + _Text.Draw(); @@ -442,6 +444,7 @@ namespace VocaluxeLib.Menu return; _Text.X = jumpx; + _Text.Color = _ColorProcessed; _SetText(_Line.Notes[jumpNote]); int diff = _Line.Notes[jumpNote].EndBeat - _Line.Notes[jumpNote].StartBeat; From cc1faefc38274f2154bf2323e02713fbe5c39c3a Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 22 Dec 2013 17:25:31 +0100 Subject: [PATCH 7/8] Only enable messagebox exception handling in release mode Debug builds are meant to be executed in a IDE environment, so it is better to take advantage of the IDE's features to show where the exception came from. --- Vocaluxe/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index fdd13fd0..f85b67d9 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -45,11 +45,14 @@ namespace Vocaluxe private static void Main(string[] args) // ReSharper restore InconsistentNaming { +#if !DEBUG AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; +#endif AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver; // Close program if there is another instance running if (!_EnsureSingleInstance()) return; +#if !DEBUG try { _Run(args); @@ -65,6 +68,9 @@ namespace Vocaluxe MessageBox.Show("Unhandled error: " + e.Message + stackTrace); CLog.LogError("Unhandled error: " + e.Message + stackTrace); } +#else + _Run(args); +#endif _CloseProgram(); } From d26fad858d2e9369ca63ec2e0838df7ef8f9b442 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sun, 22 Dec 2013 17:25:49 +0100 Subject: [PATCH 8/8] gstreamer-sharp: Let the GC dispose old elements --- Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs index 8424eef5..6142e6f4 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerSharpAudio.cs @@ -280,7 +280,6 @@ namespace Vocaluxe.Lib.Sound if (_Element != null) { _Element.SetState(State.Null); - _Element.Dispose(); } _Closed = true; _Finished = true;