[][src]Struct open_sound_module::cv::CvMessage

pub struct CvMessage {
    pub addr: CvAddress,
    pub arg: f32,
}

An Open Sound Module cv message

use std::io::Read;
use open_sound_module::{CvMessage, CvAddress};
  
fn main() -> Result<(), failure::Error> {
    let mut msg = CvMessage::new(CvAddress::A, -0.3);
    let bytes = msg.to_vec();
    let mut buf: [u8; 1024] = [0; 1024];
    let n = msg.read(&mut buf)?;
    assert!(n == 20);
    Ok(())  
}

Fields

addr: CvAddressarg: f32

Methods

impl CvMessage[src]

Important traits for CvMessage
pub fn new(addr: CvAddress, arg: f32) -> CvMessage[src]

Create a new CvMessage from the following args: addr (OSC address pattern)

  • CvAddress::A
  • CvAddress::B arg: (float32)
  • 0.0 to 1.0 for unipolar signal from 0 to 5v
  • -1.0 to 1.0 for bipolar signal from -5 to 5v

pub fn to_vec(&self) -> Vec<u8>[src]

Return a vector of u8 bytes represending the CvMessage in Open Sound Control protocol.

Trait Implementations

impl Clone for CvMessage[src]

impl PartialEq<CvMessage> for CvMessage[src]

impl Copy for CvMessage[src]

impl Debug for CvMessage[src]

impl Display for CvMessage[src]

fn fmt(&self, f: &mut Formatter) -> Result[src]

Display Trait for CvMessage

impl Read for CvMessage[src]

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>[src]

Read Trait for CvMessage

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> From<T> for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

impl<R> ReadBytesExt for R where
    R: Read + ?Sized
[src]

impl<S> FromSample<S> for S[src]

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 
[src]