From eaa2f809e0df2e81a13217a2804d898d9ca73e02 Mon Sep 17 00:00:00 2001 From: LA <1245661240@qq.com> Date: Fri, 23 Jan 2026 11:04:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Audio/Mixing/Bass/BassAudioMixer.cs | 20 +++-------- .../Input/PassThroughInputManager.cs | 33 ++++++------------- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/osu.Framework/Audio/Mixing/Bass/BassAudioMixer.cs b/osu.Framework/Audio/Mixing/Bass/BassAudioMixer.cs index e98d21ea0..c5de4090d 100644 --- a/osu.Framework/Audio/Mixing/Bass/BassAudioMixer.cs +++ b/osu.Framework/Audio/Mixing/Bass/BassAudioMixer.cs @@ -176,9 +176,7 @@ namespace osu.Framework.Audio.Mixing.Bass /// If successful, the position is returned. /// public long ChannelGetPosition(IBassAudioChannel channel, PositionFlags mode = PositionFlags.Bytes) - { - return BassMix.ChannelGetPosition(channel.Handle, mode); - } + => BassMix.ChannelGetPosition(channel.Handle, mode); /// /// Sets the playback position of a channel. @@ -212,9 +210,7 @@ namespace osu.Framework.Audio.Mixing.Bass /// What levels to retrieve. /// true if successful, false otherwise. public bool ChannelGetLevel(IBassAudioChannel channel, [In, Out] float[] levels, float length, LevelRetrievalFlags flags) - { - return BassMix.ChannelGetLevel(channel.Handle, levels, length, flags) != -1; - } + => BassMix.ChannelGetLevel(channel.Handle, levels, length, flags) != -1; /// /// Retrieves the immediate sample data (or an FFT representation of it) of a channel. @@ -229,9 +225,7 @@ namespace osu.Framework.Audio.Mixing.Bass /// When using the flag, the number of bytes in the channel's buffer is returned. /// public int ChannelGetData(IBassAudioChannel channel, float[] buffer, int length) - { - return BassMix.ChannelGetData(channel.Handle, buffer, length); - } + => BassMix.ChannelGetData(channel.Handle, buffer, length); /// /// Sets up a synchroniser on a mixer source channel. @@ -244,9 +238,7 @@ namespace osu.Framework.Audio.Mixing.Bass /// User instance data to pass to the callback function. /// If successful, then the new synchroniser's handle is returned, else 0 is returned. Use to get the error code. public int ChannelSetSync(IBassAudioChannel channel, SyncFlags type, long parameter, SyncProcedure procedure, IntPtr user = default) - { - return BassMix.ChannelSetSync(channel.Handle, type, parameter, procedure, user); - } + => BassMix.ChannelSetSync(channel.Handle, type, parameter, procedure, user); /// /// Removes a synchroniser from a mixer source channel. @@ -255,9 +247,7 @@ namespace osu.Framework.Audio.Mixing.Bass /// Handle of the synchroniser to remove (return value of a previous call). /// If successful, is returned, else is returned. Use to get the error code. public bool ChannelRemoveSync(IBassAudioChannel channel, int sync) - { - return BassMix.ChannelRemoveSync(channel.Handle, sync); - } + => BassMix.ChannelRemoveSync(channel.Handle, sync); /// /// Frees a channel's resources. diff --git a/osu.Framework/Input/PassThroughInputManager.cs b/osu.Framework/Input/PassThroughInputManager.cs index f650ca759..e98f8b3dc 100644 --- a/osu.Framework/Input/PassThroughInputManager.cs +++ b/osu.Framework/Input/PassThroughInputManager.cs @@ -150,7 +150,7 @@ namespace osu.Framework.Input case KeyDownEvent keyDown: if (keyDown.Repeat) return false; - // Apply framework input state update + new KeyboardKeyInput(keyDown.Key, true).Apply(CurrentState, this); // Record raw input timestamp at the earliest point possible for latency measurement. @@ -246,33 +246,20 @@ namespace osu.Framework.Input return; var parentState = parentInputManager.CurrentState; - var mouseButtons = parentState?.Mouse?.Buttons ?? new ButtonStates(); - var mouseDiff = mouseButtons.EnumerateDifference(CurrentState.Mouse.Buttons); - - var keyboardKeys = parentState?.Keyboard.Keys ?? new ButtonStates(); - var keyDiff = keyboardKeys.EnumerateDifference(CurrentState.Keyboard.Keys); - - var touches = parentState?.Touch ?? new TouchState(); - var (touchesDeactivated, _) = touches.EnumerateDifference(CurrentState.Touch); - - var joystickButtons = parentState?.Joystick?.Buttons ?? new ButtonStates(); - var joyButtonDiff = joystickButtons.EnumerateDifference(CurrentState.Joystick.Buttons); - - var midiKeys = parentState?.Midi?.Keys ?? new ButtonStates(); - var midiDiff = midiKeys.EnumerateDifference(CurrentState.Midi.Keys); - - var penButtons = parentState?.Tablet?.PenButtons ?? new ButtonStates(); - var tabletPenDiff = penButtons.EnumerateDifference(CurrentState.Tablet.PenButtons); - - var auxButtons = parentState?.Tablet?.AuxiliaryButtons ?? new ButtonStates(); - var tabletAuxiliaryDiff = auxButtons.EnumerateDifference(CurrentState.Tablet.AuxiliaryButtons); + var mouseDiff = (parentState?.Mouse?.Buttons ?? new ButtonStates()).EnumerateDifference(CurrentState.Mouse.Buttons); + var keyDiff = (parentState?.Keyboard.Keys ?? new ButtonStates()).EnumerateDifference(CurrentState.Keyboard.Keys); + var touchDiff = (parentState?.Touch ?? new TouchState()).EnumerateDifference(CurrentState.Touch); + var joyButtonDiff = (parentState?.Joystick?.Buttons ?? new ButtonStates()).EnumerateDifference(CurrentState.Joystick.Buttons); + var midiDiff = (parentState?.Midi?.Keys ?? new ButtonStates()).EnumerateDifference(CurrentState.Midi.Keys); + var tabletPenDiff = (parentState?.Tablet?.PenButtons ?? new ButtonStates()).EnumerateDifference(CurrentState.Tablet.PenButtons); + var tabletAuxiliaryDiff = (parentState?.Tablet?.AuxiliaryButtons ?? new ButtonStates()).EnumerateDifference(CurrentState.Tablet.AuxiliaryButtons); if (mouseDiff.Released.Length > 0) new MouseButtonInput(mouseDiff.Released.Select(button => new ButtonInputEntry(button, false))).Apply(CurrentState, this); foreach (var key in keyDiff.Released) new KeyboardKeyInput(key, false).Apply(CurrentState, this); - if (touchesDeactivated.Length > 0) - new TouchInput(touchesDeactivated, false).Apply(CurrentState, this); + if (touchDiff.deactivated.Length > 0) + new TouchInput(touchDiff.deactivated, false).Apply(CurrentState, this); foreach (var button in joyButtonDiff.Released) new JoystickButtonInput(button, false).Apply(CurrentState, this); foreach (var key in midiDiff.Released)