Merge branch 'release-0.4.1' into develop

This commit is contained in:
Florian Küpper committed 2017-10-30 21:30:24 +01:00
commit 009a303c28
7 files changed
+56 -34

No files matched your search

@@ -125,6 +125,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
_NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer])); _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer]));
_AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
_NextPlayerStatics[_NextPlayerStatics.Count - 1].Aspect = EAspect.Crop;
} }
_Statics[_StaticNextPlayer].Visible = false; _Statics[_StaticNextPlayer].Visible = false;
} }
@@ -98,6 +98,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_CreateFields(); _CreateFields();
_Buttons[_ButtonField].Visible = false; _Buttons[_ButtonField].Visible = false;
_Statics[_StaticAvatarT1].Aspect = EAspect.Crop;
_Statics[_StaticAvatarT2].Aspect = EAspect.Crop;
} }
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
+21 -3
View File
@@ -74,13 +74,24 @@ namespace Vocaluxe.Lib.Sound
} }
lock (_Mutex) lock (_Mutex)
{ {
if (_Disposed)
return;
Debug.Assert(_RefCount > 0); Debug.Assert(_RefCount > 0);
_RefCount--; _RefCount--;
if (_RefCount == 0) if (_RefCount == 0)
{
try
{
PortAudio.Pa_Terminate(); PortAudio.Pa_Terminate();
} }
catch (Exception ex)
{
CLog.LogError(errorText: $"Error disposing PortAudio: {ex.Message}", e: ex);
}
}
_Disposed = true; _Disposed = true;
} }
}
public void Dispose() public void Dispose()
{ {
@@ -99,12 +110,12 @@ namespace Vocaluxe.Lib.Sound
public PortAudio.PaError OpenStream(out IntPtr stream, ref PortAudio.PaStreamParameters? inputParameters, ref PortAudio.PaStreamParameters? outputParameters, public PortAudio.PaError OpenStream(out IntPtr stream, ref PortAudio.PaStreamParameters? inputParameters, ref PortAudio.PaStreamParameters? outputParameters,
double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags, double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags,
PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData) PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData)
{
lock (_Mutex)
{ {
if (_Disposed) if (_Disposed)
throw new ObjectDisposedException("PortAudioHandle already disposed"); throw new ObjectDisposedException("PortAudioHandle already disposed");
lock (_Mutex)
{
PortAudio.PaError res = PortAudio.Pa_OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback, PortAudio.PaError res = PortAudio.Pa_OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback,
userData); userData);
if (res == PortAudio.PaError.paNoError) if (res == PortAudio.PaError.paNoError)
@@ -156,13 +167,20 @@ namespace Vocaluxe.Lib.Sound
} }
public void CloseStream(IntPtr stream) public void CloseStream(IntPtr stream)
{
lock (_Mutex)
{ {
if (_Disposed) if (_Disposed)
throw new ObjectDisposedException("PortAudioHandle already disposed"); throw new ObjectDisposedException("PortAudioHandle already disposed");
lock (_Mutex) try
{ {
PortAudio.Pa_CloseStream(stream); PortAudio.Pa_CloseStream(stream);
}
catch (Exception ex)
{
CLog.LogError(errorText:$"Error closing stream: {ex.Message}", e:ex);
}
_Streams.Remove(stream); _Streams.Remove(stream);
} }
} }
+3
View File
@@ -138,6 +138,9 @@ namespace Vocaluxe.Screens
_SetVisibility(); _SetVisibility();
_UpdateRatings(); _UpdateRatings();
_SlideShowBG.Visible = _UpdateBackground(); _SlideShowBG.Visible = _UpdateBackground();
for (int p = 0; p < CGame.NumPlayers; p++)
_Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop;
} }
public override bool UpdateGame() public override bool UpdateGame()
+26 -30
View File
@@ -206,8 +206,6 @@ namespace Vocaluxe.Screens
CConfig.Config.Theme.PlayerInfo = (EPlayerInfo)mode; CConfig.Config.Theme.PlayerInfo = (EPlayerInfo)mode;
CConfig.SaveConfig(); CConfig.SaveConfig();
_SetVisibility(); _SetVisibility();
if (CGame.GetSong() != null)
_SetDuetLyricsVisibility(CGame.GetSong().IsDuet); //make sure duet lyrics remain visible
break; break;
case Keys.S: case Keys.S:
@@ -607,7 +605,6 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayers; p++) for (int p = 0; p < CGame.NumPlayers; p++)
_ProgressBars[_ProgressBarsRating[p, CGame.NumPlayers - 1]].Reset(); _ProgressBars[_ProgressBarsRating[p, CGame.NumPlayers - 1]].Reset();
_SetDuetLyricsVisibility(song.IsDuet);
_SetNormalLyricsVisibility(); _SetNormalLyricsVisibility();
_TimerSongText.Reset(); _TimerSongText.Reset();
@@ -620,37 +617,36 @@ namespace Vocaluxe.Screens
_StartSong(); _StartSong();
} }
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() 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_BOTH
|| (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom);
_Lyrics[_LyricMain].Visible = visible;
_Lyrics[_LyricSub].Visible = visible; bool topLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
_Statics[_StaticLyrics].Visible = visible; || 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() private void _StartSong()
+1
View File
@@ -469,6 +469,7 @@ namespace VocaluxeLib.Menu
Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID), Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID),
Img = new CStatic(_PartyModeID) Img = new CStatic(_PartyModeID)
}; };
el.Img.Aspect = EAspect.Crop;
_VisibleElements.Add(el); _VisibleElements.Add(el);
} }
} }
+1 -1
View File
@@ -67,7 +67,7 @@ namespace VocaluxeLib.Profile
{ {
Avatar = CBase.Profiles.GetAvatarByFilename(value); Avatar = CBase.Profiles.GetAvatarByFilename(value);
if (Avatar == null) if (Avatar == null)
throw new Exception("Avatar '" + value + "' not found"); CBase.Log.LogError("Avatar '" + value + "' not found");
} }
} }