Expand description
Hook system for action execution events Action System Hook Interface
Provides extensible hook points for action execution events.
§Use Cases
- Recording/Replay: Capture action events for session recording
- MIDI Learning: Map hardware controls to actions
- Analytics: Track action usage patterns
- Debug Logging: Trace action execution for debugging
- Network Sync: Synchronize actions across multiple instances (OSC/Artnet)
- UI State: Update undo/redo buffers, highlight active controls
§Usage
ⓘ
use glitcher_api::hooks::{ActionHook, BeforeActionEvent, AfterActionEvent};
struct MyRecordingHook {
events: Vec<RecordedEvent>,
}
impl ActionHook for MyRecordingHook {
fn before_action(&mut self, event: &BeforeActionEvent) {
println!("About to execute: {}", event.action_name);
}
fn after_action(&mut self, event: &AfterActionEvent) {
if event.result.is_ok() {
self.events.push(RecordedEvent {
timestamp_ms: event.timestamp_ms,
node_id: event.node_id,
action_name: event.action_name.clone(),
random_seed: event.random_seed,
});
}
}
}Structs§
- After
Action Event - Event fired after action execution
- Before
Action Event - Event fired before action execution
- Recorded
Event - Recorded event for session recording/replay
Traits§
- Action
Hook - Hook interface for action execution events