Skip to main content

PatchbayManager

Struct PatchbayManager 

Source
pub struct PatchbayManager { /* private fields */ }
Expand description

Главный менеджер патчбэя

Координирует все компоненты управления и автоматизации. Работает в отдельном потоке с настраиваемой частотой обновления.

Implementations§

Source§

impl PatchbayManager

Source

pub fn new( config: PatchbayConfig, command_queue: Arc<MpscQueue<ParameterCommand>>, ) -> Self

Создать новый менеджер

Source

pub fn with_event_channel(self, tx: Sender<PatchbayEvent>) -> Self

Установить канал для событий

Source

pub fn add_automaton<A: Automaton + 'static>( &mut self, id: impl Into<String>, automaton: A, ) -> Result<(), &'static str>
where A::State: 'static,

Добавить автомат

Source

pub fn add_lfo( &mut self, id: impl Into<String>, frequency: f64, amplitude: f64, offset: f64, waveform: LfoWaveform, ) -> Result<(), &'static str>

Добавить LFO как автомат

Source

pub fn add_envelope( &mut self, id: impl Into<String>, attack: f64, decay: f64, sustain: f64, release: f64, ) -> Result<(), &'static str>

Добавить огибающую как автомат

Source

pub fn add_sequencer( &mut self, id: impl Into<String>, steps: Vec<Step>, ) -> Result<(), &'static str>

Добавить секвенсор как автомат

Source

pub fn add_function<F>( &mut self, id: impl Into<String>, generator: F, ) -> Result<(), &'static str>
where F: Fn(f64) -> f64 + Send + Sync + 'static,

Добавить функциональный автомат

Source

pub fn reset_automaton<A: Automaton + 'static>( &mut self, id: &str, ) -> Result<(), &'static str>

Сбросить автомат (generic, caller must know the type)

Source

pub fn remove_automaton(&mut self, id: &str) -> bool

Удалить автомат

Source

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>

Добавить сервопривод (связь автомата с параметром)

Source

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 как сервопривод (упрощённый метод)

Source

pub fn get_servo(&self, id: &str) -> Option<&dyn AnyServo>

Получить сервопривод

Source

pub fn get_servo_mut(&mut self, id: &str) -> Option<&mut BoxedServo>

Получить мутабельный сервопривод

Source

pub fn remove_servo(&mut self, id: &str) -> bool

Удалить сервопривод

Source

pub fn add_mapping(&mut self, mapping: Mapping)

Добавить маппинг события

Source

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 маппинг

Source

pub fn add_osc_mapping( &mut self, address: &str, target_node: NodeId, target_param: impl Into<String>, min: f32, max: f32, transform: Transform, )

Добавить OSC маппинг

Source

pub fn remove_mappings(&mut self, pattern: &EventPattern) -> usize

Удалить маппинги по паттерну

Source

pub fn clear_mappings(&mut self)

Очистить все маппинги

Source

pub fn handle_event(&mut self, event: ControlEvent)

Обработать внешнее событие (MIDI/OSC)

Source

pub fn handle_midi(&mut self, channel: u8, controller: u8, value: u8)

Обработать MIDI сообщение (упрощённый метод)

Source

pub fn handle_osc(&mut self, address: &str, args: Vec<f32>)

Обработать OSC сообщение (упрощённый метод)

Source

pub fn start(&mut self) -> Result<(), &'static str>

Запустить менеджер в отдельном потоке

Source

pub fn stop(&mut self)

Остановить менеджер

Source

pub fn stats(&self) -> &PatchbayStats

Получить статистику

Source

pub fn reset_stats(&mut self)

Сбросить статистику

Source

pub fn current_time(&self) -> f64

Получить текущее время

Source

pub fn is_running(&self) -> bool

Проверить, запущен ли менеджер

Trait Implementations§

Source§

impl Drop for PatchbayManager

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V