[−][src]Struct romy::Sound
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 seconddata
- 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 secondsample_count
- the number of samples
pub fn with_buffer_sized_to_step(
sample_rate: i32,
steps_per_second: i32
) -> Sound
[src]
sample_rate: i32,
steps_per_second: i32
) -> Sound
Create a sound with the number of samples needed to cover a specific step time
Arguments
sample_rate
- the number of samples per secondsteps_per_second
- the number of steps per second
pub fn set_sample(&mut self, index: i32, sample: f32)
[src]
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(&self) -> 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]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Sound, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Sound, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Debug for Sound
[src]
impl Serialize for Sound
[src]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.