module Pcm: sig
.. end
type
handle
Handle to a device.
type
params
Parameters of a device.
type
stream =
Wanted stream.
type
mode =
Modes for opening a stream.
val open_pcm : string -> stream list -> mode list -> handle
val close : handle -> unit
val prepare : handle -> unit
Prepare PCM for use.
val resume : handle -> unit
Resume from suspend, no samples are lost.
val 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.
val start : handle -> unit
val drain : handle -> unit
Stop a PCM preserving pending frames.
val drop : handle -> unit
Stop a PCM dropping pending frames.
val pause : handle -> bool -> unit
pause hnd pause
pauses (when pause
is true
) or resume (when pause
is false
) a PCM.
val reset : handle -> unit
val 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.
val readi : handle -> string -> 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.
val writei : handle -> string -> int -> int -> int
writei handle buf ofs len
writes len
interleaved frames of buf
starting at offset ofs
(in bytes).
val readn : handle -> string array -> int -> int -> int
val writen : handle -> string array -> int -> int -> int
val readn_float : handle -> float array array -> int -> int -> int
val writen_float : handle -> float array array -> int -> int -> int
val readn_float64 : handle -> float array array -> int -> int -> int
val writen_float64 : handle -> float array array -> int -> int -> int
val get_delay : handle -> int
Get the delay (in frames).
type
state =
| |
St_open |
| |
St_setup |
| |
St_prepared |
| |
St_running |
| |
St_xrun |
| |
St_draining |
| |
St_paused |
| |
St_suspended |
| |
St_disconnected |
State.
val get_state : handle -> state
Get the current state.
val get_params : handle -> params
val set_params : handle -> params -> unit
type
access =
| |
Access_rw_interleaved |
| |
Access_rw_noninterleaved |
Access mode.
val set_access : handle -> params -> access -> unit
Set the access mode.
type
fmt =
| |
Format_s16_le |
| |
Format_s24_3le |
| |
Format_float |
| |
Format_float64 |
Format of audio data.
val set_format : handle -> params -> fmt -> unit
Set the format of audio data.
val set_rate_near : handle -> params -> int -> Alsa.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.
val set_channels : handle -> params -> int -> unit
Set the number of channels.
val set_periods : handle -> params -> int -> Alsa.direction -> unit
Set the number of periods.
val get_periods_min : params -> int * Alsa.direction
Get the number of periods.
val get_periods_max : params -> int * Alsa.direction
val set_buffer_size : handle -> params -> int -> unit
Set the buffer size in frames.
val set_buffer_size_near : handle -> params -> int -> int
Set the buffer size near a value in frames.
val get_buffer_size_min : params -> int
val get_buffer_size_max : params -> int
val set_nonblock : handle -> bool -> unit
Set blocking mode (true
means non-blocking).
val get_frame_size : params -> int
Get the size of a frame in bytes.