Struct Photocoupler
pub struct Photocoupler {
pub model: PhotocouplerModel,
/* private fields */
}Expand description
Photocoupler element with Persyn-style two-rate CdS dynamics.
The LDR is modeled as a resistor whose value depends on LED illumination. The CdS material has two carrier recombination pathways (fast and slow), creating the characteristic “breathing” response of optical tremolos.
In WDF terms, this is a one-port resistor with time-varying resistance. The LED current is an external control parameter (0.0 = off, 1.0 = full).
Fields§
§model: PhotocouplerModelImplementations§
§impl Photocoupler
impl Photocoupler
pub fn new(model: PhotocouplerModel, sample_rate: f64) -> Photocoupler
pub fn set_led_drive(&mut self, led_drive: f64)
pub fn set_led_drive(&mut self, led_drive: f64)
Set LED drive level and update LDR resistance.
led_drive is normalized 0.0 (off) to 1.0 (full brightness).
Call this once per sample before using the element in WDF.
pub fn effective_light_level(&self) -> f64
pub fn effective_light_level(&self) -> f64
Get current LED drive level (for monitoring).
Trait Implementations§
§impl Clone for Photocoupler
impl Clone for Photocoupler
§fn clone(&self) -> Photocoupler
fn clone(&self) -> Photocoupler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl ControlledResistance for Photocoupler
impl ControlledResistance for Photocoupler
§fn set_control(&mut self, value: f64)
fn set_control(&mut self, value: f64)
Set the control value (0.0 = minimum effect, 1.0 = maximum effect). Read more
§fn effective_control(&self) -> f64
fn effective_control(&self) -> f64
Get the current effective control level (after any internal filtering).
impl Copy for Photocoupler
§impl Debug for Photocoupler
impl Debug for Photocoupler
§impl WdfLeaf for Photocoupler
impl WdfLeaf for Photocoupler
§fn set_incident(&mut self, _a: f64)
fn set_incident(&mut self, _a: f64)
Set incident wave (no state update needed for resistor).
§fn port_resistance(&self) -> f64
fn port_resistance(&self) -> f64
Port resistance seen looking into this element (Ω).
§fn set_sample_rate(&mut self, sample_rate: f64)
fn set_sample_rate(&mut self, sample_rate: f64)
Update sample rate (for reactive elements C, L).
Auto Trait Implementations§
impl Freeze for Photocoupler
impl RefUnwindSafe for Photocoupler
impl Send for Photocoupler
impl Sync for Photocoupler
impl Unpin for Photocoupler
impl UnsafeUnpin for Photocoupler
impl UnwindSafe for Photocoupler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more