fixed keyboard volume control, added volume control by wiimote (+/-)
This commit is contained in:
1 parent
e116f4cfb3
commit
1a3b37419e
4 files changed
+88
-94
No files matched your search
+61
-38
@@ -176,9 +176,6 @@ namespace Vocaluxe.Base
|
|||||||
private static List<IMenu> _Screens = new List<IMenu>();
|
private static List<IMenu> _Screens = new List<IMenu>();
|
||||||
private static List<IMenu> _PopupScreens = new List<IMenu>();
|
private static List<IMenu> _PopupScreens = new List<IMenu>();
|
||||||
|
|
||||||
private static float _SavedBackgroundMusicVolume;
|
|
||||||
private static float _SavedPreviewMusicVolume;
|
|
||||||
private static float _SavedGameMusicVolume;
|
|
||||||
private static Stopwatch _VolumePopupTimer;
|
private static Stopwatch _VolumePopupTimer;
|
||||||
|
|
||||||
public static float GlobalAlpha
|
public static float GlobalAlpha
|
||||||
@@ -309,10 +306,6 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void InitFirstScreen()
|
public static void InitFirstScreen()
|
||||||
{
|
{
|
||||||
_SavedBackgroundMusicVolume = CConfig.BackgroundMusicVolume;
|
|
||||||
_SavedGameMusicVolume = CConfig.GameMusicVolume;
|
|
||||||
_SavedPreviewMusicVolume = CConfig.PreviewMusicVolume;
|
|
||||||
|
|
||||||
_Screens[(int)_CurrentScreen].OnShow();
|
_Screens[(int)_CurrentScreen].OnShow();
|
||||||
_Screens[(int)_CurrentScreen].OnShowFinish();
|
_Screens[(int)_CurrentScreen].OnShowFinish();
|
||||||
}
|
}
|
||||||
@@ -510,7 +503,7 @@ namespace Vocaluxe.Base
|
|||||||
bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
|
bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
|
||||||
_CurrentScreen != EScreens.ScreenSong && _CurrentScreen != EScreens.ScreenCredits;
|
_CurrentScreen != EScreens.ScreenSong && _CurrentScreen != EScreens.ScreenCredits;
|
||||||
|
|
||||||
bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits;
|
bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
|
||||||
|
|
||||||
bool Resume = true;
|
bool Resume = true;
|
||||||
bool EventsAvailable = false;
|
bool EventsAvailable = false;
|
||||||
@@ -535,6 +528,58 @@ namespace Vocaluxe.Base
|
|||||||
HidePopup(EPopupScreens.PopupPlayerControl);
|
HidePopup(EPopupScreens.PopupPlayerControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PopupVolumeControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
|
||||||
|
{
|
||||||
|
int Diff = 0;
|
||||||
|
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp) || KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Add)
|
||||||
|
Diff = 5;
|
||||||
|
else if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown) || KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Subtract)
|
||||||
|
Diff = -5;
|
||||||
|
else if (KeyEvent.Key == Keys.MediaNextTrack)
|
||||||
|
CMain.BackgroundMusic.Next();
|
||||||
|
else if (KeyEvent.Key == Keys.MediaPreviousTrack)
|
||||||
|
CMain.BackgroundMusic.Previous();
|
||||||
|
else if (KeyEvent.Key == Keys.MediaPlayPause)
|
||||||
|
{
|
||||||
|
if (CMain.BackgroundMusic.IsPlaying())
|
||||||
|
CMain.BackgroundMusic.Pause();
|
||||||
|
else
|
||||||
|
CMain.BackgroundMusic.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Diff != 0)
|
||||||
|
{
|
||||||
|
switch (CGraphics.CurrentScreen)
|
||||||
|
{
|
||||||
|
case EScreens.ScreenSong:
|
||||||
|
if (CSongs.Category != -1)
|
||||||
|
CConfig.PreviewMusicVolume += Diff;
|
||||||
|
else
|
||||||
|
CConfig.BackgroundMusicVolume += Diff;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EScreens.ScreenSing:
|
||||||
|
CConfig.GameMusicVolume += Diff;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
CConfig.BackgroundMusicVolume += Diff;
|
||||||
|
CBackgroundMusic.ApplyVolume();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CConfig.SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_CurrentPopupScreen == EPopupScreens.NoPopup && Diff != 0)
|
||||||
|
{
|
||||||
|
ShowPopup(EPopupScreens.PopupVolumeControl);
|
||||||
|
_VolumePopupTimer.Reset();
|
||||||
|
_VolumePopupTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
CMain.BackgroundMusic.ApplyVolume();
|
||||||
|
}
|
||||||
|
|
||||||
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
|
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
|
||||||
{
|
{
|
||||||
CSettings.GameState = EGameState.EditTheme;
|
CSettings.GameState = EGameState.EditTheme;
|
||||||
@@ -596,22 +641,17 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
ShowPopup(EPopupScreens.PopupVolumeControl);
|
ShowPopup(EPopupScreens.PopupVolumeControl);
|
||||||
_VolumePopupTimer.Reset();
|
_VolumePopupTimer.Reset();
|
||||||
|
_VolumePopupTimer.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
|
||||||
{
|
|
||||||
HidePopup(EPopupScreens.PopupVolumeControl);
|
|
||||||
_VolumePopupTimer.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||||
handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
|
handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
|
||||||
|
|
||||||
if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
||||||
_Screens[(int)_CurrentScreen].ApplyVolume();
|
_Screens[(int)_CurrentScreen].ApplyVolume();
|
||||||
|
|
||||||
|
|
||||||
if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
|
if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
|
||||||
Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
|
Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
|
||||||
|
|
||||||
@@ -665,34 +705,17 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static bool Update()
|
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)
|
if(_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds >= 1500 && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
||||||
{
|
{
|
||||||
_VolumePopupTimer.Reset();
|
_VolumePopupTimer.Reset();
|
||||||
HidePopup(EPopupScreens.PopupVolumeControl);
|
HidePopup(EPopupScreens.PopupVolumeControl);
|
||||||
}
|
}
|
||||||
if (!_Cursor.IsActive && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
|
|
||||||
HidePopup(EPopupScreens.PopupVolumeControl);
|
if (_VolumePopupTimer.IsRunning)
|
||||||
|
{
|
||||||
|
_Cursor.FadeIn();
|
||||||
|
}
|
||||||
|
|
||||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||||
_PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
|
_PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
|
||||||
return _Screens[(int)_CurrentScreen].UpdateGame();
|
return _Screens[(int)_CurrentScreen].UpdateGame();
|
||||||
|
|||||||
@@ -224,9 +224,9 @@ namespace Vocaluxe.Lib.Input.WiiMote
|
|||||||
else if (ws.ButtonState.Home && !_ButtonStates[6])
|
else if (ws.ButtonState.Home && !_ButtonStates[6])
|
||||||
key = Keys.Space;
|
key = Keys.Space;
|
||||||
else if (ws.ButtonState.Minus && !_ButtonStates[7])
|
else if (ws.ButtonState.Minus && !_ButtonStates[7])
|
||||||
key = Keys.PageDown;
|
key = Keys.Subtract;
|
||||||
else if (ws.ButtonState.Plus && !_ButtonStates[8])
|
else if (ws.ButtonState.Plus && !_ButtonStates[8])
|
||||||
key = Keys.PageUp;
|
key = Keys.Add;
|
||||||
else if (ws.ButtonState.One && !_ButtonStates[9])
|
else if (ws.ButtonState.One && !_ButtonStates[9])
|
||||||
key = Keys.Enter;
|
key = Keys.Enter;
|
||||||
else if (ws.ButtonState.Two && !_ButtonStates[10])
|
else if (ws.ButtonState.Two && !_ButtonStates[10])
|
||||||
|
|||||||
@@ -48,22 +48,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
public override bool HandleInput(KeyEvent KeyEvent)
|
public override bool HandleInput(KeyEvent KeyEvent)
|
||||||
{
|
{
|
||||||
base.HandleInput(KeyEvent);
|
UpdateSlides();
|
||||||
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +80,6 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
else if (MouseEvent.RB)
|
else if (MouseEvent.RB)
|
||||||
{
|
{
|
||||||
//CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -104,21 +88,7 @@ namespace Vocaluxe.Screens
|
|||||||
public override void OnShow()
|
public override void OnShow()
|
||||||
{
|
{
|
||||||
base.OnShow();
|
base.OnShow();
|
||||||
|
UpdateSlides();
|
||||||
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()
|
public override bool UpdateGame()
|
||||||
@@ -139,7 +109,10 @@ namespace Vocaluxe.Screens
|
|||||||
switch (CGraphics.CurrentScreen)
|
switch (CGraphics.CurrentScreen)
|
||||||
{
|
{
|
||||||
case EScreens.ScreenSong:
|
case EScreens.ScreenSong:
|
||||||
CConfig.PreviewMusicVolume = SelectSlides[htSelectSlides(SelectSlideVolume)].Selection * 5;
|
if (CSongs.Category != -1)
|
||||||
|
CConfig.PreviewMusicVolume = SelectSlides[htSelectSlides(SelectSlideVolume)].Selection * 5;
|
||||||
|
else
|
||||||
|
CConfig.BackgroundMusicVolume = SelectSlides[htSelectSlides(SelectSlideVolume)].Selection * 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EScreens.ScreenSing:
|
case EScreens.ScreenSing:
|
||||||
@@ -153,5 +126,23 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
CConfig.SaveConfig();
|
CConfig.SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateSlides()
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1091,27 +1091,7 @@ namespace Vocaluxe.Menu
|
|||||||
if (KeyEvent.Key == Keys.Right)
|
if (KeyEvent.Key == Keys.Right)
|
||||||
NextElement();
|
NextElement();
|
||||||
}
|
}
|
||||||
if (_Base.BackgroundMusic.IsDisabled())
|
|
||||||
{
|
|
||||||
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp))
|
|
||||||
_Base.Config.SetBackgroundMusicVolume(_Base.Config.GetBackgroundMusicVolume() + 5);
|
|
||||||
else if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown))
|
|
||||||
_Base.Config.SetBackgroundMusicVolume(_Base.Config.GetBackgroundMusicVolume() - 5);
|
|
||||||
else if (KeyEvent.Key == Keys.MediaNextTrack)
|
|
||||||
_Base.BackgroundMusic.Next();
|
|
||||||
else if (KeyEvent.Key == Keys.MediaPreviousTrack)
|
|
||||||
_Base.BackgroundMusic.Previous();
|
|
||||||
else if (KeyEvent.Key == Keys.MediaPlayPause)
|
|
||||||
{
|
|
||||||
if (_Base.BackgroundMusic.IsPlaying())
|
|
||||||
_Base.BackgroundMusic.Pause();
|
|
||||||
else
|
|
||||||
_Base.BackgroundMusic.Play();
|
|
||||||
}
|
|
||||||
|
|
||||||
_Base.BackgroundMusic.ApplyVolume();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user