pub struct PatchbayManager { /* private fields */ }Expand description
Главный менеджер патчбэя
Координирует все компоненты управления и автоматизации. Работает в отдельном потоке с настраиваемой частотой обновления.
Implementations§
Source§impl PatchbayManager
impl PatchbayManager
Sourcepub fn new(
config: PatchbayConfig,
command_queue: Arc<MpscQueue<ParameterCommand>>,
) -> Self
pub fn new( config: PatchbayConfig, command_queue: Arc<MpscQueue<ParameterCommand>>, ) -> Self
Создать новый менеджер
Sourcepub fn with_event_channel(self, tx: Sender<PatchbayEvent>) -> Self
pub fn with_event_channel(self, tx: Sender<PatchbayEvent>) -> Self
Установить канал для событий
Sourcepub fn add_automaton<A: Automaton + 'static>(
&mut self,
id: impl Into<String>,
automaton: A,
) -> Result<(), &'static str>where
A::State: 'static,
pub fn add_automaton<A: Automaton + 'static>(
&mut self,
id: impl Into<String>,
automaton: A,
) -> Result<(), &'static str>where
A::State: 'static,
Добавить автомат
Sourcepub fn add_lfo(
&mut self,
id: impl Into<String>,
frequency: f64,
amplitude: f64,
offset: f64,
waveform: LfoWaveform,
) -> Result<(), &'static str>
pub fn add_lfo( &mut self, id: impl Into<String>, frequency: f64, amplitude: f64, offset: f64, waveform: LfoWaveform, ) -> Result<(), &'static str>
Добавить LFO как автомат
Sourcepub fn add_envelope(
&mut self,
id: impl Into<String>,
attack: f64,
decay: f64,
sustain: f64,
release: f64,
) -> Result<(), &'static str>
pub fn add_envelope( &mut self, id: impl Into<String>, attack: f64, decay: f64, sustain: f64, release: f64, ) -> Result<(), &'static str>
Добавить огибающую как автомат
Sourcepub fn add_sequencer(
&mut self,
id: impl Into<String>,
steps: Vec<Step>,
) -> Result<(), &'static str>
pub fn add_sequencer( &mut self, id: impl Into<String>, steps: Vec<Step>, ) -> Result<(), &'static str>
Добавить секвенсор как автомат
Sourcepub fn add_function<F>(
&mut self,
id: impl Into<String>,
generator: F,
) -> Result<(), &'static str>
pub fn add_function<F>( &mut self, id: impl Into<String>, generator: F, ) -> Result<(), &'static str>
Добавить функциональный автомат
Sourcepub fn reset_automaton<A: Automaton + 'static>(
&mut self,
id: &str,
) -> Result<(), &'static str>
pub fn reset_automaton<A: Automaton + 'static>( &mut self, id: &str, ) -> Result<(), &'static str>
Сбросить автомат (generic, caller must know the type)
Sourcepub fn remove_automaton(&mut self, id: &str) -> bool
pub fn remove_automaton(&mut self, id: &str) -> bool
Удалить автомат
Sourcepub fn add_servo(
&mut self,
id: impl Into<String>,
automaton_id: impl Into<String>,
target_node: NodeId,
target_param: impl Into<String>,
_mapping: ParameterMapping,
_min: f64,
_max: f64,
) -> Result<(), &'static str>
pub fn add_servo( &mut self, id: impl Into<String>, automaton_id: impl Into<String>, target_node: NodeId, target_param: impl Into<String>, _mapping: ParameterMapping, _min: f64, _max: f64, ) -> Result<(), &'static str>
Добавить сервопривод (связь автомата с параметром)
Sourcepub fn add_lfo_servo(
&mut self,
id: impl Into<String>,
frequency: f64,
amplitude: f64,
offset: f64,
waveform: LfoWaveform,
target_node: NodeId,
target_param: impl Into<String>,
min: f64,
max: f64,
) -> Result<(), &'static str>
pub fn add_lfo_servo( &mut self, id: impl Into<String>, frequency: f64, amplitude: f64, offset: f64, waveform: LfoWaveform, target_node: NodeId, target_param: impl Into<String>, min: f64, max: f64, ) -> Result<(), &'static str>
Добавить LFO как сервопривод (упрощённый метод)
Sourcepub fn get_servo_mut(&mut self, id: &str) -> Option<&mut BoxedServo>
pub fn get_servo_mut(&mut self, id: &str) -> Option<&mut BoxedServo>
Получить мутабельный сервопривод
Sourcepub fn remove_servo(&mut self, id: &str) -> bool
pub fn remove_servo(&mut self, id: &str) -> bool
Удалить сервопривод
Sourcepub fn add_mapping(&mut self, mapping: Mapping)
pub fn add_mapping(&mut self, mapping: Mapping)
Добавить маппинг события
Sourcepub fn add_midi_mapping(
&mut self,
controller: u8,
channel: Option<u8>,
target_node: NodeId,
target_param: impl Into<String>,
min: f32,
max: f32,
transform: Transform,
)
pub fn add_midi_mapping( &mut self, controller: u8, channel: Option<u8>, target_node: NodeId, target_param: impl Into<String>, min: f32, max: f32, transform: Transform, )
Добавить MIDI маппинг
Sourcepub fn add_osc_mapping(
&mut self,
address: &str,
target_node: NodeId,
target_param: impl Into<String>,
min: f32,
max: f32,
transform: Transform,
)
pub fn add_osc_mapping( &mut self, address: &str, target_node: NodeId, target_param: impl Into<String>, min: f32, max: f32, transform: Transform, )
Добавить OSC маппинг
Sourcepub fn remove_mappings(&mut self, pattern: &EventPattern) -> usize
pub fn remove_mappings(&mut self, pattern: &EventPattern) -> usize
Удалить маппинги по паттерну
Sourcepub fn clear_mappings(&mut self)
pub fn clear_mappings(&mut self)
Очистить все маппинги
Sourcepub fn handle_event(&mut self, event: ControlEvent)
pub fn handle_event(&mut self, event: ControlEvent)
Обработать внешнее событие (MIDI/OSC)
Sourcepub fn handle_midi(&mut self, channel: u8, controller: u8, value: u8)
pub fn handle_midi(&mut self, channel: u8, controller: u8, value: u8)
Обработать MIDI сообщение (упрощённый метод)
Sourcepub fn handle_osc(&mut self, address: &str, args: Vec<f32>)
pub fn handle_osc(&mut self, address: &str, args: Vec<f32>)
Обработать OSC сообщение (упрощённый метод)
Sourcepub fn stats(&self) -> &PatchbayStats
pub fn stats(&self) -> &PatchbayStats
Получить статистику
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Сбросить статистику
Sourcepub fn current_time(&self) -> f64
pub fn current_time(&self) -> f64
Получить текущее время
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Проверить, запущен ли менеджер