Skip to content

Commit

Permalink
Merge pull request #16 from Kuuuube/master
Browse files Browse the repository at this point in the history
Add tooltips
  • Loading branch information
X9VoiD authored Mar 25, 2021
2 parents fadc658 + 95ded30 commit 8f91f10
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 13 deletions.
83 changes: 72 additions & 11 deletions DevocubFilters/AntiChatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,104 @@ namespace TabletDriverFilters.Devocub
[PluginName("Devocub Antichatter")]
public class Antichatter : Interpolator
{
private const string LATENCY_TOOLTIP =
"Smoothing latency\n"
+ " - Smoothing filter adds latency to the input, so don't enable it if you want to have the lowest possible input lag.\n"
+ " - On Wacom tablets you can use latency value between 15 and 25 to have a similar smoothing as in the Wacom drivers.\n"
+ " - You can test out different filter values, but the recommended maximum for osu! is around 50 milliseconds.\n"
+ " - Filter latency values lower than 4 milliseconds aren't recommended. Its better to disable the smoothing filter.\n"
+ " - You don't have to change the filter frequency, but you can use the highest frequency your computer can run without performance problems.";
private const string ANTICHATTER_TOOLTIP =
"Antichatter is meant to prevent cursor chattering/rattling/shaking/trembling when the pen doesn't move.\n"
+ " - Antichatter in its primary form is useful for tablets which don't have any hardware smoothing.\n"
+ " - Antichatter uses smoothing. Latency and Frequency values do have an effect on antichatter settings.\n"
+ "\n"
+ "Formula for smoothing is:\n"
+ " y(x) = (x + OffsetX)^(Strength*-1)*Multiplier+OffsetY\n"
+ " - Where x is pen speed. And y(x) is the smoothing value. Slower speed = more smoothing. Faster speed = less smoothing.\n"
+ "\n"
+ "Strength : Useful values are from 1 up to 10. Higher values make smoothing sharper, lower are smoother.\n"
+ "Multiplier : Zooms in and zooms out the plot. Useful values are from 1 up to 1000. Makes smoothing softer. Default value is 1, which causes no change.\n"
+ "Offset X : Moves the plot to the right. Negative values move the plot to the left. Higher values make smoothing weaker,\n"
+ " lower values stronger and activate stronger smoothing earlier in terms of cursor speed). Useful values are from -1 to 2. Default values is 0.\n"
+ "Offset Y : Moves the plot up. Useful values are from roughly -1 up to 10. If the Y value of smoothing is near 0 for any given point then it provides almost raw data with lowest delay.\n"
+ " If value is near 1 then it's usual smoothing, also it defines minimal amount of smoothing. OffsetY 10 will make smoothing 10 times stronger.\n"
+ " OffsetY 0.5 will make smoothing roughly twice as weak (and latency will be roughly half), 0.3 roughly one third weaker, etc. The default value is 1.\n"
+ "\n"
+ "Example Settings:\n"
+ " - Simple: Latency 5-50 ms, Strength 2-3, Multiplier 1, OffsetX 0, OffsetY 1.\n"
+ "\n"
+ " - Straight: Latency 20-40ms, Strength 20, Multiplier 1, OffsetX 0.7, OffsetY 0.6. This preset isn't good for high hovering.\n"
+ "\n"
+ " - Smooth: Latency ~10 ms, Strength 3, Multiplier 100, OffsetX 1.5, OffsetY 1.\n"
+ " Change OffsetX between 0-2 to switch between stickiness and smooth.\n"
+ " Increase Strength to 4-10 to get harper. Decrease Strength to 1-2 to get more smoothing.\n"
+ "\n"
+ " - Low latency: Set Offset Y to 0 (and potentially set Latency to 1-10 ms. However, with some settings this can break smoothing, usually OffsetY 0 is enough to being able to go to lowest latency).";
private const string PREDICTION_TOOLTIP =
"Prediction - How it works: It adds a predicted point to smoothing algorithm. It helps to preserve sharpness of movement, helps with small movements,\n"
+ " Low values (~10-15ms) of smoothing latency can cause problems for cursor movement. It's very preferred to use at least 10-15ms of smoothing latency, 20-40 ms is even better and recommended.\n"
+ " In some cases, cursor can even outdistance real position (similar to Wacom 6.3.95 drivers).\n"
+ "\n"
+ "Formula for prediction is:\n"
+ " y(x) = 1/cosh((x-OffsetX)*Sharpness)*Strength+OffsetY\n"
+ " - Where x is pen speed. And y(x) is strength of prediction\n"
+ "\n"
+ "Strength : is max of peak of prediction. Useful values are from 0 to 2, or up to 3-4 depending on latency.\n"
+ "Sharpness : changes the width of the Strength.\n"
+ "Offset X : center of the prediction's peak. Useful values are from 0.5 up to 5-7, Increasing this value will shift the cursor speed up on bigger movements.\n"
+ "Offset Y : Moves the plot up/down (positive/negative values). Also defines the minimum amount of prediction.\n"
+ "\n"
+ "Example Settings:\n"
+ " Simple+:\n"
+ " Straight or Smooth preset for smoothing\n"
+ " Strength 1-3 (for 5-50 ms respectively), Sharpness 1, OffsetX 0.8, OffsetY 0\n"
+ "\n"
+ " Straight+:\n"
+ " Straight preset for smoothing\n"
+ " Strength 0.3, Sharpness 0.7, OffsetX 2, OffsetY 0.3\n"
+ "\n"
+ " Fun:\n"
+ " Smoothing: Latency 40ms, Strength 3, Multiplier 10, OffsetX 1, OffsetY 1\n"
+ " Prediction: Strength 4, Sharpness 0.75, Offset 2.5, OffsetY 1";

public Antichatter(ITimer scheduler) : base(scheduler)
{
GetMMScale();
}

[SliderProperty("Latency", 0f, 1000f, 2f), DefaultPropertyValue(2f)]
[SliderProperty("Latency", 0f, 1000f, 2f), DefaultPropertyValue(2f), ToolTip(LATENCY_TOOLTIP)]
public float Latency
{
set => this.latency = Math.Clamp(value, 0, 1000);
get => this.latency;
}

[Property("Antichatter Strength"), DefaultPropertyValue(3f)]
[Property("Antichatter Strength"), DefaultPropertyValue(3f), ToolTip(ANTICHATTER_TOOLTIP)]
public float AntichatterStrength { set; get; }

[Property("Antichatter Multiplier"), DefaultPropertyValue(1f)]
[Property("Antichatter Multiplier"), DefaultPropertyValue(1f), ToolTip(ANTICHATTER_TOOLTIP)]
public float AntichatterMultiplier { set; get; }

[Property("Antichatter Offset X")]
[Property("Antichatter Offset X"), ToolTip(ANTICHATTER_TOOLTIP)]
public float AntichatterOffsetX { set; get; }

[Property("Antichatter Offset Y"), DefaultPropertyValue(1f)]
[Property("Antichatter Offset Y"), DefaultPropertyValue(1f), ToolTip(ANTICHATTER_TOOLTIP)]
public float AntichatterOffsetY { set; get; }

[BooleanProperty("Prediction", "")]
public bool PredictionEnabled { set; get; }
[BooleanProperty("Prediction", ""), ToolTip(PREDICTION_TOOLTIP)]

[Property("Prediction Strength"), DefaultPropertyValue(1.1f)]
public bool PredictionEnabled { set; get; }
[Property("Prediction Strength"), DefaultPropertyValue(1.1f), ToolTip(PREDICTION_TOOLTIP)]
public float PredictionStrength { set; get; }

[Property("Prediction Sharpness"), DefaultPropertyValue(1f)]
[Property("Prediction Sharpness"), DefaultPropertyValue(1f), ToolTip(PREDICTION_TOOLTIP)]
public float PredictionSharpness { set; get; }

[Property("Prediction Offset X"), DefaultPropertyValue(3f)]
[Property("Prediction Offset X"), DefaultPropertyValue(3f), ToolTip(PREDICTION_TOOLTIP)]
public float PredictionOffsetX { set; get; }

[Property("Prediction Offset Y"), DefaultPropertyValue(0.3f)]
[Property("Prediction Offset Y"), DefaultPropertyValue(0.3f), ToolTip(PREDICTION_TOOLTIP)]
public float PredictionOffsetY { set; get; }

private const float THRESHOLD = 0.9f;
Expand Down
21 changes: 19 additions & 2 deletions HawkuFilters/NoiseReduction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,29 @@ namespace OpenTabletDriver.Plugin
[PluginName("Hawku Noise Reduction")]
public class NoiseReduction : IFilter
{
private const string NOISEREDUCTION_TOOLTIP =
"Noise Reduction Filter:\n"
+ " WARNING! This filter will cause more latency on smaller tablet areas(<20 mm), so consider using a larger area to increase the performance.\n"
+ "\n"
+ "Buffer:\n"
+ " - Buffer value is how many of the last pen positions will be stored in the buffer.\n"
+ " - Lower buffer value means lower latency, but lower noise reduction.\n"
+ " - At 133 RPS, the buffer size of 10 means a maximum latency of 75 milliseconds.\n"
+ "\n"
+ "Threshold:\n"
+ " - Threshold value sets the movement distance threshold per pen position report.\n"
+ " - The amount of noise reduction will be at it's maximum if the pen movement is shorter than the threshold value.\n"
+ " - Noise reduction and latency will be almost zero if the pen position movement is double the distance of the threshold value.\n"
+ " - At 133 RPS, a threshold value of 0.5 mm means for speeds of ~66.5 mm/s noise reduction and latency will be applied but for ~133 mm/s the noise reduction and latency will be near zero.\n"
+ "\n"
+ "Recommendations:\n"
+ " Samples = 5 - 20, Threshold = 0.2 - 1.0 mm.";
public NoiseReduction()
{
GetMMScale();
}

[Property("Buffer"), DefaultPropertyValue(10)]
[Property("Buffer"), DefaultPropertyValue(10), ToolTip(NOISEREDUCTION_TOOLTIP)]
public int Samples
{
set
Expand All @@ -25,7 +42,7 @@ public int Samples
get => this.samples;
}

[Property("Distance Threshold"), Unit("mm"), DefaultPropertyValue(0.5f)]
[Property("Distance Threshold"), Unit("mm"), DefaultPropertyValue(0.5f), ToolTip(NOISEREDUCTION_TOOLTIP)]
public float DistanceThreshold
{
set
Expand Down
10 changes: 10 additions & 0 deletions HawkuFilters/Smoothing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ public Smoothing(ITimer scheduler) : base(scheduler)
}

[SliderProperty("Latency", 0.0f, 1000.0f, 2.0f), DefaultPropertyValue(2f)]
[ToolTip(
"Smoothing Filter\n"
+ " - Smoothing filter adds latency to the input, so don't enable it if you want the lowest possible input latency.\n"
+ "\n"
+ "Recommendations\n"
+ " - On Wacom tablets you can use latency value between 15 and 25 to have a similar smoothing as in the Wacom drivers.\n"
+ " - You can test out different filter values, but recommended maximum for osu! is around 50 milliseconds.\n"
+ " - Filter latency value lower than 4 milliseconds isn't recommended. Its better to just disable the smoothing filter.\n"
+ " - You don't have to change the filter frequency, but you can use the highest frequency your computer can run without performance problems."
)]
public float Latency { set; get; }

private const float THRESHOLD = 0.63f;
Expand Down

0 comments on commit 8f91f10

Please sign in to comment.