Alsa.Pcmtype mode = | Async | (* Asynchronous notification (not supported yet). *) |
| Non_blocking | (* Non blocking I/O. *) |
Modes for opening a stream.
Open given device (use "defaut" for default one) with given streams and modes.
val close : handle -> unitClose device.
val prepare : handle -> unitPrepare PCM for use.
val resume : handle -> unitResume from suspend, no samples are lost.
val recover : ?verbose:bool -> handle -> exn -> unitRecover 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 -> unitStart the PCM.
val drain : handle -> unitStop a PCM preserving pending frames.
val drop : handle -> unitStop a PCM dropping pending frames.
val pause : handle -> bool -> unitpause hnd pause pauses (when pause is true) or resume (when pause is false) a PCM.
val reset : handle -> unitval wait : handle -> int -> boolWait 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 -> bytes -> int -> int -> intreadi 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 -> bytes -> int -> int -> intwritei handle buf ofs len writes len interleaved frames of buf starting at offset ofs (in bytes).
val readn : handle -> bytes array -> int -> int -> intRead non-interleaved frames.
val writen : handle -> bytes array -> int -> int -> intWrite non-interleaved frames.
val readn_float : handle -> float array array -> int -> int -> intval writen_float : handle -> float array array -> int -> int -> intval writei_floatn : handle -> float array array -> int -> int -> intWrite in interleaved way non-interleaved frames.
val readn_float_ba :
handle ->
( float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.c_layout )
Stdlib.Bigarray.Array1.t
array ->
intval writen_float_ba :
handle ->
( float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.c_layout )
Stdlib.Bigarray.Array1.t
array ->
intval writei_float_ba :
handle ->
int ->
( float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.c_layout )
Stdlib.Bigarray.Array1.t ->
intval readn_float64 : handle -> float array array -> int -> int -> intval writen_float64 : handle -> float array array -> int -> int -> intval get_delay : handle -> intGet the delay (in frames).
type state = State.
type fmt = | Format_s16_le | (* 16 bits, little endian *) |
| Format_s24_3le | |
| Format_float | (* float 32 bit CPU endian *) |
| Format_float64 | (* float 64 bit CPU endian *) |
Format of audio data.
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 get_period_size : params -> intSet the buffer size near a value in frames.
val get_buffer_size : params -> intval get_buffer_size_min : params -> intval get_buffer_size_max : params -> intval set_nonblock : handle -> bool -> unitSet blocking mode (true means non-blocking).
val get_frame_size : params -> intGet the size of a frame in bytes.