module Portaudio:sig..end
Bindings for the portaudio portable audio library.
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 -> stringGet a description of an error.
val get_last_host_error : unit -> int * stringGet the last errror which occured together with its description.
val get_version : unit -> intVersion of portaudio.
val get_version_string : unit -> stringVersion of portaudio.
val init : unit -> unitInitialize the portaudio library. Should be called before calling any other function.
val terminate : unit -> unitStop using the library. This function should be called before ending the program and no other portaudio function should be called after.
type host_api_info = {
|
h_struct_version : |
|
h_host_api_type : |
|
h_name : |
|
h_device_count : |
|
h_default_input_device : |
|
h_default_output_device : |
Host API Information
val get_host_api_count : unit -> intNumber of available host API.
val get_default_host_api : unit -> intIndex of the default host API.
val get_host_api_info : int -> host_api_infoInformation on a host API
type device_info = {
|
d_struct_version : |
|
d_name : |
|
d_host_api : |
|
d_max_input_channels : |
|
d_max_output_channels : |
|
d_default_low_input_latency : |
|
d_default_low_output_latency : |
|
d_default_high_input_latency : |
|
d_default_high_output_latency : |
|
d_default_sample_rate : |
Device Information
val get_default_input_device : unit -> intDefault input device.
val get_default_output_device : unit -> intDefault output device.
val get_device_count : unit -> intNumber of available devices.
val get_device_info : int -> device_infoInformation on device
type ('a, 'b) sample_format
The abstract type ('a, 'b) sample_format describes the OCaml type 'a
and the underlying C type 'a used to represent the data being written to or
read from a stream. This type is compatible with ('a, 'b) Bigarray.kind.
val format_int8 : (int, Bigarray.int8_signed_elt) sample_format
val format_int16 : (int, Bigarray.int16_signed_elt) sample_format
val format_int24 : (int32, Bigarray.int32_elt) sample_format
val format_int32 : (int32, Bigarray.int32_elt) sample_format
val format_float32 : (float, Bigarray.float32_elt) sample_formatThe stream uses floats in the range of -1.,1. to represent audio data.
The underlying type is a 32 bit float.
type ('a, 'b) stream_parameters = {
|
channels : |
|
device : |
|
sample_format : |
|
latency : |
type stream_flag
type ('a, 'b, 'c, 'd) stream
type('a, 'b, 'c, 'd)callback =('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t ->
('c, 'd, Bigarray.c_layout) Bigarray.Genarray.t -> int -> int
The function signature of a callback. Callbacks only work with interleaved streams.
val open_stream : ('a, 'b) stream_parameters option ->
('c, 'd) stream_parameters option ->
?interleaved:bool ->
float ->
int ->
?callback:('a, 'b, 'c, 'd) callback ->
stream_flag list -> ('a, 'b, 'c, 'd) streamopen_stream inparam outparam interleaved rate bufframes callback flags opens a new
stream with input stream of format inparam, output stream of format
outparam using interleaved or non-interleaved interleaved buffers
at rate samples per second, with bufframes frames per buffer
passed the callback function callback (0 means leave this choice to
portaudio).
val open_default_stream : ?callback:('a, 'b, 'a, 'b) callback ->
?format:('a, 'b) sample_format ->
?interleaved:bool ->
int -> int -> int -> int -> ('a, 'b, 'a, 'b) streamopen_default_stream callback format interleaved inchans outchans rate bufframes
opens default stream with callback as callback function, handling samples in
format format using interleaved or non-interleaved buffers interleaved with
inchans input channels and outchans output channels
at rate samples per seconds with handling buffers of size bufframes.
val close_stream : ('a, 'b, 'c, 'd) stream -> unitClose a stream.
val start_stream : ('a, 'b, 'c, 'd) stream -> unitStart a stream.
val stop_stream : ('a, 'b, 'c, 'd) stream -> unitStop a stream.
val abort_stream : ('a, 'b, 'c, 'd) stream -> unitAbort a stream.
val sleep : int -> unitSleep.
val write_stream : ('a, 'b, 'c, 'd) stream -> 'c array array -> int -> int -> unitWrite to a stream.
val read_stream : ('a, 'b, 'c, 'd) stream -> 'a array array -> int -> int -> unitRead from a stream.
val write_stream_ba : ('a, 'b, 'c, 'd) stream ->
('c, 'd, Bigarray.c_layout) Bigarray.Genarray.t -> int -> int -> unitWrite to a stream using a bigarray.
val read_stream_ba : ('a, 'b, 'c, 'd) stream ->
('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> int -> int -> unitRead from a stream using a bigarray.