Skip to main content

ChartingTiming

Kindclass
Packageeditors.charting
Full nameeditors.charting.ChartingTiming
Sourcesource/editors/charting/ChartingTiming.hx

Chart section conversions that work with Psych-style BPM maps.

Sections are measured in steps (four steps per beat), while the conductor map converts those steps to milliseconds. Keeping the two conversions here makes chart navigation and the editor grid use the same boundaries as playback.

Public methods​

sectionStepCount​

static function sectionStepCount(section:Dynamic):Int

Returns the number of steps in a section, using the chart's 4-beat default.

ParameterTypeDefault
sectionDynamic—

View source

sectionStartStep​

static function sectionStartStep(sections:Array<Dynamic>, sectionIndex:Int):Int

Returns the cumulative step at the beginning of a section.

ParameterTypeDefault
sectionsArray<Dynamic>—
sectionIndexInt—

View source

sectionIndexAtStep​

static function sectionIndexAtStep(sections:Array<Dynamic>, step:Float):Int

Finds the section containing a step. Times beyond the chart use its last section.

ParameterTypeDefault
sectionsArray<Dynamic>—
stepFloat—

View source

timeAtStep​

static function timeAtStep(bpmChanges:Array<Dynamic>, baseBpm:Float, step:Float):Float

Converts a step position to milliseconds using the active BPM-map entry.

ParameterTypeDefault
bpmChangesArray<Dynamic>—
baseBpmFloat—
stepFloat—

View source

stepAtTime​

static function stepAtTime(bpmChanges:Array<Dynamic>, baseBpm:Float, time:Float, offset:Float = 0):Float

Converts milliseconds to steps using the active BPM-map entry.

ParameterTypeDefault
bpmChangesArray<Dynamic>—
baseBpmFloat—
timeFloat—
offset (optional)Float0

View source

sectionStartTime​

static function sectionStartTime(sections:Array<Dynamic>, bpmChanges:Array<Dynamic>, baseBpm:Float, sectionIndex:Int):Float

Returns the start time of a section (or the chart end when sectionIndex == length).

ParameterTypeDefault
sectionsArray<Dynamic>—
bpmChangesArray<Dynamic>—
baseBpmFloat—
sectionIndexInt—

View source

sectionIndexAtTime​

static function sectionIndexAtTime(sections:Array<Dynamic>, bpmChanges:Array<Dynamic>, baseBpm:Float, time:Float):Int

Returns the section containing a playback time, clamped to the available chart.

ParameterTypeDefault
sectionsArray<Dynamic>—
bpmChangesArray<Dynamic>—
baseBpmFloat—
timeFloat—

View source

sectionDuration​

static function sectionDuration(sections:Array<Dynamic>, bpmChanges:Array<Dynamic>, baseBpm:Float, sectionIndex:Int):Float

Returns the duration of a section in milliseconds, including its own BPM change.

ParameterTypeDefault
sectionsArray<Dynamic>—
bpmChangesArray<Dynamic>—
baseBpmFloat—
sectionIndexInt—

View source

stepCrochetAtSection​

static function stepCrochetAtSection(sections:Array<Dynamic>, bpmChanges:Array<Dynamic>, baseBpm:Float, sectionIndex:Int):Float

Returns the step duration active at the beginning of a section.

ParameterTypeDefault
sectionsArray<Dynamic>—
bpmChangesArray<Dynamic>—
baseBpmFloat—
sectionIndexInt—

View source

Internals​

Private / internal members
Method
static function stepCrochet(change:Dynamic, fallback:Float):Float
static function positiveNumber(value:Dynamic, fallback:Float):Float
static function number(value:Dynamic, fallback:Float):Float