Struct cpal::Data

source · []
pub struct Data { /* private fields */ }
Expand description

A buffer of dynamically typed audio data, passed to raw stream callbacks.

Raw input stream callbacks receive &Data, while raw output stream callbacks expect &mut Data.

Implementations

The sample format of the internal audio data.

The full length of the buffer in samples.

The returned length is the same length as the slice of type T that would be returned via as_slice given a sample type that matches the inner sample format.

The raw slice of memory representing the underlying audio data as a slice of bytes.

It is up to the user to interpret the slice of memory based on Data::sample_format.

The raw slice of memory representing the underlying audio data as a slice of bytes.

It is up to the user to interpret the slice of memory based on Data::sample_format.

Access the data as a slice of sample type T.

Returns None if the sample type does not match the expected sample format.

Access the data as a slice of sample type T.

Returns None if the sample type does not match the expected sample format.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.