同步更新

This commit is contained in:
LA
2026-01-23 11:04:55 +08:00
parent 7ef4ce8936
commit eaa2f809e0
2 changed files with 15 additions and 38 deletions

View File

@@ -176,9 +176,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// If successful, the position is returned.
/// </returns>
public long ChannelGetPosition(IBassAudioChannel channel, PositionFlags mode = PositionFlags.Bytes)
{
return BassMix.ChannelGetPosition(channel.Handle, mode);
}
=> BassMix.ChannelGetPosition(channel.Handle, mode);
/// <summary>
/// Sets the playback position of a channel.
@@ -212,9 +210,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// <param name="flags">What levels to retrieve.</param>
/// <returns><c>true</c> if successful, false otherwise.</returns>
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;
/// <summary>
/// Retrieves the immediate sample data (or an FFT representation of it) of a channel.
@@ -229,9 +225,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// <para>When using the <see cref="DataFlags.Available"/> flag, the number of bytes in the channel's buffer is returned.</para>
/// </returns>
public int ChannelGetData(IBassAudioChannel channel, float[] buffer, int length)
{
return BassMix.ChannelGetData(channel.Handle, buffer, length);
}
=> BassMix.ChannelGetData(channel.Handle, buffer, length);
/// <summary>
/// Sets up a synchroniser on a mixer source channel.
@@ -244,9 +238,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// <param name="user">User instance data to pass to the callback function.</param>
/// <returns>If successful, then the new synchroniser's handle is returned, else 0 is returned. Use <see cref="ManagedBass.Bass.LastError" /> to get the error code.</returns>
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);
/// <summary>
/// Removes a synchroniser from a mixer source channel.
@@ -255,9 +247,7 @@ namespace osu.Framework.Audio.Mixing.Bass
/// <param name="sync">Handle of the synchroniser to remove (return value of a previous <see cref="BassMix.ChannelSetSync(int,SyncFlags,long,SyncProcedure,IntPtr)" /> call).</param>
/// <returns>If successful, <see langword="true" /> is returned, else <see langword="false" /> is returned. Use <see cref="ManagedBass.Bass.LastError" /> to get the error code.</returns>
public bool ChannelRemoveSync(IBassAudioChannel channel, int sync)
{
return BassMix.ChannelRemoveSync(channel.Handle, sync);
}
=> BassMix.ChannelRemoveSync(channel.Handle, sync);
/// <summary>
/// Frees a channel's resources.

View File

@@ -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<MouseButton>();
var mouseDiff = mouseButtons.EnumerateDifference(CurrentState.Mouse.Buttons);
var keyboardKeys = parentState?.Keyboard.Keys ?? new ButtonStates<Key>();
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<JoystickButton>();
var joyButtonDiff = joystickButtons.EnumerateDifference(CurrentState.Joystick.Buttons);
var midiKeys = parentState?.Midi?.Keys ?? new ButtonStates<MidiKey>();
var midiDiff = midiKeys.EnumerateDifference(CurrentState.Midi.Keys);
var penButtons = parentState?.Tablet?.PenButtons ?? new ButtonStates<TabletPenButton>();
var tabletPenDiff = penButtons.EnumerateDifference(CurrentState.Tablet.PenButtons);
var auxButtons = parentState?.Tablet?.AuxiliaryButtons ?? new ButtonStates<TabletAuxiliaryButton>();
var tabletAuxiliaryDiff = auxButtons.EnumerateDifference(CurrentState.Tablet.AuxiliaryButtons);
var mouseDiff = (parentState?.Mouse?.Buttons ?? new ButtonStates<MouseButton>()).EnumerateDifference(CurrentState.Mouse.Buttons);
var keyDiff = (parentState?.Keyboard.Keys ?? new ButtonStates<Key>()).EnumerateDifference(CurrentState.Keyboard.Keys);
var touchDiff = (parentState?.Touch ?? new TouchState()).EnumerateDifference(CurrentState.Touch);
var joyButtonDiff = (parentState?.Joystick?.Buttons ?? new ButtonStates<JoystickButton>()).EnumerateDifference(CurrentState.Joystick.Buttons);
var midiDiff = (parentState?.Midi?.Keys ?? new ButtonStates<MidiKey>()).EnumerateDifference(CurrentState.Midi.Keys);
var tabletPenDiff = (parentState?.Tablet?.PenButtons ?? new ButtonStates<TabletPenButton>()).EnumerateDifference(CurrentState.Tablet.PenButtons);
var tabletAuxiliaryDiff = (parentState?.Tablet?.AuxiliaryButtons ?? new ButtonStates<TabletAuxiliaryButton>()).EnumerateDifference(CurrentState.Tablet.AuxiliaryButtons);
if (mouseDiff.Released.Length > 0)
new MouseButtonInput(mouseDiff.Released.Select(button => new ButtonInputEntry<MouseButton>(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)