Zum Inhalt

apple/PhysarumApp/Sources/Remote/RemoteMessage.swift

import PhysarumEngine

/// The wire protocol between the iPhone/iPad editor-remote and the ATV host. `Codable` so it
/// round-trips over JSON; `Equatable` so the host-side tests can prove field fidelity and the
/// sender can drop no-op `params` updates. `PresetParams` is Codable + Equatable (engine model);
/// `ControlIntent` gained `Codable` for this protocol — the player's command surface never forks.
enum RemoteMessage: Codable, Equatable {
    case hello(RemoteState)     // full sync on connect: the phone's current selection + params + cycle state
    case intent(ControlIntent)  // next / previous / jumpTo / togglePlaylist / show/dismiss overlay
    case params(PresetParams)   // live edited params (throttled by the sender)
    case audioFactors(AudioFactorFrame)  // T2b: the phone's mic-derived 10 audio factors (streamed ~30 Hz)
}

/// The full editing session the phone hands the ATV on connect, so the ATV adopts exactly what
/// the phone is showing (WYSIWYG mirror).
struct RemoteState: Codable, Equatable {
    let selectedID: String
    let params: PresetParams
    let cycling: Bool
}