-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sdl-audio
- Loading branch information
Showing
120 changed files
with
3,330 additions
and
943 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
osu.Framework.Benchmarks/BenchmarkPiecewiseLinearToBezier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using BenchmarkDotNet.Attributes; | ||
using osu.Framework.Utils; | ||
using osuTK; | ||
|
||
namespace osu.Framework.Benchmarks | ||
{ | ||
public class BenchmarkPiecewiseLinearToBezier : BenchmarkTest | ||
{ | ||
private Vector2[] inputPath = null!; | ||
|
||
[Params(5, 25)] | ||
public int NumControlPoints; | ||
|
||
[Params(5, 200)] | ||
public int NumTestPoints; | ||
|
||
[Params(0, 100, 200)] | ||
public int MaxIterations; | ||
|
||
public override void SetUp() | ||
{ | ||
base.SetUp(); | ||
|
||
Vector2[] points = new Vector2[5]; | ||
points[0] = new Vector2(50, 250); | ||
points[1] = new Vector2(150, 230); | ||
points[2] = new Vector2(100, 150); | ||
points[3] = new Vector2(200, 80); | ||
points[4] = new Vector2(250, 50); | ||
inputPath = PathApproximator.LagrangePolynomialToPiecewiseLinear(points).ToArray(); | ||
} | ||
|
||
[Benchmark] | ||
public List<Vector2> PiecewiseLinearToBezier() | ||
{ | ||
return PathApproximator.PiecewiseLinearToBezier(inputPath, NumControlPoints, NumTestPoints, MaxIterations); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+148 KB
(100%)
osu.Framework.NativeLibs/runtimes/linux-x64/native/libavcodec.so
Binary file not shown.
Binary file modified
BIN
+28.3 KB
(110%)
osu.Framework.NativeLibs/runtimes/linux-x64/native/libavformat.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/linux-x64/native/libavutil.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/linux-x64/native/libswscale.so
Binary file not shown.
Binary file modified
BIN
+273 KB
(100%)
osu.Framework.NativeLibs/runtimes/osx/native/libavcodec.58.dylib
Binary file not shown.
Binary file modified
BIN
+65.1 KB
(110%)
osu.Framework.NativeLibs/runtimes/osx/native/libavformat.58.dylib
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/osx/native/libavutil.56.dylib
Binary file not shown.
Binary file modified
BIN
-32 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/osx/native/libswscale.5.dylib
Binary file not shown.
Binary file modified
BIN
+131 KB
(100%)
osu.Framework.NativeLibs/runtimes/win-arm64/native/avcodec-58.dll
Binary file not shown.
Binary file modified
BIN
+32 KB
(110%)
osu.Framework.NativeLibs/runtimes/win-arm64/native/avformat-58.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/win-arm64/native/avutil-56.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/win-arm64/native/swscale-5.dll
Binary file not shown.
Binary file modified
BIN
+152 KB
(100%)
osu.Framework.NativeLibs/runtimes/win-x64/native/avcodec-58.dll
Binary file not shown.
Binary file modified
BIN
+37.5 KB
(110%)
osu.Framework.NativeLibs/runtimes/win-x64/native/avformat-58.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/win-x64/native/avutil-56.dll
Binary file not shown.
Binary file modified
BIN
+512 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/win-x64/native/swscale-5.dll
Binary file not shown.
Binary file modified
BIN
+156 KB
(100%)
osu.Framework.NativeLibs/runtimes/win-x86/native/avcodec-58.dll
Binary file not shown.
Binary file modified
BIN
+39.5 KB
(110%)
osu.Framework.NativeLibs/runtimes/win-x86/native/avformat-58.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/win-x86/native/avutil-56.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
osu.Framework.NativeLibs/runtimes/win-x86/native/swscale-5.dll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Runtime.ExceptionServices; | ||
using System.Threading; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Development; | ||
using osu.Framework.Threading; | ||
|
||
namespace osu.Framework.Tests.Audio | ||
{ | ||
internal static class AudioTestHelper | ||
{ | ||
/// <summary> | ||
/// Runs an <paramref name="action"/> on a newly created audio thread, and blocks until it has been run to completion. | ||
/// </summary> | ||
/// <param name="action">The action to run on the audio thread.</param> | ||
public static void RunOnAudioThread(Action action) | ||
{ | ||
using (var _ = StartNewAudioThread(action)) | ||
{ | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Runs an <paramref name="action"/> on a newly created audio thread. | ||
/// </summary> | ||
/// <param name="action">The action to run on the audio thread.</param> | ||
/// <returns>An <see cref="InvokeOnDisposal"/> that waits for the thread to stop and rethrows any unhandled exceptions thrown by the <paramref name="action"/>.</returns> | ||
public static IDisposable StartNewAudioThread(Action action) | ||
{ | ||
var resetEvent = new ManualResetEvent(false); | ||
Exception? threadException = null; | ||
|
||
new Thread(() => | ||
{ | ||
ThreadSafety.IsAudioThread = true; | ||
|
||
try | ||
{ | ||
action(); | ||
} | ||
catch (Exception e) | ||
{ | ||
threadException = e; | ||
} | ||
|
||
resetEvent.Set(); | ||
}) | ||
{ | ||
Name = GameThread.SuffixedThreadNameFor("Audio") | ||
}.Start(); | ||
|
||
return new InvokeOnDisposal(() => | ||
{ | ||
if (!resetEvent.WaitOne(TimeSpan.FromSeconds(10))) | ||
throw new TimeoutException(); | ||
|
||
if (threadException != null) | ||
ExceptionDispatchInfo.Throw(threadException); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.