-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
527 additions
and
228 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Jobs; | ||
|
||
using MonoAudio.Conversion.Resampling.Sample; | ||
using MonoAudio.Filters; | ||
using MonoAudio.Synthesis; | ||
|
||
namespace MonoAudio.Benchmarks | ||
{ | ||
[SimpleJob(RuntimeMoniker.NetCoreApp50)] | ||
public class BiQuadBenchmarks | ||
{ | ||
private IReadableAudioSource<float, SampleFormat> source; | ||
private BiQuadFilter filter; | ||
private float[] buffer; | ||
private const int SampleRate = 192000; | ||
|
||
[Params(1, 2, 3, 4, 8)] | ||
public int Channels { get; set; } | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
source = new DummySource<float, SampleFormat>(new SampleFormat(Channels, SampleRate)); | ||
filter = new BiQuadFilter(source, BiQuadParameter.CreateLPFParameter(SampleRate, 48000, 1)); | ||
buffer = new float[2560]; | ||
} | ||
|
||
[Benchmark] | ||
public void BiQuadFilter() | ||
{ | ||
var span = buffer.AsSpan(); | ||
_ = filter.Read(span); | ||
} | ||
|
||
[GlobalCleanup] | ||
public void Cleanup() | ||
{ | ||
filter?.Dispose(); | ||
source?.Dispose(); | ||
buffer = null; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks> | ||
<TargetFrameworks>net5.0;netstandard2.0;net472</TargetFrameworks> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<DebugSymbols>true</DebugSymbols> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MonoAudio\MonoAudio.csproj" /> | ||
</ItemGroup> | ||
</Project> | ||
</Project> |
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.