package alsa

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Alsa.PcmSource

Sourcetype handle

Handle to a device.

Sourcetype params

Parameters of a device.

Sourcetype stream =
  1. | Playback
    (*

    Playback stream.

    *)
  2. | Capture
    (*

    Capture stream.

    *)

Wanted stream.

Sourcetype mode =
  1. | Async
    (*

    Asynchronous notification (not supported yet).

    *)
  2. | Non_blocking
    (*

    Non blocking I/O.

    *)

Modes for opening a stream.

Sourceval open_pcm : string -> stream list -> mode list -> handle
Sourceval close : handle -> unit
Sourceval prepare : handle -> unit

Prepare PCM for use.

Sourceval resume : handle -> unit

Resume from suspend, no samples are lost.

Sourceval recover : ?verbose:bool -> handle -> exn -> unit

Recover the stream state from an error or suspend. * This a high-level helper function building on other functions. * This functions handles Interrupted, Buffer_xrun and Suspended * exceptions trying to prepare given stream for next I/O. * Raises the given exception when not recognized/used.

Sourceval start : handle -> unit
Sourceval drain : handle -> unit

Stop a PCM preserving pending frames.

Sourceval drop : handle -> unit

Stop a PCM dropping pending frames.

Sourceval pause : handle -> bool -> unit

pause hnd pause pauses (when pause is true) or resume (when pause * is false) a PCM.

Sourceval reset : handle -> unit
Sourceval wait : handle -> int -> bool

Wait for a PCM to become ready. The second argument is the timeout in * milliseconds (negative for infinite). Returns false if a timeout * occured.

Sourceval readi : handle -> bytes -> int -> int -> int

readi handle buf ofs len reads len interleaved frames in buf * starting at offset ofs (in bytes). It returns the actual number of * frames read.

Sourceval writei : handle -> bytes -> int -> int -> int

writei handle buf ofs len writes len interleaved frames of buf * starting at offset ofs (in bytes).

Sourceval readn : handle -> bytes array -> int -> int -> int
Sourceval writen : handle -> bytes array -> int -> int -> int
Sourceval readn_float : handle -> float array array -> int -> int -> int
Sourceval writen_float : handle -> float array array -> int -> int -> int
Sourceval readn_float_ba : handle -> (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t array -> int
Sourceval writen_float_ba : handle -> (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t array -> int
Sourceval writei_float_ba : handle -> int -> (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t -> int
Sourceval readn_float64 : handle -> float array array -> int -> int -> int
Sourceval writen_float64 : handle -> float array array -> int -> int -> int
Sourceval get_delay : handle -> int

Get the delay (in frames).

Sourcetype state =
  1. | St_open
    (*

    open

    *)
  2. | St_setup
    (*

    setup installed

    *)
  3. | St_prepared
    (*

    ready to start

    *)
  4. | St_running
    (*

    running

    *)
  5. | St_xrun
    (*

    stopped: underrun (playback) or overrun (capture) detected

    *)
  6. | St_draining
    (*

    draining: running (playback) or stopped (capture)

    *)
  7. | St_paused
    (*

    paused

    *)
  8. | St_suspended
    (*

    hardware is suspended

    *)
  9. | St_disconnected
    (*

    hardward is disconnected

    *)

State.

Sourceval get_state : handle -> state

Get the current state.

Sourceval get_params : handle -> params
Sourceval set_params : handle -> params -> unit
Sourcetype access =
  1. | Access_rw_interleaved
  2. | Access_rw_noninterleaved

Access mode.

Sourceval set_access : handle -> params -> access -> unit

Set the access mode.

Sourcetype fmt =
  1. | Format_s16_le
    (*

    16 bits, little endian

    *)
  2. | Format_s24_3le
  3. | Format_float
    (*

    float 32 bit CPU endian

    *)
  4. | Format_float64
    (*

    float 64 bit CPU endian

    *)

Format of audio data.

Sourceval set_format : handle -> params -> fmt -> unit

Set the format of audio data.

Sourceval set_rate_near : handle -> params -> int -> direction -> int

set_rate_near handle params rate dir sets the sampling rate (in Hz). * If the rate is not avalaible, dir is used to determine the direction of * the nearest available sampling rate to use . The actual sampling rate used * is returned.

Sourceval set_channels : handle -> params -> int -> unit

Set the number of channels.

Sourceval set_periods : handle -> params -> int -> direction -> unit

Set the number of periods.

Sourceval get_periods_min : params -> int * direction

Get the number of periods.

Sourceval get_periods_max : params -> int * direction
Sourceval get_period_size : params -> int
Sourceval set_buffer_size : handle -> params -> int -> unit

Set the buffer size in frames.

Sourceval set_buffer_size_near : handle -> params -> int -> int

Set the buffer size near a value in frames.

Sourceval get_buffer_size : params -> int
Sourceval get_buffer_size_min : params -> int
Sourceval get_buffer_size_max : params -> int
Sourceval set_nonblock : handle -> bool -> unit

Set blocking mode (true means non-blocking).

Sourceval get_frame_size : params -> int

Get the size of a frame in bytes.

OCaml

Innovation. Community. Security.