Struct babycat::DecodeArgs[][src]

#[repr(C)]
pub struct DecodeArgs { pub start_time_milliseconds: u64, pub end_time_milliseconds: u64, pub frame_rate_hz: u32, pub num_channels: u32, pub convert_to_mono: bool, pub zero_pad_ending: bool, pub resample_mode: u32, }
Expand description

Specifies what transformations to apply to the audio during the decoding process.

The default value for this struct will tell Babycat to decode audio as-is and not change anything.

Fields

start_time_milliseconds: u64
Expand description

We discard any audio before this millisecond offset. By default, this does nothing and the audio is decoded from the beginning. Negative offsets are invalid.

end_time_milliseconds: u64
Expand description

We discard any audio after this millisecond offset. By default, this does nothing and the audio is decoded all the way to the end. If start_time_milliseconds is specified, then end_time_milliseconds must be greater. The resulting

frame_rate_hz: u32
Expand description

A destination frame rate to resample the audio to. Do not specify this parameter if you wish Babycat to preserve the audio’s original frame rate. This does nothing if frame_rate_hz is equal to the audio’s original frame rate.

num_channels: u32
Expand description

Set this to a positive integer n to select the first n channels stored in the audio file. By default, Babycat will return all of the channels in the original audio. This will raise an exception if you specify a num_channels greater than the actual number of channels in the audio.

convert_to_mono: bool
Expand description

Set to true to average all channels into a single monophonic (mono) channel. If num_channels = n is also specified, then only the first n channels will be averaged. Note that convert_to_mono cannot be set to true while also setting num_channels = 1.

zero_pad_ending: bool
Expand description

If you set this to true, Babycat will zero-pad the ending of the decoded waveform to ensure that the output waveform’s duration is exactly end_time_milliseconds - start_time_milliseconds. By default, zero_pad_ending = false, in which case the output waveform will be shorter than end_time_milliseconds - start_time_milliseconds if the input audio is shorter than end_time_milliseconds.

resample_mode: u32
Expand description

Sets which resampling method is used if you have set frame_rate_hz. This usually defaults to the highest-accuracy resampler compiled into Babycat.

Current valid values include:

  • RESAMPLE_MODE_BABYCAT: A custom resampler maintained within Babycat. This is designed for speed and compatibility with compilation targets where libsamplerate cannot be used.

  • RESAMPLE_MODE_LIBSAMPLERATE: This uses libsamplerate at the SRC_SINC_BEST_QUALITY setting. This option is only available if it is enabled at compile-time, and is disabled for targets missing a libc, such as the WebAssembly wasm32-unknown-unknown target.

Trait Implementations

impl Clone for DecodeArgs[src]

fn clone(&self) -> DecodeArgs[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for DecodeArgs[src]

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

Formats the value using the given formatter. Read more

impl Default for DecodeArgs[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

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

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl PartialEq<DecodeArgs> for DecodeArgs[src]

fn eq(&self, other: &DecodeArgs) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &DecodeArgs) -> bool[src]

This method tests for !=.

impl Serialize for DecodeArgs[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl Copy for DecodeArgs[src]

impl Eq for DecodeArgs[src]

impl StructuralEq for DecodeArgs[src]

impl StructuralPartialEq for DecodeArgs[src]

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<F, T> IntoSample<T> for F where
    T: FromSample<F>, 

pub fn into_sample(self) -> T

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]