Merge branch 'develop' of https://github.com/Vocaluxe/Vocaluxe into develop

This commit is contained in:
Alexander Eckart committed 2013-12-22 17:43:12 +01:00
commit f4fca4d798
15 files changed
+82 -14

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
<PlayerName>Guest 1</PlayerName> <PlayerName>Guest 1</PlayerName>
<Difficulty>TR_CONFIG_EASY</Difficulty> <Difficulty>TR_CONFIG_EASY</Difficulty>
<Avatar>Avatar_f.png</Avatar> <Avatar>Avatar_f.png</Avatar>
<GuestProfile>TR_CONFIG_ON</GuestProfile> <UserRole>TR_USERROLE_GUEST</UserRole>
<Active>TR_CONFIG_ON</Active> <Active>TR_CONFIG_ON</Active>
</Info> </Info>
</root> </root>
+1 -1
View File
@@ -4,7 +4,7 @@
<PlayerName>Guest 2</PlayerName> <PlayerName>Guest 2</PlayerName>
<Difficulty>TR_CONFIG_EASY</Difficulty> <Difficulty>TR_CONFIG_EASY</Difficulty>
<Avatar>Avatar_f.png</Avatar> <Avatar>Avatar_f.png</Avatar>
<GuestProfile>TR_CONFIG_ON</GuestProfile> <UserRole>TR_USERROLE_GUEST</UserRole>
<Active>TR_CONFIG_ON</Active> <Active>TR_CONFIG_ON</Active>
</Info> </Info>
</root> </root>
+1 -1
View File
@@ -4,7 +4,7 @@
<PlayerName>Guest 3</PlayerName> <PlayerName>Guest 3</PlayerName>
<Difficulty>TR_CONFIG_EASY</Difficulty> <Difficulty>TR_CONFIG_EASY</Difficulty>
<Avatar>Avatar_m.png</Avatar> <Avatar>Avatar_m.png</Avatar>
<GuestProfile>TR_CONFIG_ON</GuestProfile> <UserRole>TR_USERROLE_NORMAL</UserRole>
<Active>TR_CONFIG_ON</Active> <Active>TR_CONFIG_ON</Active>
</Info> </Info>
</root> </root>
+1 -1
View File
@@ -166,7 +166,7 @@ namespace Vocaluxe.Base
CDraw.RemoveTexture(ref _CurrentVideoTexture); CDraw.RemoveTexture(ref _CurrentVideoTexture);
_Video = -1; _Video = -1;
} }
CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); CSound.FadeAndClose(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
_CurrentMusicStream = -1; _CurrentMusicStream = -1;
_CurrentPlaylistElement = new CPlaylistElement(); _CurrentPlaylistElement = new CPlaylistElement();
+1 -1
View File
@@ -785,7 +785,7 @@ namespace Vocaluxe.Base
public void FadeAndStop(int soundStream, float targetVolume, float duration) 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) public void SetStreamVolume(int soundStream, float volume)
+7 -2
View File
@@ -122,11 +122,16 @@ namespace Vocaluxe.Base
_Playback.FadeAndPause(stream, targetVolume, seconds); _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); _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) public static void SetStreamVolume(int stream, float volume)
{ {
_Playback.SetStreamVolume(stream, volume); _Playback.SetStreamVolume(stream, volume);
@@ -192,7 +197,7 @@ namespace Vocaluxe.Base
int stream = Load(file); int stream = Load(file);
float length = GetLength(stream); float length = GetLength(stream);
Play(stream); Play(stream);
FadeAndStop(stream, 100f, length); FadeAndClose(stream, 100f, length);
return stream; return stream;
} }
#endregion Sounds #endregion Sounds
+6
View File
@@ -159,5 +159,11 @@ namespace Vocaluxe.Lib.Sound
{ {
CGstreamerAudioWrapper.Update(); CGstreamerAudioWrapper.Update();
} }
public void FadeAndStop(int stream, float targetVolume, float seconds)
{
throw new NotImplementedException();
}
} }
} }
+18 -2
View File
@@ -124,6 +124,13 @@ namespace Vocaluxe.Lib.Sound
Streams[stream].FadeAndClose(targetVolume, seconds); 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) public void SetStreamVolume(int stream, float volume)
{ {
if (!Streams.ContainsKey(stream)) if (!Streams.ContainsKey(stream))
@@ -205,6 +212,7 @@ namespace Vocaluxe.Lib.Sound
private bool _Fading; private bool _Fading;
private bool _CloseStreamAfterFade; private bool _CloseStreamAfterFade;
private bool _PauseStreamAfterFade; private bool _PauseStreamAfterFade;
private bool _StopStreamAfterFade;
private Stopwatch _FadeTimer = new Stopwatch(); private Stopwatch _FadeTimer = new Stopwatch();
private float _FadeTime; private float _FadeTime;
private float _FadeVolume; private float _FadeVolume;
@@ -272,7 +280,6 @@ namespace Vocaluxe.Lib.Sound
if (_Element != null) if (_Element != null)
{ {
_Element.SetState(State.Null); _Element.SetState(State.Null);
_Element.Dispose();
} }
_Closed = true; _Closed = true;
_Finished = true; _Finished = true;
@@ -312,6 +319,12 @@ namespace Vocaluxe.Lib.Sound
_CloseStreamAfterFade = true; _CloseStreamAfterFade = true;
} }
public void FadeAndStop(float targetVolume, float seconds)
{
Fade(targetVolume, seconds);
_StopStreamAfterFade = true;
}
public float Volume public float Volume
{ {
get get
@@ -404,7 +417,7 @@ namespace Vocaluxe.Lib.Sound
if (_Fading) if (_Fading)
{ {
if (_FadeTimer.ElapsedMilliseconds < (_FadeTime * 1000f)) if (_FadeTimer.ElapsedMilliseconds < (_FadeTime * 1000f))
Volume = ((_FadeTimer.ElapsedMilliseconds) / (_FadeTime * 1000f)) * 100f; Volume = ((_FadeTimer.ElapsedMilliseconds) / (_FadeTime * 1000f)) * _FadeVolume;
else else
{ {
Volume = _FadeVolume; Volume = _FadeVolume;
@@ -412,9 +425,12 @@ namespace Vocaluxe.Lib.Sound
Close(); Close();
if (_PauseStreamAfterFade) if (_PauseStreamAfterFade)
Paused = true; Paused = true;
if (_StopStreamAfterFade)
Stop();
_CloseStreamAfterFade = false; _CloseStreamAfterFade = false;
_PauseStreamAfterFade = false; _PauseStreamAfterFade = false;
_StopStreamAfterFade = false;
_Fading = false; _Fading = false;
_FadeTimer.Reset(); _FadeTimer.Reset();
} }
+6
View File
@@ -345,6 +345,12 @@ namespace Vocaluxe.Lib.Sound
_Context.Dispose(); _Context.Dispose();
_Context = null; _Context = null;
} }
public void FadeAndStop(int stream, float targetVolume, float seconds)
{
throw new NotImplementedException();
}
} }
class COpenAlStream : IDisposable class COpenAlStream : IDisposable
+26 -1
View File
@@ -179,6 +179,18 @@ namespace Vocaluxe.Lib.Sound
} }
public void FadeAndClose(int stream, float targetVolume, float seconds) 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) if (_Initialized)
{ {
@@ -346,6 +358,7 @@ namespace Vocaluxe.Lib.Sound
private float _StartVolume = 1f; private float _StartVolume = 1f;
private bool _CloseStreamAfterFade; private bool _CloseStreamAfterFade;
private bool _PauseStreamAfterFade; private bool _PauseStreamAfterFade;
private bool _StopStreamAfterFade;
private bool _Fading; private bool _Fading;
private static CPortAudio.SPaHostApiInfo _ApiInfo; private static CPortAudio.SPaHostApiInfo _ApiInfo;
@@ -510,7 +523,7 @@ namespace Vocaluxe.Lib.Sound
Fade(targetVolume, fadeTime); 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; _Closeproc = closeProc;
_StreamID = streamID; _StreamID = streamID;
@@ -519,10 +532,20 @@ namespace Vocaluxe.Lib.Sound
Fade(targetVolume, fadeTime); 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() public void Play()
{ {
Paused = false; Paused = false;
_PauseStreamAfterFade = false; _PauseStreamAfterFade = false;
_StopStreamAfterFade = false;
lock (_Mutex) lock (_Mutex)
{ {
_ErrorCheck("StartStream", CPortAudio.Pa_StartStream(_Ptr)); _ErrorCheck("StartStream", CPortAudio.Pa_StartStream(_Ptr));
@@ -921,6 +944,8 @@ namespace Vocaluxe.Lib.Sound
if (_PauseStreamAfterFade) if (_PauseStreamAfterFade)
Paused = true; Paused = true;
if (_StopStreamAfterFade)
Stop();
} }
} }
} }
+1
View File
@@ -48,6 +48,7 @@ namespace Vocaluxe.Lib.Sound
void Fade(int stream, float targetVolume, float seconds); void Fade(int stream, float targetVolume, float seconds);
void FadeAndPause(int stream, float targetVolume, float seconds); void FadeAndPause(int stream, float targetVolume, float seconds);
void FadeAndClose(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 SetStreamVolume(int stream, float volume);
void SetStreamVolumeMax(int stream, float volume); void SetStreamVolumeMax(int stream, float volume);
+6
View File
@@ -45,11 +45,14 @@ namespace Vocaluxe
private static void Main(string[] args) private static void Main(string[] args)
// ReSharper restore InconsistentNaming // ReSharper restore InconsistentNaming
{ {
#if !DEBUG
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
#endif
AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver; AppDomain.CurrentDomain.AssemblyResolve += _AssemblyResolver;
// Close program if there is another instance running // Close program if there is another instance running
if (!_EnsureSingleInstance()) if (!_EnsureSingleInstance())
return; return;
#if !DEBUG
try try
{ {
_Run(args); _Run(args);
@@ -65,6 +68,9 @@ namespace Vocaluxe
MessageBox.Show("Unhandled error: " + e.Message + stackTrace); MessageBox.Show("Unhandled error: " + e.Message + stackTrace);
CLog.LogError("Unhandled error: " + e.Message + stackTrace); CLog.LogError("Unhandled error: " + e.Message + stackTrace);
} }
#else
_Run(args);
#endif
_CloseProgram(); _CloseProgram();
} }
+2 -2
View File
@@ -551,7 +551,7 @@ namespace Vocaluxe.Screens
private void _CloseSong() private void _CloseSong()
{ {
if (_CurrentStream > -1) if (_CurrentStream > -1)
CSound.FadeAndStop(_CurrentStream, 0f, 0.5f); CSound.FadeAndClose(_CurrentStream, 0f, 0.5f);
CSound.RecordStop(); CSound.RecordStop();
if (_CurrentVideo != -1) if (_CurrentVideo != -1)
{ {
@@ -877,7 +877,7 @@ namespace Vocaluxe.Screens
} }
else else
{ {
CGame.ResetToLastLine(_CurrentStream, _CurrentVideo); //CGame.ResetToLastLine(_CurrentStream, _CurrentVideo);
_Buttons[_ButtonCancel].Visible = false; _Buttons[_ButtonCancel].Visible = false;
_Buttons[_ButtonContinue].Visible = false; _Buttons[_ButtonContinue].Visible = false;
_Buttons[_ButtonSkip].Visible = false; _Buttons[_ButtonSkip].Visible = false;
+4 -1
View File
@@ -358,8 +358,10 @@ namespace VocaluxeLib.Menu
SRectF normalRect = _Text.Rect; SRectF normalRect = _Text.Rect;
_Text.Height += _Text.Height * p * 0.4f; _Text.Height += _Text.Height * p * 0.4f;
_Text.X -= (_Text.Rect.W - normalRect.W) / 2f; _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.Z -= 0.1f;
_Text.Color = _ColorProcessed;
_Text.Draw(); _Text.Draw();
@@ -442,6 +444,7 @@ namespace VocaluxeLib.Menu
return; return;
_Text.X = jumpx; _Text.X = jumpx;
_Text.Color = _ColorProcessed;
_SetText(_Line.Notes[jumpNote]); _SetText(_Line.Notes[jumpNote]);
int diff = _Line.Notes[jumpNote].EndBeat - _Line.Notes[jumpNote].StartBeat; int diff = _Line.Notes[jumpNote].EndBeat - _Line.Notes[jumpNote].StartBeat;
+1 -1
View File
@@ -509,7 +509,7 @@ namespace VocaluxeLib.Menu
{ {
//Don't show profile if is selected, but if selected and guest //Don't show profile if is selected, but if selected and guest
if (CBase.Game.GetPlayers()[p].ProfileID == profile.ID if (CBase.Game.GetPlayers()[p].ProfileID == profile.ID
&& !profile.UserRole.HasFlag(EUserRole.TR_USERROLE_NORMAL)) && profile.UserRole >= EUserRole.TR_USERROLE_NORMAL)
visible = false; visible = false;
} }
} }