diff --git a/Output/Languages/Deutsch.xml b/Output/Languages/Deutsch.xml index a6b5e346..a0d3db84 100644 --- a/Output/Languages/Deutsch.xml +++ b/Output/Languages/Deutsch.xml @@ -194,6 +194,8 @@ Hintergrundmusik Hintergrundmusiklautstärke Hintergrundmusikquelle + Vorschaulautstärke + Spiellautstärke Designeinstellungen Design @@ -216,5 +218,7 @@ Videos der Hintergrundmusik Webcams Webcamfähigkeiten + + Lautstärke diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index 50fb2055..c6859e32 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -194,6 +194,8 @@ Background Music Background Music Volume Background Music Source + Preview Music Volume + Game Music Volume Theme Options Theme @@ -216,5 +218,7 @@ Display current backgroundmusic video Webcams Webcamcapabilities + + Volume diff --git a/Output/Themes/Ambient/Minus.png b/Output/Themes/Ambient/Minus.png new file mode 100644 index 00000000..9bdede57 Binary files /dev/null and b/Output/Themes/Ambient/Minus.png differ diff --git a/Output/Themes/Ambient/Plus.png b/Output/Themes/Ambient/Plus.png new file mode 100644 index 00000000..5b813c53 Binary files /dev/null and b/Output/Themes/Ambient/Plus.png differ diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml index 3f23d55c..1433aa5a 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml @@ -1,7 +1,7 @@  - 2 + 3 Video @@ -145,6 +145,64 @@ + + + 75 + 285 + + 0,00 + + 32 + + + + StaticColor + + + TextSColor + + Left + + Center + + + + Outline + + TR_SCREENOSOUND_PREVIEWMUSICVOLUME + + + + + + + 75 + 345 + + 0,00 + + 32 + + + + StaticColor + + + TextSColor + + Left + + Center + + + + Outline + + TR_SCREENOSOUND_GAMEMUSICVOLUME + + + + Button @@ -397,5 +455,135 @@ 1 + + + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 500 + 280 + 0,00 + 700 + 50 + + 505 + 285 + 0,00 + 40 + 40 + + 1170 + 285 + 0,00 + 40 + 40 + + + SelectSlideColor + + + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 32,00 + + 500,00 + + Outline + + Bold + + 3 + + + + Invisible + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 500 + 340 + 0,00 + 700 + 50 + + 505 + 345 + 0,00 + 40 + 40 + + 1170 + 345 + 0,00 + 40 + 40 + + + SelectSlideColor + + + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 32,00 + + 500,00 + + Outline + + Bold + + 3 + - \ No newline at end of file + diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index 7587328b..f4549af2 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -333,6 +333,8 @@ Delete.png Save.png Sing.png + Minus.png + Plus.png [Blue]BG_Video.mp4 @@ -340,4 +342,4 @@ [Blue]IntroMid.mp4 [Blue]IntroOut.mp4 - \ No newline at end of file + diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index a5928d20..994705cd 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -327,6 +327,8 @@ Delete.png Save.png Sing.png + Minus.png + Plus.png [Green]BG_Video.mp4 @@ -334,4 +336,4 @@ [Green]IntroMid.mp4 [Green]IntroOut.mp4 - \ No newline at end of file + diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index fd09e46c..b669bfd0 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -327,6 +327,8 @@ Delete.png Save.png Sing.png + Minus.png + Plus.png [Red]BG_Video.mp4 @@ -334,4 +336,4 @@ [Red]IntroMid.mp4 [Red]IntroOut.mp4 - \ No newline at end of file + diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index 83fab332..6e3d562e 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -327,6 +327,8 @@ Delete.png Save.png Sing.png + Minus.png + Plus.png [Yellow]BG_Video.mp4 @@ -334,4 +336,4 @@ [Yellow]IntroMid.mp4 [Yellow]IntroOut.mp4 - \ No newline at end of file + diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsSound.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsSound.txt index 5bdf4bfd..d83bd921 100644 --- a/Output/Themes/Changelog/Changelog_ScreenOptionsSound.txt +++ b/Output/Themes/Changelog/Changelog_ScreenOptionsSound.txt @@ -1,5 +1,17 @@ ScreenOptionsSound +++++++++++ +Version 3: + +Add: + + + + +and some texts for description (Text5, Text6) +"TR_SCRsEENOSOUND_PREVIEWMUSICVOLUME" +"TR_SCREENOSOUND_GAMEMUSICVOLUEM" + ++++++++++ Version 2: diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index c87efd6f..14ecf859 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -235,9 +235,11 @@ namespace Vocaluxe.Base public static ERecordLib RecordLib = ERecordLib.PortAudio; public static EBufferSize AudioBufferSize = EBufferSize.b2048; public static int AudioLatency = 0; - public static int BackgroundMusicVolume = 50; + public static int BackgroundMusicVolume = 30; public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; + public static int PreviewMusicVolume = 50; + public static int GameMusicVolume = 80; // Game public static List SongFolder = new List(); @@ -367,7 +369,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 @@ -600,6 +616,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 diff --git a/Vocaluxe/Menu/CGraphics.cs b/Vocaluxe/Menu/CGraphics.cs index b309938a..4aa62249 100644 --- a/Vocaluxe/Menu/CGraphics.cs +++ b/Vocaluxe/Menu/CGraphics.cs @@ -40,6 +40,7 @@ namespace Vocaluxe.Menu enum EPopupScreens { PopupPlayerControl = 0, + PopupVolumeControl = 1, NoPopup = -1 } @@ -200,6 +201,11 @@ namespace Vocaluxe.Menu private static List _Screens = new List(); private static List _PopupScreens = new List(); + private static float _SavedBackgroundMusicVolume; + private static float _SavedPreviewMusicVolume; + private static float _SavedGameMusicVolume; + private static Stopwatch _VolumePopupTimer; + public static float GlobalAlpha { get { return _GlobalAlpha; } @@ -210,6 +216,11 @@ namespace Vocaluxe.Menu get { return _ZOffset; } } + public static EScreens CurrentScreen + { + get { return _CurrentScreen; } + } + #region public methods public static void InitGraphics() { @@ -235,6 +246,7 @@ namespace Vocaluxe.Menu _Screens.Add(new CScreenCredits()); _PopupScreens.Add(new CPopupScreenPlayerControl()); + _PopupScreens.Add(new CPopupScreenVolumeControl()); CLog.StopBenchmark(1, "Build Screen List"); @@ -242,6 +254,7 @@ namespace Vocaluxe.Menu _NextScreen = EScreens.ScreenNull; _CurrentPopupScreen = EPopupScreens.NoPopup; _FadingTimer = new Stopwatch(); + _VolumePopupTimer = new Stopwatch(); _GlobalAlpha = 1f; _ZOffset = 0f; @@ -317,6 +330,10 @@ namespace Vocaluxe.Menu public static void InitFirstScreen() { + _SavedBackgroundMusicVolume = CConfig.BackgroundMusicVolume; + _SavedGameMusicVolume = CConfig.GameMusicVolume; + _SavedPreviewMusicVolume = CConfig.PreviewMusicVolume; + _Screens[(int)_CurrentScreen].OnShow(); _Screens[(int)_CurrentScreen].OnShowFinish(); } @@ -454,6 +471,8 @@ namespace Vocaluxe.Menu bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && _CurrentScreen != EScreens.ScreenSong && _CurrentScreen != EScreens.ScreenCredits; + bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits; + bool Resume = true; while (keys.PollEvent(ref KeyEvent)) { @@ -517,9 +536,28 @@ namespace Vocaluxe.Menu if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl) HidePopup(EPopupScreens.PopupPlayerControl); + bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent); + if (PopupVolumeControlAllowed && isOverPopupVolumeControl) + { + if (_CurrentPopupScreen == EPopupScreens.NoPopup) + { + ShowPopup(EPopupScreens.PopupVolumeControl); + _VolumePopupTimer.Reset(); + } + } + + if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl) + { + HidePopup(EPopupScreens.PopupVolumeControl); + _VolumePopupTimer.Reset(); + } + bool handled = false; if (_CurrentPopupScreen != EPopupScreens.NoPopup) handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent); + if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl) + _Screens[(int)_CurrentScreen].ApplyVolume(); + if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB)) Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent); @@ -571,6 +609,34 @@ namespace Vocaluxe.Menu private static bool Update() { + //User changed volume with keyboard, pop-up isn't visible yet + if ((_SavedPreviewMusicVolume != CConfig.PreviewMusicVolume || _SavedGameMusicVolume != CConfig.GameMusicVolume || _SavedBackgroundMusicVolume != CConfig.BackgroundMusicVolume) + && (_CurrentPopupScreen != EPopupScreens.PopupVolumeControl && !_VolumePopupTimer.IsRunning)) + { + _VolumePopupTimer.Start(); + _SavedBackgroundMusicVolume = CConfig.BackgroundMusicVolume; + _SavedGameMusicVolume = CConfig.GameMusicVolume; + _SavedPreviewMusicVolume = CConfig.PreviewMusicVolume; + } + //User changed volume with keyboard, pop-up is already visible + else if ((_SavedPreviewMusicVolume != CConfig.PreviewMusicVolume || _SavedGameMusicVolume != CConfig.GameMusicVolume || _SavedBackgroundMusicVolume != CConfig.BackgroundMusicVolume) + && (_CurrentPopupScreen == EPopupScreens.PopupVolumeControl && _VolumePopupTimer.IsRunning)) + { + _VolumePopupTimer.Reset(); + _VolumePopupTimer.Start(); + _SavedBackgroundMusicVolume = CConfig.BackgroundMusicVolume; + _SavedGameMusicVolume = CConfig.GameMusicVolume; + _SavedPreviewMusicVolume = CConfig.PreviewMusicVolume; + } + if (_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds < 1500 && _CurrentPopupScreen != EPopupScreens.PopupVolumeControl) + ShowPopup(EPopupScreens.PopupVolumeControl); + if(_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds >= 1500 && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl) + { + _VolumePopupTimer.Reset(); + HidePopup(EPopupScreens.PopupVolumeControl); + } + if (!_Cursor.IsActive && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl) + HidePopup(EPopupScreens.PopupVolumeControl); if (_CurrentPopupScreen != EPopupScreens.NoPopup) _PopupScreens[(int)_CurrentPopupScreen].UpdateGame(); return _Screens[(int)_CurrentScreen].UpdateGame(); diff --git a/Vocaluxe/Menu/CMenu.cs b/Vocaluxe/Menu/CMenu.cs index fd4aed88..267e69ea 100644 --- a/Vocaluxe/Menu/CMenu.cs +++ b/Vocaluxe/Menu/CMenu.cs @@ -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; } @@ -1060,6 +1078,10 @@ namespace Vocaluxe.Menu public abstract bool UpdateGame(); + public virtual void ApplyVolume() + { + } + public virtual void OnShow() { ResumeBG(); diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs index 9802f57d..7f29d380 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs @@ -610,6 +610,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))) diff --git a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs new file mode 100644 index 00000000..a3c0f4aa --- /dev/null +++ b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Windows.Forms; + +using Vocaluxe.Base; +using Vocaluxe.GameModes; +using Vocaluxe.Lib.Draw; +using Vocaluxe.Menu; +using Vocaluxe.Lib.Song; + +namespace Vocaluxe.Screens +{ + class CPopupScreenVolumeControl : CMenu + { + // Version number for theme files. Increment it, if you've changed something on the theme files! + const int ScreenVersion = 1; + + private const string StaticBG = "StaticBG"; + + private const string SelectSlideVolume = "SelectSlideVolume"; + + + public CPopupScreenVolumeControl() + { + Init(); + } + + protected override void Init() + { + base.Init(); + + _ThemeName = "PopupScreenVolumeControl"; + _ScreenVersion = ScreenVersion; + + _ThemeStatics = new string[] { StaticBG }; + _ThemeSelectSlides = new string[] { SelectSlideVolume }; + + } + + public override void LoadTheme() + { + base.LoadTheme(); + + _ScreenArea = Statics[htStatics(StaticBG)].Rect; + SelectSlides[htSelectSlides(SelectSlideVolume)].AddValues(new string[] { "0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100" }); + } + + public override bool HandleInput(KeyEvent KeyEvent) + { + base.HandleInput(KeyEvent); + if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) + { + + } + else + { + switch (KeyEvent.Key) + { + case Keys.Escape: + case Keys.Back: + CGraphics.HidePopup(EPopupScreens.PopupVolumeControl); + return false; + } + } + + return true; + } + + public override bool HandleMouse(MouseEvent MouseEvent) + { + base.HandleMouse(MouseEvent); + if (MouseEvent.LB) + { + SaveConfig(); + return true; + } + else if (MouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, MouseEvent)) + { + if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel >= 0) + SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel); + else if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel < 0) + SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(0); + SaveConfig(); + return true; + } + else if (MouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, MouseEvent)) + { + if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel < SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues) + SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel); + else if (SelectSlides[htSelectSlides(SelectSlideVolume)].Selection - MouseEvent.Wheel >= SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues) + SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex(SelectSlides[htSelectSlides(SelectSlideVolume)].NumValues - 1); + SaveConfig(); + return true; + } + else if (MouseEvent.RB) + { + //CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); + return false; + } + return true; + } + + public override void OnShow() + { + base.OnShow(); + + switch (CGraphics.CurrentScreen) + { + case EScreens.ScreenSong: + SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex((int)CConfig.PreviewMusicVolume / 5); + break; + + case EScreens.ScreenSing: + SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex((int)CConfig.GameMusicVolume / 5); + break; + + default: + SelectSlides[htSelectSlides(SelectSlideVolume)].SetSelectionByValueIndex((int)CConfig.BackgroundMusicVolume / 5); + break; + } + } + + public override bool UpdateGame() + { + return true; + } + + public override bool Draw() + { + if (!_Active) + return false; + + return base.Draw(); + } + + private void SaveConfig() + { + switch (CGraphics.CurrentScreen) + { + case EScreens.ScreenSong: + CConfig.PreviewMusicVolume = SelectSlides[htSelectSlides(SelectSlideVolume)].Selection * 5; + break; + + case EScreens.ScreenSing: + CConfig.GameMusicVolume = SelectSlides[htSelectSlides(SelectSlideVolume)].Selection * 5; + break; + + default: + CConfig.BackgroundMusicVolume = SelectSlides[htSelectSlides(SelectSlideVolume)].Selection * 5; + CBackgroundMusic.ApplyVolume(); + break; + } + CConfig.SaveConfig(); + } + } +} diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index 2e8207f7..519fddfc 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -12,11 +12,13 @@ namespace Vocaluxe.Screens class CScreenOptionsSound : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! - const int ScreenVersion = 2; + const int ScreenVersion = 3; private const string SelectSlideBackgroundMusic = "SelectSlideBackgroundMusic"; private const string SelectSlideBackgroundMusicVolume = "SelectSlideBackgroundMusicVolume"; private const string SelectSlideBackgroundMusicSource = "SelectSlideBackgroundMusicSource"; + private const string SelectSlidePreviewMusicVolume = "SelectSlidePreviewMusicVolume"; + private const string SelectSlideGameMusicVolume = "SelectSlideGameMusicVolume"; private const string ButtonExit = "ButtonExit"; @@ -36,7 +38,7 @@ namespace Vocaluxe.Screens _ScreenVersion = ScreenVersion; _ThemeButtons = new string[] { ButtonExit }; - _ThemeSelectSlides = new string[] { SelectSlideBackgroundMusic, SelectSlideBackgroundMusicVolume, SelectSlideBackgroundMusicSource }; + _ThemeSelectSlides = new string[] { SelectSlideBackgroundMusic, SelectSlideBackgroundMusicVolume, SelectSlideBackgroundMusicSource, SelectSlidePreviewMusicVolume, SelectSlideGameMusicVolume }; } public override void LoadTheme() @@ -47,6 +49,11 @@ namespace Vocaluxe.Screens SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].Selection = CConfig.BackgroundMusicVolume / 5; SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].SetValues((int)CConfig.BackgroundMusicSource); SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].Selection = (int)CConfig.BackgroundMusicSource; + SelectSlides[htSelectSlides(SelectSlidePreviewMusicVolume)].AddValues(new string[] { "0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100" }); + SelectSlides[htSelectSlides(SelectSlidePreviewMusicVolume)].Selection = CConfig.PreviewMusicVolume / 5; + SelectSlides[htSelectSlides(SelectSlideGameMusicVolume)].AddValues(new string[] { "0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100" }); + SelectSlides[htSelectSlides(SelectSlideGameMusicVolume)].Selection = CConfig.GameMusicVolume / 5; + } public override bool HandleInput(KeyEvent KeyEvent) @@ -113,6 +120,10 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { + if (_BackgroundMusicVolume != CConfig.BackgroundMusicVolume) + { + SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].Selection = CConfig.BackgroundMusicVolume / 5; + } return true; } @@ -127,9 +138,16 @@ namespace Vocaluxe.Screens base.OnShow(); _BackgroundMusic = CConfig.BackgroundMusic; _BackgroundMusicVolume = CConfig.BackgroundMusicVolume; + + SelectSlides[htSelectSlides(SelectSlideGameMusicVolume)].Selection = CConfig.GameMusicVolume / 5; + SelectSlides[htSelectSlides(SelectSlidePreviewMusicVolume)].Selection = CConfig.PreviewMusicVolume / 5; } private void SaveConfig() { + CConfig.GameMusicVolume = SelectSlides[htSelectSlides(SelectSlideGameMusicVolume)].Selection * 5; + CConfig.PreviewMusicVolume = SelectSlides[htSelectSlides(SelectSlidePreviewMusicVolume)].Selection * 5; + CConfig.SaveConfig(); + EOffOn NewOffOn = (EOffOn)SelectSlides[htSelectSlides(SelectSlideBackgroundMusic)].Selection; EBackgroundMusicSource NewSource = (EBackgroundMusicSource)SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].Selection; float NewVolume = SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].Selection * 5; diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 9d951a5a..25cea953 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -238,6 +238,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(); + ApplyVolume(); + } + break; + + case Keys.Subtract: + case Keys.PageDown: + if (KeyEvent.ModSHIFT) + { + CConfig.GameMusicVolume = CConfig.GameMusicVolume - 5; + if (CConfig.GameMusicVolume < 0) + CConfig.GameMusicVolume = 0; + CConfig.SaveConfig(); + ApplyVolume(); + } + break; } } @@ -514,6 +538,11 @@ namespace Vocaluxe.Screens CloseSong(); } + public override void ApplyVolume() + { + CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); + } + private void CloseSong() { CSound.FadeAndStop(_CurrentStream, 0f, 0.5f); @@ -568,7 +597,7 @@ namespace Vocaluxe.Screens Texts[htTexts(TextSongName)].Text = songname; _CurrentStream = CSound.Load(song.GetMP3(), true); - CSound.SetStreamVolumeMax(_CurrentStream, 100f); //TODO: Add volume control var + CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); CSound.SetStreamVolume(_CurrentStream, _Volume); CSound.SetPosition(_CurrentStream, song.Start); _CurrentTime = song.Start; @@ -1367,4 +1396,4 @@ namespace Vocaluxe.Screens } } } -} \ No newline at end of file +} diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 9a0b0e71..ed1c775b 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -106,6 +106,8 @@ namespace Vocaluxe.Screens DragAndDropCover = new CStatic(); Playlists[htPlaylists(Playlist)].Init(); + + ApplyVolume(); } public override bool HandleInput(KeyEvent KeyEvent) @@ -311,6 +313,23 @@ 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(); + ApplyVolume(); + } + 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(); + ApplyVolume(); + } + return true; } @@ -575,6 +594,11 @@ namespace Vocaluxe.Screens SongMenus[htSongMenus(SongMenu)].OnHide(); } + public override void ApplyVolume() + { + SongMenus[htSongMenus(SongMenu)].ApplyVolume(CConfig.PreviewMusicVolume); + } + private void StartSong(int SongNr) { if ((CSongs.Category >= 0) && (SongNr >= 0)) diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 4a43e1be..0bfc1423 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -249,6 +249,7 @@ Form + diff --git a/output/themes/Ambient/Screens/PopupScreenVolumeControl.xml b/output/themes/Ambient/Screens/PopupScreenVolumeControl.xml new file mode 100644 index 00000000..4fd2de9f --- /dev/null +++ b/output/themes/Ambient/Screens/PopupScreenVolumeControl.xml @@ -0,0 +1,119 @@ + + + + 1 + + + Menu + + 1065 + 672 + -2,00 + 225 + 48 + + + StaticColor + + + + + + + 1067 + 680 + + -2,00 + + 32 + + 80 + + + StaticColor + + + TextSColor + + Left + + Center + + + + Outline + + TR_SCREENPVOLUMECONTROL_VOLUME + + + + + + + Invisible + + Minus + + Plus + + Invisible + + Minus + + Plus + + Invisible + + 1090 + 680 + -2,00 + 200 + 50 + + 1195 + 682 + -2,00 + 30 + 30 + + 1240 + 682 + -2,00 + 30 + 30 + + + SelectSlideColor + + + SelectSlideSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 32,00 + + 500,00 + + Outline + + Bold + -15,0 + -8,0 + + 1 + + +