Added background-music-option: "Only selected song". bg-music is played on name/score/highscore screen with selected song.

This commit is contained in:
Florian Küpper committed 2014-08-22 21:22:03 +02:00
1 parent b30efb1913
commit 6dda1a38d0
10 files changed
+23 -15

No files matched your search

+1
View File
@@ -76,6 +76,7 @@
<string name="TR_CONFIG_OWN_MUSIC">Own Music and Background Music</string> <string name="TR_CONFIG_OWN_MUSIC">Own Music and Background Music</string>
<string name="TR_CONFIG_NO_OWN_MUSIC">No own Music</string> <string name="TR_CONFIG_NO_OWN_MUSIC">No own Music</string>
<string name="TR_CONFIG_ONLY_OWN_MUSIC">Only own Music</string> <string name="TR_CONFIG_ONLY_OWN_MUSIC">Only own Music</string>
<string name="TR_CONFIG_ONLY_SONG">Only selected song</string>
<string name="TR_CONFIG_FADEPLAYERINFO_ALL">All</string> <string name="TR_CONFIG_FADEPLAYERINFO_ALL">All</string>
<string name="TR_CONFIG_FADEPLAYERINFO_INFO">Only names and avatars</string> <string name="TR_CONFIG_FADEPLAYERINFO_INFO">Only names and avatars</string>
<string name="TR_CONFIG_FADEPLAYERINFO_OFF">Nothing</string> <string name="TR_CONFIG_FADEPLAYERINFO_OFF">Nothing</string>
+1 -1
View File
@@ -164,7 +164,7 @@ namespace Vocaluxe.Base
public static void Play() public static void Play()
{ {
if (IsPlaying || (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF && !_PlaysPreview)) if (IsPlaying || (CConfig.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_ON && !_PlaysPreview))
return; return;
if (_PlaysPreview) if (_PlaysPreview)
+3 -3
View File
@@ -97,7 +97,7 @@ namespace Vocaluxe.Base
public static EBufferSize AudioBufferSize = EBufferSize.B2048; public static EBufferSize AudioBufferSize = EBufferSize.B2048;
public static int AudioLatency; public static int AudioLatency;
private static int _BackgroundMusicVolume = 30; private static int _BackgroundMusicVolume = 30;
public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; public static EBackgroundMusicOffOn BackgroundMusic = EBackgroundMusicOffOn.TR_CONFIG_ON;
public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
public static EOffOn BackgroundMusicUseStart = EOffOn.TR_CONFIG_ON; public static EOffOn BackgroundMusicUseStart = EOffOn.TR_CONFIG_ON;
private static int _PreviewMusicVolume = 50; private static int _PreviewMusicVolume = 50;
@@ -478,8 +478,8 @@ namespace Vocaluxe.Base
writer.WriteComment("AudioLatency from -500 to 500 ms"); writer.WriteComment("AudioLatency from -500 to 500 ms");
writer.WriteElementString("AudioLatency", AudioLatency.ToString()); writer.WriteElementString("AudioLatency", AudioLatency.ToString());
writer.WriteComment("Background Music: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); writer.WriteComment("Background Music: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicOffOn))));
writer.WriteElementString("BackgroundMusic", Enum.GetName(typeof(EOffOn), BackgroundMusic)); writer.WriteElementString("BackgroundMusic", Enum.GetName(typeof(EBackgroundMusicOffOn), BackgroundMusic));
writer.WriteComment("Background Music Volume from 0 to 100"); writer.WriteComment("Background Music Volume from 0 to 100");
writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString()); writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString());
+4 -4
View File
@@ -340,7 +340,7 @@ namespace Vocaluxe.Base
bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord; bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
//Hide volume control for bg-music if bg-music is disabled //Hide volume control for bg-music if bg-music is disabled
if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1) if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1)
&& _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF) && _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
popupVolumeControlAllowed = false; popupVolumeControlAllowed = false;
@@ -396,13 +396,13 @@ namespace Vocaluxe.Base
if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab) if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab)
{ {
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
ShowPopup(EPopupScreens.PopupPlayerControl); ShowPopup(EPopupScreens.PopupPlayerControl);
else else
HidePopup(EPopupScreens.PopupPlayerControl); HidePopup(EPopupScreens.PopupPlayerControl);
} }
if (popupPlayerControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) if (popupPlayerControlAllowed && CConfig.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_OFF)
{ {
if (keyEvent.Key == Keys.MediaNextTrack) if (keyEvent.Key == Keys.MediaNextTrack)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
@@ -502,7 +502,7 @@ namespace Vocaluxe.Base
bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, mouseEvent); bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, mouseEvent);
if (popupPlayerControlAllowed && isOverPopupPlayerControl) if (popupPlayerControlAllowed && isOverPopupPlayerControl)
{ {
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
ShowPopup(EPopupScreens.PopupPlayerControl); ShowPopup(EPopupScreens.PopupPlayerControl);
} }
+1 -1
View File
@@ -76,7 +76,7 @@ namespace Vocaluxe.Base
return CConfig.BackgroundMusicVolume; return CConfig.BackgroundMusicVolume;
} }
public EOffOn GetBackgroundMusicStatus() public EBackgroundMusicOffOn GetBackgroundMusicStatus()
{ {
return CConfig.BackgroundMusic; return CConfig.BackgroundMusic;
} }
+3 -3
View File
@@ -52,7 +52,7 @@ namespace Vocaluxe.Screens
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_SelectSlides[_SelectSlideBackgroundMusic].SetValues<EOffOn>((int)CConfig.BackgroundMusic); _SelectSlides[_SelectSlideBackgroundMusic].SetValues<EBackgroundMusicOffOn>((int)CConfig.BackgroundMusic);
_SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[] _SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[]
{"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
_SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5;
@@ -150,14 +150,14 @@ namespace Vocaluxe.Screens
{ {
CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5; CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5;
CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5;
CConfig.BackgroundMusic = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; CConfig.BackgroundMusic = (EBackgroundMusicOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection;
CConfig.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; CConfig.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection;
CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5;
CConfig.SaveConfig(); CConfig.SaveConfig();
CBackgroundMusic.SetMusicSource(CConfig.BackgroundMusicSource); CBackgroundMusic.SetMusicSource(CConfig.BackgroundMusicSource);
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) if (CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
CBackgroundMusic.Play(); CBackgroundMusic.Play();
else else
CBackgroundMusic.Pause(); CBackgroundMusic.Pause();
+1 -1
View File
@@ -714,7 +714,7 @@ namespace Vocaluxe.Screens
_SongMenu.OnHide(); _SongMenu.OnHide();
if (CGraphics.NextScreen != EScreens.ScreenNames || CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF) if (CGraphics.NextScreen != EScreens.ScreenNames || CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
{ {
CBackgroundMusic.Disabled = false; CBackgroundMusic.Disabled = false;
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
+7
View File
@@ -248,6 +248,13 @@ namespace VocaluxeLib
// ReSharper restore InconsistentNaming // ReSharper restore InconsistentNaming
} }
public enum EBackgroundMusicOffOn
{
TR_CONFIG_OFF,
TR_CONFIG_ONLY_SONG,
TR_CONFIG_ON
}
public enum EPlayerInfo public enum EPlayerInfo
{ {
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
+1 -1
View File
@@ -35,7 +35,7 @@ namespace VocaluxeLib
void SetBackgroundMusicVolume(int newVolume); void SetBackgroundMusicVolume(int newVolume);
int GetBackgroundMusicVolume(); int GetBackgroundMusicVolume();
EOffOn GetBackgroundMusicStatus(); EBackgroundMusicOffOn GetBackgroundMusicStatus();
int GetPreviewMusicVolume(); int GetPreviewMusicVolume();
@@ -382,7 +382,7 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void OnHide() public virtual void OnHide()
{ {
if(CBase.Graphics.GetNextScreen() != EScreens.ScreenNames || CBase.Config.GetBackgroundMusicStatus() == EOffOn.TR_CONFIG_OFF) if(CBase.Graphics.GetNextScreen() != EScreens.ScreenNames || CBase.Config.GetBackgroundMusicStatus() == EBackgroundMusicOffOn.TR_CONFIG_OFF)
_ResetPreview(); _ResetPreview();
} }