[][src]Struct purezen::pd::Context

pub struct Context<'pd> { /* fields omitted */ }

Pure Data context object: main API entrypoint and owner of all state (objects, graphs, etc).

In an Entity-Component-System (ECS) model, which this library is gradually adopting, this type is the System or ECS object.

Methods

impl<'pd> Context<'pd>[src]

pub fn new(
    num_input_channels: usize,
    num_output_channels: usize,
    block_size: usize,
    sample_rate: f32
) -> Self
[src]

Create a new pd::Context. This is the first thing you'll need to do in order to use this crate.

pub fn get_num_input_channels(&self) -> usize[src]

Get the number of input channels

pub fn get_num_output_channels(&self) -> usize[src]

Get the number of output channels

pub fn get_block_size(&self) -> usize[src]

Get the audio block size we're generating in bytes

pub fn get_sample_rate(&self) -> f32[src]

Get the current sample rate

Important traits for &'a mut [u8]
pub fn get_global_dsp_buffer_at_inlet(&self, inlet_index: usize) -> &[f32][src]

Returns the global DSP buffer at the given inlet

Exclusively used by DspAdc

Important traits for &'a mut [u8]
pub fn get_global_dsp_buffer_at_outlet(&self, outlet_index: usize) -> &[f32][src]

Returns the global DSP buffer at the given outlet

Exclusively used by DspDac

pub fn get_block_start_timestamp(&self) -> Timestamp[src]

Returns the timestamp of the beginning of the current block

pub fn get_block_duration(&self) -> Duration[src]

Returns the duration of one block

pub fn get_object_mut(&mut self, object_id: Id) -> Option<&mut Object>[src]

Get an object with a given object ID

pub fn get_graph_mut(&mut self, graph_id: Id) -> Option<&mut Graph>[src]

Get the graph with a given graph ID

pub fn process(&mut self, input_buffers: &[f32], output_buffers: &mut [f32])[src]

Run the Pure Data engine, processing the given input and output buffers

pub fn print_err(&mut self, msg: &str)[src]

Prints the given message to error output

pub fn print_std(&mut self, msg: &str)[src]

Prints the given message to standard output

pub fn set_value_for_name(&mut self, name: &str, constant: f32)[src]

Set global floating point constant value.

Used with MessageValue for keeping track of global variables.

pub fn get_value_for_name(&self, name: &str) -> Option<f32>[src]

Get global floating point constant value.

Used with MessageValue for keeping track of global variables.

pub fn register_external_receiver(&mut self, receiver_name: &str)[src]

Register an external receiver.

pub fn unregister_external_receiver(&mut self, receiver_name: &str)[src]

Unregister an external receiver

pub fn send_message_to_named_receivers<N>(
    &mut self,
    _name: &str,
    _message: &Message<'pd, N>
) where
    N: ArrayLength<Atom<'pd>>, 
[src]

Sends the given message to all receive objects with the given name.

This function is used by message boxes to send messages described be the syntax:

name message;

pub fn schedule_external_message<N>(
    &mut self,
    receiver_name: &str,
    _message: &Message<'pd, N>
) where
    N: ArrayLength<Atom<'pd>>, 
[src]

Schedules a message to be sent to all receivers at the start of the next block.

pub fn schedule_external_message_string(
    &mut self,
    receiver_name: &str,
    timestamp: Timestamp,
    init_string: &str
) -> Result<(), Error>
[src]

Schedules a message described by the given string to be sent to named receivers at the given timestamp.

pub fn schedule_message<N>(
    &mut self,
    _message_obj: Object,
    _outlet_index: Index,
    _message: Message<'pd, N>
) where
    N: ArrayLength<Atom<'pd>>, 
[src]

Schedules a pd::Message to be sent by the message::Object from the outlet_index at the specified time.

pub fn cancel_message<N>(
    &mut self,
    _message_obj: &Object,
    _outlet_index: Index,
    _message: &Message<'pd, N>
) where
    N: ArrayLength<Atom<'pd>>, 
[src]

Cancel a scheduled pd::Message according to its id.

The message memory will be freed.

pub fn receive_system_message<N>(&mut self, _message: &Message<'pd, N>) where
    N: ArrayLength<Atom<'pd>>, 
[src]

Receives and processes messages sent to the Pd system by sending to pd

Auto Trait Implementations

impl<'pd> Send for Context<'pd>

impl<'pd> Sync for Context<'pd>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T[src]

type Output = T

Should always be Self