View Source Membrane.RawAudio.SampleFormat (Membrane: raw audio format v0.12.0)
This module defines sample formats used in Membrane.RawAudio
and some helpers to deal with them.
Summary
Functions
Converts positive integer containing serialized format to atom.
Converts 3-tuple format to an equivalent atom form
converts audio format to 32-bit unsigned integer consisting of (from oldest bit)
Converts format atom to an equivalent 3-tuple form
Types
@type endianness_t() :: :le | :be | :any
@type sample_size_t() :: 8 | 16 | 24 | 32 | 64
@type sample_type_t() :: :s | :u | :f
@type t() ::
:s8
| :u8
| :s16le
| :u16le
| :s16be
| :u16be
| :s24le
| :u24le
| :s24be
| :u24be
| :s32le
| :u32le
| :s32be
| :u32be
| :f32le
| :f32be
| :f64le
| :f64be
Functions
@spec deserialize(pos_integer()) :: t()
Converts positive integer containing serialized format to atom.
expects serialized format
returns format atom (See t/0
)
@spec from_tuple({sample_type_t(), sample_size_t(), endianness_t()}) :: t()
Converts 3-tuple format to an equivalent atom form
@spec serialize(t()) :: pos_integer()
converts audio format to 32-bit unsigned integer consisting of (from oldest bit):
- first bit for type (int/float)
- then bit for encoding (unsigned/signed)
- then bit for endianity (little/big)
- then sequence of zeroes
- last 8 bits for size (in bits)
expects atom format
returns format encoded as integer
@spec to_tuple(t()) :: {sample_type_t(), sample_size_t(), endianness_t()}
Converts format atom to an equivalent 3-tuple form
@spec values() :: [t()]