[][src]Struct romy::Sound

pub struct Sound { /* fields omitted */ }

A sound that can be played by the runtime.

Internally stores data as an array of 32 bit floating point values that range from -1.0 to 1.0

Methods

impl Sound[src]

pub fn from_data(sample_rate: i32, samples: &[f32]) -> Sound[src]

Create a sound from a slice of existing data

Arguments

  • sample_rate - the number of samples per second
  • data - slice of existing data

pub fn with_buffer_size(sample_rate: i32, sample_count: i32) -> Sound[src]

Create a blank/silent sound

Arguments

  • sample_rate - the number of samples per second
  • sample_count - the number of samples

pub fn with_buffer_sized_to_step(
    sample_rate: i32,
    steps_per_second: i32
) -> Sound
[src]

Create a sound with the number of samples needed to cover a specific step time

Arguments

  • sample_rate - the number of samples per second
  • steps_per_second - the number of steps per second

pub fn set_sample(&mut self, index: i32, sample: f32)[src]

Sets a value of the sample

Arguments

  • `index' sample index
  • sample - sample value

pub fn sample_rate(&self) -> i32[src]

Gets the sample rate of the sound

pub fn sample_count(&self) -> i32[src]

Gets the number of samples stored in this sound

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

Gets a reference to the raw sample data

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

Gets a mutable reference to the raw sample data

pub fn sample(&self, start: i32, length: i32) -> Sound[src]

Creates a new sound by sampling a section of this one

Arguments

  • `start' sample start index
  • length - length of the sample

Trait Implementations

impl Clone for Sound[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'de> Deserialize<'de> for Sound[src]

impl Debug for Sound[src]

impl Serialize for Sound[src]

Auto Trait Implementations

impl Send for Sound

impl Sync for Sound

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

impl<T, U> TryInto 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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.