ChartingTiming
| Kind | class |
| Package | editors.charting |
| Full name | editors.charting.ChartingTiming |
| Source | source/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.
| Parameter | Type | Default |
|---|---|---|
section | Dynamic | — |
sectionStartStep
static function sectionStartStep(sections:Array<Dynamic>, sectionIndex:Int):Int
Returns the cumulative step at the beginning of a section.
| Parameter | Type | Default |
|---|---|---|
sections | Array<Dynamic> | — |
sectionIndex | Int | — |
sectionIndexAtStep
static function sectionIndexAtStep(sections:Array<Dynamic>, step:Float):Int
Finds the section containing a step. Times beyond the chart use its last section.
| Parameter | Type | Default |
|---|---|---|
sections | Array<Dynamic> | — |
step | Float | — |
timeAtStep
static function timeAtStep(bpmChanges:Array<Dynamic>, baseBpm:Float, step:Float):Float
Converts a step position to milliseconds using the active BPM-map entry.
| Parameter | Type | Default |
|---|---|---|
bpmChanges | Array<Dynamic> | — |
baseBpm | Float | — |
step | Float | — |
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.
| Parameter | Type | Default |
|---|---|---|
bpmChanges | Array<Dynamic> | — |
baseBpm | Float | — |
time | Float | — |
offset (optional) | Float | 0 |
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).
| Parameter | Type | Default |
|---|---|---|
sections | Array<Dynamic> | — |
bpmChanges | Array<Dynamic> | — |
baseBpm | Float | — |
sectionIndex | Int | — |
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.
| Parameter | Type | Default |
|---|---|---|
sections | Array<Dynamic> | — |
bpmChanges | Array<Dynamic> | — |
baseBpm | Float | — |
time | Float | — |
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.
| Parameter | Type | Default |
|---|---|---|
sections | Array<Dynamic> | — |
bpmChanges | Array<Dynamic> | — |
baseBpm | Float | — |
sectionIndex | Int | — |
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.
| Parameter | Type | Default |
|---|---|---|
sections | Array<Dynamic> | — |
bpmChanges | Array<Dynamic> | — |
baseBpm | Float | — |
sectionIndex | Int | — |
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 |