Files
Lyrebird/Sources/Lyrebird/Trigger/TriggerEvent.swift
T
2026-06-01 18:27:40 -07:00

23 lines
941 B
Swift

// TriggerEvent.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
/// A trigger notification posted by the RT audio thread.
///
/// Value type with no reference fields — bitwise-copied into `SPSCQueue<TriggerEvent>`
/// with no ARC traffic or allocation on the RT thread.
///
/// `sampleTime` is the absolute engine sample counter at the start of the block in which
/// the ≤0→>0 edge was detected. `value` carries the instantaneous value of the `SendTrigger`
/// value input at the crossing frame.
public struct TriggerEvent: Sendable {
/// Trigger ID declared on the `SendTrigger` generator. Handlers filter by this value.
public let id: Int32
/// Value input sampled at the moment of the ≤0→>0 crossing.
public let value: Double
/// Absolute engine sample time of the block start containing the trigger edge.
public let sampleTime: SampleTime
}