Module Portaudio


module Portaudio: sig .. end
Bindings for the portaudio portable audio library.


Author(s): Samuel Mimram



Exceptions


exception Error of int
An error occured. In the future, this exception should be replaced by more specific exceptions. Use string_of_error to get a description of the error.
exception Unanticipated_host_error
An unanticipaced
val string_of_error : int -> string
Get a description of an error.
val get_last_host_error : unit -> int * string
Get the last errror which occured together with its description.

General


val get_version : unit -> int
Version of portaudio.
val get_version_string : unit -> string
Version of portaudio.
val init : unit -> unit
Initialize the portaudio library. Should be called before calling any other function.
val terminate : unit -> unit
Stop using the library. This function should be called before ending the program and no other portaudio function should be called after.

Host API


val get_host_api_count : unit -> int
Number of available host API.
val get_default_host_api : unit -> int
Index of the default host API.
val get_default_input_device : unit -> int
Default input device.
val get_default_output_device : unit -> int
Default output device.
val get_device_count : unit -> int
Number of available devices.

Streams



type sample_format =
| Format_int8
| Format_int16
| Format_int24
| Format_int32
| Format_float32
Format of samples.

type stream_parameters = {
   channels : int;
   device : int;
   sample_format : sample_format;
   latency : float;
}
Parameters of the stream.
type stream 
val open_default_stream : ?callback:(unit -> unit) ->
?format:sample_format ->
int -> int -> int -> int -> stream
open_default_stream callback format inchans outchans rate bufframes opens default stream with callback as callback function, handling samples in format format with inchans input channels and outchans output channels at rate samples per seconds with handling buffers of size bufframes.
val close_stream : stream -> unit
Close a stream.
val start_stream : stream -> unit
Start a stream.
val stop_stream : stream -> unit
Stop a stream.
val abort_stream : stream -> unit
Abort a stream.
val write_stream : stream -> float array array -> int -> int -> unit
Write to a stream.
val read_stream : stream -> float array array -> int -> int -> unit
Read from a stream.