Skip to main content

Module engine

Module engine 

Source
Expand description

Референсный оркестратор — high-level API над green threads

§PatchbayEngine — референсный оркестратор

Высокоуровневая обёртка над PatchbayControl, PortCombiner и green threads. Скрывает детали спавна задач, отмены и маршрутизации.

§Использование

use std::sync::Arc;
use std::time::Duration;
use rill_core::queues::MpscQueue;
use rill_core::NodeId;
use rill_patchbay::prelude::*;

let queue = Arc::new(MpscQueue::new());
let mut engine = PatchbayEngine::new(queue.clone());

// LFO как green thread
engine.add_lfo(
    "lfo1", 0.3, 0.5, 0.0, LfoWaveform::Sine,
    Duration::from_millis(10),
    (NodeId(2), "cutoff".into()), (100.0, 1000.0),
    ControlStrategy::Absolute,
    ConflictStrategy::BasePlusModulation,
);

// Маппинг MIDI → параметр
engine.add_mapping(midi_cc(
    21, None, NodeId(2), "cutoff", 100.0, 1000.0, Transform::Linear,
));

// Обработка внешнего события
engine.handle_event(ControlEvent::MidiControl {
    channel: 1, controller: 21, value: 64, normalized: 0.5,
});

// Остановка всех задач
engine.stop();

Structs§

PatchbayEngine
High-level orchestrator for the patchbay system.