First step for individual volumes.

This commit is contained in:
Florian Kuepper committed 2012-12-07 19:56:53 +01:00
1 parent 9ce6b16aff
commit 4905d6bfd8
5 files changed
+85 -1

No files matched your search

+22
View File
@@ -231,6 +231,8 @@ namespace Vocaluxe.Base
public static int BackgroundMusicVolume = 50;
public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON;
public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
public static int PreviewMusicVolume = 20;
public static int GameMusicVolume = 100;
// Game
public static List<string> SongFolder = new List<string>();
@@ -358,7 +360,21 @@ namespace Vocaluxe.Base
CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusic", navigator, ref BackgroundMusic);
CHelper.TryGetIntValueFromXML("//root/Sound/BackgroundMusicVolume", navigator, ref BackgroundMusicVolume);
if (BackgroundMusicVolume < 0)
BackgroundMusicVolume = 0;
if (BackgroundMusicVolume > 100)
BackgroundMusicVolume = 100;
CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusicSource", navigator, ref BackgroundMusicSource);
CHelper.TryGetIntValueFromXML("//root/Sound/PreviewMusicVolume", navigator, ref PreviewMusicVolume);
if (PreviewMusicVolume < 0)
PreviewMusicVolume = 0;
if (PreviewMusicVolume > 100)
PreviewMusicVolume = 100;
CHelper.TryGetIntValueFromXML("//root/Sound/GameMusicVolume", navigator, ref GameMusicVolume);
if (GameMusicVolume < 0)
GameMusicVolume = 0;
if (GameMusicVolume > 100)
GameMusicVolume = 100;
#endregion Sound
#region Game
@@ -585,6 +601,12 @@ namespace Vocaluxe.Base
writer.WriteComment("Background Music Source");
writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource));
writer.WriteComment("Preview Volume from 0 to 100");
writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString());
writer.WriteComment("Game Volume from 0 to 100");
writer.WriteElementString("GameMusicVolume", GameMusicVolume.ToString());
writer.WriteEndElement();
#endregion Sound
+18
View File
@@ -912,6 +912,24 @@ namespace Vocaluxe.Menu
if (KeyEvent.Key == Keys.Right)
NextElement();
}
if (!CBackgroundMusic.Disabled)
{
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp))
{
CConfig.BackgroundMusicVolume = CConfig.BackgroundMusicVolume + 5;
if (CConfig.BackgroundMusicVolume > 100)
CConfig.BackgroundMusicVolume = 100;
CConfig.SaveConfig();
}
else if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown))
{
CConfig.BackgroundMusicVolume = CConfig.BackgroundMusicVolume - 5;
if (CConfig.BackgroundMusicVolume < 0)
CConfig.BackgroundMusicVolume = 0;
CConfig.SaveConfig();
}
CBackgroundMusic.ApplyVolume();
}
return true;
}
+6 -1
View File
@@ -598,6 +598,11 @@ namespace Vocaluxe.Menu.SongMenu
CSongs.Category = -1;
}
public void ApplyVolume()
{
CSound.SetStreamVolume(_actsongstream, CConfig.PreviewMusicVolume);
}
protected void SelectSong(int nr)
{
if (CSongs.Category >= 0 && (CSongs.NumVisibleSongs > 0) && (nr >= 0) && ((_actsong != nr) || (_streams.Count == 0)))
@@ -628,7 +633,7 @@ namespace Vocaluxe.Menu.SongMenu
CSound.SetPosition(_stream, startposition);
CSound.Play(_stream);
CSound.Fade(_stream, 100f, 3f);
CSound.Fade(_stream, CConfig.PreviewMusicVolume, 3f);
_streams.Add(_stream);
_actsongstream = _stream;
+24
View File
@@ -227,6 +227,30 @@ namespace Vocaluxe.Screens
TogglePause();
}
break;
case Keys.Add:
case Keys.PageUp:
if (KeyEvent.ModSHIFT)
{
CConfig.GameMusicVolume = CConfig.GameMusicVolume + 5;
if (CConfig.GameMusicVolume > 100)
CConfig.GameMusicVolume = 100;
CConfig.SaveConfig();
CSound.SetStreamVolume(_CurrentStream, CConfig.GameMusicVolume);
}
break;
case Keys.Subtract:
case Keys.PageDown:
if (KeyEvent.ModSHIFT)
{
CConfig.GameMusicVolume = CConfig.GameMusicVolume - 5;
if (CConfig.GameMusicVolume < 0)
CConfig.GameMusicVolume = 0;
CConfig.SaveConfig();
CSound.SetStreamVolume(_CurrentStream, CConfig.GameMusicVolume);
}
break;
}
}
+15
View File
@@ -311,6 +311,21 @@ namespace Vocaluxe.Screens
}
}
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp))
{
CConfig.PreviewMusicVolume = CConfig.PreviewMusicVolume + 5;
if (CConfig.PreviewMusicVolume > 100)
CConfig.PreviewMusicVolume = 100;
CConfig.SaveConfig();
}
else if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown))
{
CConfig.PreviewMusicVolume = CConfig.PreviewMusicVolume - 5;
if (CConfig.PreviewMusicVolume < 0)
CConfig.PreviewMusicVolume = 0;
CConfig.SaveConfig();
}
return true;
}