Data_Lines
Data lines bridge live producer-owned state into UI, gameplay, wrapper, and judge code. This page covers Godot access through CoreLine and InputLine, then defines the native ownership, threading, and ABI contracts.
Why Data Lines Exist
A data line is a small bridge to live producer-owned state. It avoids copying entire playback or input buffers and lets UI, gameplay, wrapper, and judge code observe a common timing model.
PDJE currently uses:
PDJE_CORE_DATA_LINE for playback cursor, rendered PCM, and audio timing.
PDJE_INPUT_DATA_LINE for keyboard/mouse and MIDI event transports.
Godot code does not receive these raw pointers. CoreLine exposes copied values, and InputLine converts events into Godot signals.
Godot CoreLine
Create the player first, then request a CoreLine from PDJE_Wrapper.
if not engine.InitPlayer(
PDJE_Wrapper.HYBRID_RENDER,
"track-title",
480):
return
var core_line: CoreLine = engine.PullOutCoreLine()
if core_line == null:
return
var engine_time: PackedInt64Array = core_line.GetUsedFrame()
var now_cursor: int = core_line.GetNowCursor()
var max_cursor: int = core_line.GetMaxCursor()
var rendered_pcm: PackedFloat32Array = core_line.GetPreRenderedFrames()
CoreLine methods:
Method |
Meaning |
|---|---|
GetUsedFrame() |
Two-element PackedInt64Array: index 0 is consumed PCM frames and index 1 is the synchronized monotonic microsecond timestamp. |
GetNowCursor() |
Current playback cursor in PCM frames. |
GetMaxCursor() |
Maximum rendered cursor/frame extent. |
GetPreRenderedFrames() |
Copied interleaved pre-rendered PCM when the player mode provides it. |
The C++ wrapper implementation names the helper GetEngineTime(), but the method bound into GDScript is GetUsedFrame(). Do not call the unbound implementation name from Godot.
PDJE_Wrapper.ResetPlayer() destroys the current player. Do not cache a CoreLine across that call, a new InitPlayer(), or engine teardown; request a new line from PullOutCoreLine() after the producer changes.
Godot InputLine
PDJE_Input_Module.InitializeInputLine(input_line) injects the current native input data line into an InputLine node. Polling then emits copied Godot signal payloads.
if not input.Init():
return
var selected_devices := input.GetDevs()
if not input.Config(selected_devices, []):
return
input.InitializeInputLine($InputLine)
input.Run()
func _process(_delta: float) -> void:
$InputLine.emit_input_signal()
Use Input_Engine for complete device selection and signal arguments. InputLine must be initialized again after PDJE_Input_Module.Kill() or module reconstruction.
Judge Connection
PDJE_Judge_Module.AddDataLines(input_module, core_wrapper) obtains raw native data lines from the two producer wrappers. It does not consume the Godot CoreLine or InputLine objects.
if not judge.AddDataLines($PDJE_Input_Module, $PDJE_Wrapper):
push_error("Judge data-line setup failed")
A valid player and configured input module must already exist. If either producer is reset, stop judge and call AddDataLines() again before restart. See Judge_Engine for the complete order.
Contributor Lifetime And Threading Rules
Native data-line members are non-owning pointers.
The player or input module owns the pointed storage.
Resetting, replacing, or destroying a producer invalidates prior lines.
Audio, input-backend, IPC, and judge worker threads can update the underlying state concurrently.
Read briefly and copy values needed beyond the current operation.
Never free or mutate producer storage through a raw line.
Use player, input, music-panel, FX-panel, and judge methods for mutations.
A wrapper returning a Godot array has copied data; that copy does not keep the native producer alive.
Core Native Contract
PDJE_CORE_DATA_LINE currently carries non-owning access to:
nowCursor — current PCM-frame position
maxCursor — total rendered frame extent
preRenderedData — interleaved stereo PCM when pre-rendering exists
syncD — audio synchronization state including consumed frames, pre-calculated unused frames, and a microsecond timestamp
PDJE::PullOutDataLine() returns an empty line until a player exists.
Input Native Contract
PDJE_INPUT_DATA_LINE contains independent channels:
input_arena for standard keyboard and mouse logs
midi_datas for atomically swapped MIDI event vectors
For standard input, PDJE_INPUT_DATA_LINE::input_arena points to a PDJE_IPC::PDJE_Input_Transfer. Native consumers call its non-blocking Linux or IPC-synchronized Windows Receive() method to refresh input_arena->datas before reading the current event vector. MIDI consumers read the current atomic double-buffer snapshot. Judge initialization currently requires a non-null standard-input arena even when MIDI rails are configured.
ABI And Integration Notes
The native structures can evolve with the Core and Input libraries. Treat their layout as version-sensitive at every external ABI boundary. Godot code should use CoreLine, InputLine, and PDJE_Judge_Module.AddDataLines() instead of attempting to model the raw structs.
Primary source anchors:
Native symbol lookup:
-
PDJE_CORE_DATA_LINE PDJE::PullOutDataLine()
-
struct PDJE_CORE_DATA_LINE
data line for transmission with other mosudles. all datas are pointer. use carefully.
-
struct audioSyncData
-
PDJE_INPUT_DATA_LINE PDJE_Input::PullOutDataLine()
pull out input data line. The input Loop will pass datas in here.
-
struct PDJE_INPUT_DATA_LINE