mirror of
https://github.com/vale981/VoiDPlugins
synced 2025-03-04 16:51:38 -05:00
Update MeL to OTD v0.4.2 api
This commit is contained in:
parent
905f664539
commit
750de941b4
3 changed files with 15 additions and 6 deletions
|
@ -1 +1 @@
|
|||
Subproject commit ef13505cc71a626f04e00665ffa6a80521f4cc6c
|
||||
Subproject commit 049b84a1b0fa15a5f3aa9be153f13885ca85b90b
|
|
@ -26,7 +26,7 @@ namespace OTDPlugins.MeL
|
|||
|
||||
public FilterStage FilterStage => FilterStage.PostTranspose;
|
||||
|
||||
[UnitProperty("Offset", "ms")]
|
||||
[Property("Offset"), Unit("ms")]
|
||||
public float Offset { set; get; }
|
||||
|
||||
[Property("Samples")]
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
using System.Numerics;
|
||||
using OpenTabletDriver.Plugin;
|
||||
using OpenTabletDriver.Plugin.Attributes;
|
||||
using OpenTabletDriver.Plugin.Tablet;
|
||||
using OpenTabletDriver.Plugin.Tablet.Interpolator;
|
||||
using OpenTabletDriver.Plugin.Timers;
|
||||
using OTDPlugins.MeL.Core;
|
||||
|
||||
namespace OTDPlugins.MeL
|
||||
|
@ -11,24 +13,30 @@ namespace OTDPlugins.MeL
|
|||
[PluginName("MeL")]
|
||||
public class MeLInterp : Interpolator
|
||||
{
|
||||
public override void NewReport(Vector2 point, uint pressure)
|
||||
public MeLInterp(ITimer scheduler) : base(scheduler)
|
||||
{
|
||||
Core.Add(point);
|
||||
}
|
||||
|
||||
public override void Interpolate(InterpolatorArgs output)
|
||||
public override void UpdateState(ITabletReport report)
|
||||
{
|
||||
SyntheticReport = new SyntheticTabletReport(report);
|
||||
Core.Add(report.Position);
|
||||
}
|
||||
|
||||
public override ITabletReport Interpolate()
|
||||
{
|
||||
if (Core.IsReady)
|
||||
{
|
||||
try
|
||||
{
|
||||
output.Position = Core.Predict(Core.TimeNow, 0);
|
||||
SyntheticReport.Position = Core.Predict(Core.TimeNow, 0);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Log.Write("MeLInterp", "Unknown error in MeLCore");
|
||||
}
|
||||
}
|
||||
return SyntheticReport;
|
||||
}
|
||||
|
||||
[Property("Samples")]
|
||||
|
@ -41,6 +49,7 @@ namespace OTDPlugins.MeL
|
|||
public float Weight { set => Core.Weight = value; }
|
||||
|
||||
private readonly MLCore Core = new MLCore();
|
||||
private SyntheticTabletReport SyntheticReport;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue