View Source Membrane.RawAudio.SampleFormat (Membrane: raw audio format v0.9.0)

This module defines sample formats used in Membrane.RawAudio and some helpers to deal with them.

Link to this section 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

Link to this section 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() ::
  :f64be
  | :f64le
  | :f32be
  | :f32le
  | :u32be
  | :s32be
  | :u32le
  | :s32le
  | :u24be
  | :s24be
  | :u24le
  | :s24le
  | :u16be
  | :s16be
  | :u16le
  | :s16le
  | :u8
  | :s8

Link to this section Functions

Link to this function

deserialize(serialized_format)

View Source
@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()]