Xalsa v0.3.0 Xalsa View Source

Elixir ALSA connector. The Xalsa module implements the API. The client may send any number of frames as a binary array of 32 bit floats and may optionally receive back a notification in form of a :ready4more message 5-10 ms before all frames are consumed by the ALSA driver.

The :xalsa application needs to be started before calling the API. Also check the config/config.exs file on how to configure PCM devices for xalsa.

Link to this section Summary

Types

The sample rate is set in the application environment (config file for the application).

Functions

Reset the max prepare time gauges to 0

Reset the max prepare time gauges to 0

Convert a list of (Erlang) floats to a binary of 32 bit (C) floats

Flush any :ready4more messages from the xalsa server in input queue. Returns true if there were any.

The maximum map size for output mixer, for all started pcm cards, since application start or last reset. Indicates how many processes that concurrently are queueing frames to be output.

The maximum buffer prepare time in µs, for all started pcm cards, since application start or last reset.

Total number of channels for all PCM devices together.

Lists the PCM names and their number of channels respectively.

Return the number of frames that the ALSA driver consumes per callback cycle.

The sample rate, number of frames per second

Send frames in a binary array of frame:32/float-native. If the notify flag is true a :ready4more message will be sent to the process in the from argument when the process frames are due to be consumed within 5-10 ms. This so that the process may synthesize/produce more frames.

The client will wait until :ready4more notification is sent from xalsa server.

Link to this section Types

Specs

rates() :: 44100 | 48000 | 96000 | 192_000

The sample rate is set in the application environment (config file for the application).

Link to this section Functions

Specs

clear_max_map_size() :: :ok

Reset the max prepare time gauges to 0

Specs

clear_max_mix_time() :: :ok

Reset the max prepare time gauges to 0

Link to this function

float_list_to_binary(fl)

View Source

Specs

float_list_to_binary([float()]) :: binary()

Convert a list of (Erlang) floats to a binary of 32 bit (C) floats

Specs

flush_ready4more() :: boolean()

Flush any :ready4more messages from the xalsa server in input queue. Returns true if there were any.

Specs

max_map_size() :: [pos_integer()]

The maximum map size for output mixer, for all started pcm cards, since application start or last reset. Indicates how many processes that concurrently are queueing frames to be output.

Specs

max_mix_time() :: [pos_integer()]

The maximum buffer prepare time in µs, for all started pcm cards, since application start or last reset.

Examples

iex> Xalsa.max_mix_time()
[254]

Specs

no_of_channels() :: pos_integer()

Total number of channels for all PCM devices together.

Specs

pcms() :: list()

Lists the PCM names and their number of channels respectively.

Example

iex> Xalsa.pcms()
["plughw:1,0": 2]

Specs

period_size() :: pos_integer()

Return the number of frames that the ALSA driver consumes per callback cycle.

Specs

rate() :: rates()

The sample rate, number of frames per second

Link to this function

send_frames(frames, channel, notify \\ false, from \\ self())

View Source

Specs

send_frames(
  frames :: binary(),
  channel :: pos_integer(),
  notify :: boolean(),
  from :: pid()
) :: :ok

Send frames in a binary array of frame:32/float-native. If the notify flag is true a :ready4more message will be sent to the process in the from argument when the process frames are due to be consumed within 5-10 ms. This so that the process may synthesize/produce more frames.

Specs

wait_ready4more() :: :ok

The client will wait until :ready4more notification is sent from xalsa server.