Skip to main content

PatchbayControl

Struct PatchbayControl 

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

Главный контроллер патчбэя

Работает в потоке управления (soft RT) и отправляет команды в аудиопоток через MpscQueue<ParameterCommand>.

Implementations§

Source§

impl PatchbayControl

Source

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

Создать новый контроллер

Source

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

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

Source

pub fn add_mapping_str( &mut self, pattern: &str, target_node: NodeId, target_param: &str, min: f32, max: f32, transform: Transform, ) -> Result<(), &'static str>

Добавить маппинг из строк (удобно для скриптов)

Source

pub fn add_servo<A: Automaton + 'static>(&mut self, servo: Servo<A>)

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

Source

pub fn add_lfo( &mut self, id: &str, frequency: f64, amplitude: f64, offset: f64, waveform: LfoWaveform, target_node: NodeId, target_param: &str, min: f64, max: f64, )

Добавить LFO как сервопривод

Source

pub fn add_envelope( &mut self, id: &str, attack: f64, decay: f64, sustain: f64, release: f64, target_node: NodeId, target_param: &str, min: f64, max: f64, )

Добавить огибающую как сервопривод

Source

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

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

Source

pub fn update(&mut self, dt: f32)

Обновить состояние (вызывается регулярно из потока управления)

Source

pub fn mappings(&self) -> &[Mapping]

Получить все маппинги

Source

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

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

Source

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

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

Source

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

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

Source

pub fn clear(&mut self)

Очистить все маппинги и сервоприводы

Source

pub fn reset_time(&mut self)

Сбросить время

Source

pub fn current_time(&self) -> Time

Текущее время

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