Skip to main content

LanPlacementMode

Enum LanPlacementMode 

Source
pub enum LanPlacementMode {
    JitterBuffered {
        jitter_packets: u32,
        latency_comp_frames: u64,
    },
    BarDelay {
        bars: u32,
        beats_per_bar: u32,
        tempo_bpm: u32,
        jitter_packets: u32,
        latency_comp_frames: u64,
    },
}
Expand description

Placement mode for a stream fragment hosted on a LAN peer.

Selects how packets crossing the LAN are buffered and time-aligned: a plain jitter buffer for buffered preview, or a musically aligned bar delay for collaborative play.

Variants§

§

JitterBuffered

Jitter-buffered preview placement.

Fields

§jitter_packets: u32

Packets retained in the jitter buffer.

§latency_comp_frames: u64

Latency-compensation delay applied, in frames.

§

BarDelay

Musically aligned collaborative placement delayed by whole bars.

Fields

§bars: u32

Number of bars of alignment delay.

§beats_per_bar: u32

Beats per bar used to size the bar delay.

§tempo_bpm: u32

Tempo in beats per minute used to size the bar delay.

§jitter_packets: u32

Packets retained in the jitter buffer.

§latency_comp_frames: u64

Latency-compensation delay applied, in frames.

Implementations§

Source§

impl LanPlacementMode

Source

pub fn jitter_buffered( jitter_packets: u32, latency_comp_frames: u64, ) -> Result<Self>

Builds a jitter-buffered mode retaining jitter_packets packets.

Returns an evaluation error when jitter_packets is zero.

§Examples
use sim_lib_stream_host::LanPlacementMode;

let mode = LanPlacementMode::jitter_buffered(4, 128).unwrap();
assert_eq!(mode.jitter_packets(), 4);
assert_eq!(mode.latency_comp_frames(), 128);
assert!(mode.bar_delay_millis().is_none());
Source

pub fn bar_delay( bars: u32, tempo_bpm: u32, jitter_packets: u32, latency_comp_frames: u64, ) -> Result<Self>

Builds a bar-delay mode delaying bars bars at tempo_bpm.

Uses a default of four beats per bar. Returns an evaluation error when bars, tempo_bpm, or jitter_packets is zero.

Source

pub fn symbol(self) -> Symbol

Returns the stable mode symbol.

Source

pub fn latency_class(self) -> LatencyClass

Returns the latency class this mode places the fragment into.

Source

pub fn jitter_packets(self) -> u32

Returns the number of packets retained in the jitter buffer.

Source

pub fn latency_comp_frames(self) -> u64

Returns the latency-compensation delay in frames.

Source

pub fn bar_delay_millis(self) -> Option<u64>

Returns the bar-delay length in milliseconds, or None for jitter-buffered placement.

Source

pub fn transport_profile(self) -> Result<TransportProfile>

Returns the transport profile advertised for this mode.

Trait Implementations§

Source§

impl Clone for LanPlacementMode

Source§

fn clone(&self) -> LanPlacementMode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LanPlacementMode

Source§

impl Debug for LanPlacementMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for LanPlacementMode

Source§

impl PartialEq for LanPlacementMode

Source§

fn eq(&self, other: &LanPlacementMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for LanPlacementMode

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.