1
0
mirror of synced 2024-12-01 02:27:21 +01:00
OpenTaiko/TJAPlayer3/Common/KeyboardSoundGroupLevelControlHandler.cs
2021-09-21 00:16:38 +02:00

64 lines
2.6 KiB
C#

using FDK;
namespace TJAPlayer3
{
/// <summary>
/// KeyboardSoundGroupLevelControlHandler is called by the song selection
/// and song play stages when handling keyboard input. By delegating to
/// this class they are able to support a centrally-managed and consistent
/// set of keyboard shortcuts for dynamically adjusting four sound group
/// levels:
/// - sound effect level, via Ctrl and either of the Minus or Equals keys
/// - voice level, via Shift and either of the Minus or Equals keys
/// - song preview and song playback level, via the Minus or Equals key
///
/// When the sound group levels are adjusted in this manner, the
/// SoundGroupLevelController (and handlers bound to its events) ensure
/// that both the sound object group levels are updated and the application
/// configuration is updated. See ConfigIniToSoundGroupLevelControllerBinder
/// for more details on the latter.
/// </summary>
internal static class KeyboardSoundGroupLevelControlHandler
{
internal static void Handle(
IInputDevice keyboard,
SoundGroupLevelController soundGroupLevelController,
CSkin skin,
bool isSongPreview)
{
var isAdjustmentPositive = keyboard.bキーが押された((int)SlimDXKeys.Key.RightBracket);
if (!(isAdjustmentPositive || keyboard.bキーが押された((int)SlimDXKeys.Key.LeftBracket)))
{
return;
}
ESoundGroup soundGroup;
CSkin.Cシステムサウンド = null;
if (keyboard.bキーが押されている((int)SlimDXKeys.Key.LeftControl) ||
keyboard.bキーが押されている((int)SlimDXKeys.Key.RightControl))
{
soundGroup = ESoundGroup.SoundEffect;
= skin.sound決定音;
}
else if (keyboard.bキーが押されている((int)SlimDXKeys.Key.LeftShift) ||
keyboard.bキーが押されている((int)SlimDXKeys.Key.RightShift))
{
soundGroup = ESoundGroup.Voice;
= skin.soundゲーム開始音;
}
else if (isSongPreview)
{
soundGroup = ESoundGroup.SongPlayback;
}
else
{
soundGroup = ESoundGroup.SongPlayback;
}
soundGroupLevelController.AdjustLevel(soundGroup, isAdjustmentPositive);
?.t再生する();
}
}
}