package funkin.ui.debug.charting.toolboxes; import funkin.audio.SoundGroup; import haxe.ui.components.Button; import haxe.ui.components.HorizontalSlider; import haxe.ui.components.Label; import flixel.addons.display.FlxTiledSprite; import flixel.math.FlxMath; import haxe.ui.components.NumberStepper; import haxe.ui.components.Slider; import haxe.ui.backend.flixel.components.SpriteWrapper; import funkin.ui.debug.charting.commands.SetAudioOffsetCommand; import funkin.ui.haxeui.components.WaveformPlayer; import funkin.audio.waveform.WaveformDataParser; import haxe.ui.containers.VBox; import haxe.ui.containers.Absolute; import haxe.ui.containers.ScrollView; import haxe.ui.containers.Frame; import haxe.ui.core.Screen; import haxe.ui.events.DragEvent; import haxe.ui.events.MouseEvent; import haxe.ui.events.UIEvent; /** * The toolbox which allows modifying information like Song Title, Scroll Speed, Characters/Stages, and starting BPM. */ // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. @:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/offsets.xml")) class ChartEditorOffsetsToolbox extends ChartEditorBaseToolbox { var waveformContainer:Absolute; var waveformScrollview:ScrollView; var waveformPlayer:WaveformPlayer; var waveformOpponent:WaveformPlayer; var waveformInstrumental:WaveformPlayer; var offsetButtonZoomIn:Button; var offsetButtonZoomOut:Button; var offsetButtonPause:Button; var offsetButtonPlay:Button; var offsetButtonStop:Button; var offsetStepperPlayer:NumberStepper; var offsetStepperOpponent:NumberStepper; var offsetStepperInstrumental:NumberStepper; var offsetTicksContainer:Absolute; var playheadSprite:SpriteWrapper; static final TICK_LABEL_X_OFFSET:Float = 4.0; static final PLAYHEAD_RIGHT_PAD:Float = 10.0; static final BASE_SCALE:Float = 64.0; static final MIN_SCALE:Float = 4.0; static final WAVEFORM_ZOOM_MULT:Float = 1.5; static final MAGIC_SCALE_BASE_TIME:Float = 5.0; var waveformScale:Float = BASE_SCALE; var playheadAbsolutePos(get, set):Float; function get_playheadAbsolutePos():Float { return playheadSprite.left; } function set_playheadAbsolutePos(value:Float):Float { return playheadSprite.left = value; } var playheadRelativePos(get, set):Float; function get_playheadRelativePos():Float { return playheadSprite.left - waveformScrollview.hscrollPos; } function set_playheadRelativePos(value:Float):Float { return playheadSprite.left = waveformScrollview.hscrollPos + value; } /** * The amount you need to multiply the zoom by such that, at the base zoom level, one tick is equal to `MAGIC_SCALE_BASE_TIME` seconds. */ var waveformMagicFactor:Float = 1.0; var audioPreviewTracks:SoundGroup; var tickTiledSprite:FlxTiledSprite; var tickLabels:Array