Class SwingTransform
- Namespace
- NAudio.Sequencing
- Assembly
- NAudio.Core.dll
A snap-based swing transform: events that sit exactly on an odd grid line are delayed by a fraction of the grid step. Events not aligned to the grid are passed through unchanged (this matches how musicians think of swing applied to a quantised drum pattern).
public sealed class SwingTransform : IPositionTransform
- Inheritance
-
SwingTransform
- Implements
- Inherited Members
Constructors
SwingTransform(long, double)
Creates a swing transform with the given grid (typically a 16th note) and amount.
public SwingTransform(long gridTicks, double amount = 0)
Parameters
Properties
Amount
The fraction of the grid step by which odd grid events are delayed. 0 = straight; 0.5 = halfway to the next grid line (a 32nd offset if the grid is 16ths); ~0.333 ≈ triplet feel. Negative values are clamped to 0 — leading swing is not supported in v1.
public double Amount { get; set; }
Property Value
GridTicks
The grid resolution in canonical ticks (typically TicksPerDivision(int) with division=16).
public long GridTicks { get; set; }
Property Value
MaxShiftTicks
An upper bound on |effective − nominal| over all inputs. Consumers use this to expand the nominal range they query so no event is silently dropped by the transform pushing it across a buffer boundary.
public long MaxShiftTicks { get; }
Property Value
Methods
Transform(long)
The effective tick for an event whose stored (nominal) tick is nominalTick.
public long Transform(long nominalTick)
Parameters
nominalTicklong