truce_iced/param_message.rs
1//! Message types for parameter and plugin communication.
2
3use std::fmt::Debug;
4
5/// Low-level parameter edit messages matching the host's begin/set/end protocol.
6#[derive(Debug, Clone)]
7pub enum ParamMessage {
8 /// Begin an edit gesture (mouse-down on a control).
9 BeginEdit(u32),
10 /// Set a parameter's normalized value (0.0–1.0).
11 SetNormalized(u32, f64),
12 /// End an edit gesture (mouse-up).
13 EndEdit(u32),
14 /// Multiple parameter messages in one update (e.g. XY pad).
15 Batch(Vec<ParamMessage>),
16}
17
18/// Unified message type wrapping both parameter messages and plugin-specific messages.
19///
20/// Iced requires a single message type per program. This enum merges parameter
21/// control messages with the plugin author's custom message type `M`.
22#[derive(Debug, Clone)]
23pub enum Message<M> {
24 /// A parameter value changed (from host automation or GUI interaction).
25 Param(ParamMessage),
26 /// A meter value was updated (polled at ~60fps).
27 Meter(u32, f32),
28 /// Tick - fired ~60fps, triggers param/meter polling.
29 Tick,
30 /// Plugin-specific message.
31 Plugin(M),
32}