Play song-preview instead of bg-music (if enabled) on names-, score- and highscore-screen.

This commit is contained in:
Florian Küpper committed 2014-08-09 19:50:40 +02:00
1 parent 04c2b85e2b
commit 8e8fdc1277
12 files changed
+47 -11

No files matched your search

+5
View File
@@ -60,6 +60,11 @@ namespace Vocaluxe.Base
get { return _CurrentScreen; } get { return _CurrentScreen; }
} }
public static EScreens NextScreen
{
get { return _NextScreen; }
}
#region public methods #region public methods
public static void Init() public static void Init()
{ {
+12 -2
View File
@@ -77,6 +77,11 @@ namespace Vocaluxe.Base
return CConfig.BackgroundMusicVolume; return CConfig.BackgroundMusicVolume;
} }
public EOffOn GetBackgroundMusicStatus()
{
return CConfig.BackgroundMusic;
}
public int GetPreviewMusicVolume() public int GetPreviewMusicVolume()
{ {
return CConfig.PreviewMusicVolume; return CConfig.PreviewMusicVolume;
@@ -436,6 +441,11 @@ namespace Vocaluxe.Base
{ {
return CGraphics.GlobalAlpha; return CGraphics.GlobalAlpha;
} }
public EScreens GetNextScreen()
{
return CGraphics.NextScreen;
}
} }
class CBlog : ILog class CBlog : ILog
@@ -979,9 +989,9 @@ namespace Vocaluxe.Base
CPreviewPlayer.Stop(); CPreviewPlayer.Stop();
} }
public void Pause() public void TogglePause()
{ {
CPreviewPlayer.Pause(); CPreviewPlayer.TogglePause();
} }
public CTexture GetCover() public CTexture GetCover()
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Vocaluxe.Base
_Player.Play(); _Player.Play();
} }
public static void Pause() public static void TogglePause()
{ {
_Player.TogglePause(); _Player.TogglePause();
} }
+3
View File
@@ -566,6 +566,9 @@ namespace Vocaluxe.Screens
{ {
base.OnClose(); base.OnClose();
CRecord.Stop(); CRecord.Stop();
if (CGraphics.NextScreen != EScreens.ScreenSong && CPreviewPlayer.IsPlaying)
CPreviewPlayer.TogglePause();
} }
public override bool Draw() public override bool Draw()
+3
View File
@@ -123,6 +123,9 @@ namespace Vocaluxe.Screens
public override void OnShow() public override void OnShow()
{ {
if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
CPreviewPlayer.TogglePause();
base.OnShow(); base.OnShow();
//-1 --> Show average //-1 --> Show average
_Round = CGame.NumRounds > 1 ? -1 : 0; _Round = CGame.NumRounds > 1 ? -1 : 0;
-2
View File
@@ -537,8 +537,6 @@ namespace Vocaluxe.Screens
_CloseSong(); _CloseSong();
if (_Webcam) if (_Webcam)
CWebcam.Stop(); CWebcam.Stop();
CBackgroundMusic.Disabled = false;
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
} }
private void _CloseSong() private void _CloseSong()
+7 -2
View File
@@ -716,9 +716,14 @@ namespace Vocaluxe.Screens
public override void OnClose() public override void OnClose()
{ {
base.OnClose(); base.OnClose();
CBackgroundMusic.Disabled = false;
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
_SongMenu.OnHide(); _SongMenu.OnHide();
if (CGraphics.NextScreen != EScreens.ScreenNames || CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF)
{
CBackgroundMusic.Disabled = false;
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
}
} }
private void _HandlePartySongSelection(int songNr) private void _HandlePartySongSelection(int songNr)
+5 -1
View File
@@ -35,6 +35,8 @@ namespace VocaluxeLib
void SetBackgroundMusicVolume(int newVolume); void SetBackgroundMusicVolume(int newVolume);
int GetBackgroundMusicVolume(); int GetBackgroundMusicVolume();
EOffOn GetBackgroundMusicStatus();
int GetPreviewMusicVolume(); int GetPreviewMusicVolume();
EOffOn GetVideosToBackground(); EOffOn GetVideosToBackground();
@@ -150,6 +152,8 @@ namespace VocaluxeLib
void FadeTo(EScreens nextScreen); void FadeTo(EScreens nextScreen);
float GetGlobalAlpha(); float GetGlobalAlpha();
EScreens GetNextScreen();
} }
public interface ILog public interface ILog
@@ -321,7 +325,7 @@ namespace VocaluxeLib
void Play(float start = -1); void Play(float start = -1);
void Load(CSong song, float start = 0f); void Load(CSong song, float start = 0f);
void Stop(); void Stop();
void Pause(); void TogglePause();
CTexture GetCover(); CTexture GetCover();
CTexture GetVideoTexture(); CTexture GetVideoTexture();
bool IsPlaying(); bool IsPlaying();
@@ -379,7 +379,8 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void OnHide() public virtual void OnHide()
{ {
_ResetPreview(); if(CBase.Graphics.GetNextScreen() != EScreens.ScreenNames || CBase.Config.GetBackgroundMusicStatus() == EOffOn.TR_CONFIG_OFF)
_ResetPreview();
} }
public abstract bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options); public abstract bool HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions options);
@@ -110,7 +110,11 @@ namespace VocaluxeLib.Menu.SongMenu
set set
{ {
if (value == base._PreviewNr) if (value == base._PreviewNr)
{
if (!CBase.PreviewPlayer.IsPlaying())
CBase.PreviewPlayer.Play();
return; return;
}
base._PreviewNr = value; base._PreviewNr = value;
_UpdatePreview(); _UpdatePreview();
} }
+5 -1
View File
@@ -159,11 +159,15 @@ namespace VocaluxeLib.Utils.Player
public new void TogglePause() public new void TogglePause()
{ {
base.TogglePause(); base.TogglePause();
if (_Video != -1) if (!IsPlaying && _Video != -1)
{ {
CBase.Video.Pause(_Video); CBase.Video.Pause(_Video);
CBase.Video.Skip(_Video, CBase.Sound.GetPosition(_StreamID) + _FadeTime, _Song.VideoGap); CBase.Video.Skip(_Video, CBase.Sound.GetPosition(_StreamID) + _FadeTime, _Song.VideoGap);
} }
else if(_Video != -1)
{
CBase.Video.Resume(_Video);
}
} }
public new void Update() public new void Update()
-1
View File
@@ -135,7 +135,6 @@
<Compile Include="PartyModes\IPartyMode.cs" /> <Compile Include="PartyModes\IPartyMode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\CWavFile.cs" /> <Compile Include="Utils\CWavFile.cs" />
<Compile Include="Utils\Player\CPreviewPlayer.cs" />
<Compile Include="Utils\Player\CSongPlayer.cs" /> <Compile Include="Utils\Player\CSongPlayer.cs" />
<Compile Include="Utils\Player\CSoundPlayer.cs" /> <Compile Include="Utils\Player\CSoundPlayer.cs" />
</ItemGroup> </ItemGroup>